井底之蛙

March 6, 2007

no such file to load — openssl

Filed under: ruby

Playing with scRUBYt! is not very easy. When I try to run the following example it complained there is no ‘openssl’ lib could found.

require ‘rubygems’
require ’scrubyt’

google_data = Scrubyt::Extractor.define do
  fetch ‘http://www.google.com/’
  fill_textfield ‘q’, ‘ruby’
  submit
      
  result ‘Ruby Programming Language’
end

google_data.to_xml.write($stdout, 1)
Scrubyt::ResultDumper.print_statistics(google_data)

I googled and found maybe need ‘libopenssl-ruby1.8‘. After ‘apt-get install libopenssl-ruby1.8′, it still complained no ‘openssl’ cound found.

In the end, I found a solution here. Because I installed Ruby from compiling source, I should compile to install ‘openssl’ lib also.

Enter your ruby-source/ext/openssl directory and then

ruby extconf.rb
make
make install

Well, now the scRUBYt! example could run without any complains. Good.

December 26, 2006

用 jEdit 打造巨爽无比的 Ruby 代码编辑环境

Filed under: jedit, ruby, rails

jEdit 加上两三个插件,写起 Ruby 来是非常爽的。步骤也很简单,下面是我的实践。

  • 在 Plugin Manager 中选择 RubyPlugin、Project Viewer、SuperAbbrevs 三个插件(这三个是需要手动选择的,其它关联的它会自动选上),安装它们,需要连接网络。
  • Utilities -> Gloable Options -> Shortcuts 中设置一下快捷键,我只设置了 RubyPlugin 的 Code Complete 快捷键为 Ctrl + Space。其它的随你喜欢。
现在你编辑 Ruby 时已经可以享受代码提示和基本的代码补全功能了,但如果你还想再爽一些,比如只用敲两个字符就能自动补全整个代码块,那么还需要多一点点设置。

好了,现在或许你需要重启一下 jEdit,然后可以试着编辑一个 rb 文件,敲入 bt,按一下 Tab 键,你会惊叫一声的,整个语句都为你自动补全了,并且现在你按下 Tab 键会在你需要修改的地方自动回转,怎么样,爽呆了吧。

所有的缩写可以在 Plugins -> Plugin Options -> SuperAbbrevs -> Abbreviations 下面找到。

  • 还想随时查阅 Ruby Docs?没问题。选择 Plugins  -> RubyPlugin -> Ruby Docs (Toggle),出现的对话框左上角有个黑色的小三角,点击它,让你选择 doc 的悬浮位置,我选停靠右边。看到文档了吧,供你随时查阅。
基本上我觉得有代码补全,高亮,缩写这几个功能就非常爽了。如果还不满足,Google 吧。






















Get free blog up and running in minutes with Blogsome
Theme designed by Minz Meyer