For what it's worth, here is my script with all the rubyscript2exe and
keyfile issues resolved:
---------------
require 'rubygems'
require 'net/ssh'
require 'rubyscript2exe'
RUBYSCRIPT2EXE.dlls = ["zlib.dll"]
RUBYSCRIPT2EXE.bin = ["rsa_key", "rsa_key.pub"]
if RUBYSCRIPT2EXE.is_compiled?
keyfile = RUBYSCRIPT2EXE.appdir[0..-4] + 'bin/rsa_key'
else
keyfile = 'rsa_key'
end
puts
puts "WARNING!! The password will be displayed as you type."
puts "Make sure there are no prying eyes!!"
Net::SSH.start( 'files02',
:username=>'myusername',
:keys=>[keyfile] ) do |session|
system("cls")
unless RUBYSCRIPT2EXE.is_compiling?
session.open_channel do |channel|
channel.on_data do |ch, data|
puts data
end
channel.exec "ls -al"
end
session.loop
end
end
----------------
Just make sure zlib.dll, rsa_key (the private key), and rsa_key.pub (the
public key) are in the same directory as the script, and it compiles
just fine with rubyscript2exe, pulling in everything you need.
The password that is being prompted is because I have a password on my
key file. I'm going to try to hack this file
net-ssh-1.1.2/lib/net/ssh/transport/ossl/key-factory.rb to make the
password prompt a little more friendly (not showing the full file name,
and hiding the password as it's typed).
--
Posted via http://www.ruby-forum.com/.