Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
desc "remotely console"
task :console, :roles => :app do
input = ''
run "cd #{current_path} && rails console #{ENV['RAILS_ENV']}" do |channel, stream, data|
next if data.chomp == input.chomp || data.chomp == ''
print data
channel.send_data(input = $stdin.gets) if data =~ /:\d{3}:\d+(\*|>)/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment