Still no love on ubuntu

I posted last week about some trouble I was having getting Ruby (not
rails; just ruby) to function properly on either OS X (10.4) or Ubuntu.
A kind soul pointed out my mistake, which got Ruby working fine on the
Mac, and I was able to finish writing the small tool I needed to do.

However, now I need to deploy on Ubuntu, and the code that works on OS X
produces a rather dramatic error on Ubuntu.

Error:
$ ./xm.rb
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require': no such file to load -- openssl (LoadError) from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
from
/usr/lib/ruby/gems/1.8/gems/net-ssh-1.0.9/lib/net/ssh/transport/ossl/services.rb:17
from
/usr/lib/ruby/gems/1.8/gems/needle-1.3.0/lib/needle/container.rb:354:in
require' from /usr/lib/ruby/gems/1.8/gems/needle-1.3.0/lib/needle/definition-context.rb:77:inrequire’
from
/usr/lib/ruby/gems/1.8/gems/net-ssh-1.0.9/lib/net/ssh/transport/services.rb:137:in
register_services' from /usr/lib/ruby/gems/1.8/gems/net-ssh-1.0.9/lib/net/ssh/transport/services.rb:23:indefine’
from
/usr/lib/ruby/gems/1.8/gems/needle-1.3.0/lib/needle/container.rb:250:in
namespace_define' from /usr/lib/ruby/gems/1.8/gems/needle-1.3.0/lib/needle/container.rb:250:incall’
… 17 levels…
from ./xm.rb:14:in find' from /usr/lib/ruby/1.8/find.rb:38:incatch’
from /usr/lib/ruby/1.8/find.rb:38:in `find’
from ./xm.rb:14

Listing:

#!/usr/bin/ruby

require ‘find’
require ‘fileutils’
require ‘rubygems’
require ‘net/ssh’
require ‘net/sftp’

asndir = “/home/arfid/ASN”
donedir = “/home/arfid/done”

Find.find(asndir) do |path|
if File.basename(path) =~ /^DOD/
begin
Net::SFTP.start(‘192.168.1.102’, ‘user’, ‘xxxxx’) do |sftp|
sftp.put_file(path, “#{File.basename(path)}”)
end
FileUtils.mv(path, “#{donedir}/#{File.basename(path)}”)
rescue StandardError
$stderr.print "ASN Transmission Problem: " + $! + “\n”
raise
end
else
next
end
end

Belay that. Of course, after posting, I found an answer almost
immediately where none had been before.

I was missing an apt-gettable library. I’m not sure which, since I took
the “shotgun” approach and did this:

sudo sudo apt-get install libzlib-ruby libyaml-ruby libdrb-ruby
liberb-ruby zlib1g-dev libopenssl-ruby

that I found here:

best,
c

Chet F. wrote:

Ubuntu Forums

Chet, if you take a look at the third line of the error message you
posted previously, it points out the file you were missing (the openssl
library).

$ ./xm.rb
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require’: no such file to load – openssl (LoadError)

Hope this helps in any future debugging.

Jamey