Capistrano 3, show task output (if logger level is info by default)
# deploy.rb
def with_verbosity(verbosity_level)
old_verbosity = SSHKit.config.output_verbosity
begin
SSHKit.config.output_verbosity = verbosity_level
yield
ensure
SSHKit.config.output_verbosity = old_verbosity
end
end
# task
namespace :thor do
desc "Run task"
task :execute do
on roles(:app) do
within release_path do
with rails_env: fetch(:rails_env) do
with_verbosity(Logger::DEBUG) do
execute :bundle, :exec, :thor, ENV['taskname']
end
end
end
end
end
end
Written by Ivan Teplyakov
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#