lib/ztk/ssh.rb in ztk-0.0.10 vs lib/ztk/ssh.rb in ztk-0.0.11

- old
+ new

@@ -119,11 +119,11 @@ # config.user = ENV["USER"] # config.host_name = "127.0.0.1" # end # ssh.console def console - log(:debug) { "console" } + log(:info) { "console(#{console_command.inspect})" } log(:debug) { "config(#{@config.inspect})" } Kernel.exec(console_command) end @@ -147,15 +147,14 @@ # config.user = ENV["USER"] # config.host_name = "127.0.0.1" # end # puts ssh.exec("hostname -f").inspect def exec(command, options={}) - log(:debug) { "exec(#{command.inspect}, #{options.inspect})" } + log(:info) { "exec(#{command.inspect}, #{options.inspect})" } log(:debug) { "config(#{@config.inspect})" } @ssh ||= Net::SSH.start(@config.host_name, @config.user, ssh_options) - log(:debug) { "ssh(#{@ssh.inspect})" } options = OpenStruct.new({ :silence => false }.merge(options)) log(:debug) { "options(#{options.inspect})" } output = "" @@ -202,11 +201,10 @@ def upload(local, remote) log(:debug) { "upload(#{local.inspect}, #{remote.inspect})" } log(:debug) { "config(#{@config.inspect})" } @sftp ||= Net::SFTP.start(@config.host_name, @config.user, ssh_options) - log(:debug) { "sftp(#{@sftp.inspect})" } @sftp.upload!(local.to_s, remote.to_s) do |event, uploader, *args| case event when :open log(:info) { "upload(#{args[0].local} -> #{args[0].remote})" } @@ -242,10 +240,9 @@ def download(remote, local) log(:debug) { "download(#{remote.inspect}, #{local.inspect})" } log(:debug) { "config(#{@config.inspect})" } @sftp ||= Net::SFTP.start(@config.host_name, @config.user, ssh_options) - log(:debug) { "sftp(#{@sftp.inspect})" } @sftp.download!(remote.to_s, local.to_s) do |event, downloader, *args| case event when :open log(:info) { "download(#{args[0].remote} -> #{args[0].local})" }