I'd like to be able to output information from a rake task called by SSHKit but I can't see how to do it.
Say I have the following rake tasks:
require 'sshkit/dsl'
task :hello => :environment do
puts "Hello world"
end
task :sshkit_hello => :environment do
run_locally do
rake "hello"
end
end
If I run the :hello task on it's own I see the "hello world" statement. However, call it from the sshkit task and I just get SSHKit info. How can I write out info from that first rake task that will appear when called from SSHKit?
rake hello
=> Hello world
rake sshkit_hello
=> INFO [f0857f14] Running /usr/bin/env rake hello on
=> INFO [f0857f14] Finished in 6.107 seconds with exit status 0 (successful).
EDIT1:
I've found that you can add the following to get basic terminal output:
SSHKit.config.output = $stdout
but, again, the information outputted is the same - it tells you that it's running 'rake hello' but not the output from 'rake hello'.
rake sshkit_hello
=> rake hello
Solved!
What I actually needed to do was change the output_verbosity to :debug in order for it to show the puts statement in the second rake task:
SSHKit.config.output_verbosity = :debug
rake sshkit_hello
=> INFO [6dd1bbf7] Running bundle exec rake hello on
=> DEBUG [6dd1bbf7] Command: bundle exec rake hello
=> DEBUG [6dd1bbf7] Hello World!
=> INFO [6dd1bbf7] Finished in 6.596 seconds with exit status 0 (successful).