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:in
require’
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:in
require’
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:in
define’
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:in
call’
… 17 levels…
from ./xm.rb:14:in find' from /usr/lib/ruby/1.8/find.rb:38:in
catch’
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