Skip to content

Instantly share code, notes, and snippets.

@tatat
Last active December 13, 2015 23:08
Show Gist options
  • Save tatat/4989172 to your computer and use it in GitHub Desktop.
Save tatat/4989172 to your computer and use it in GitHub Desktop.
Capistrano で対話的な?
set :default_run_options, :pty => true
set(:username) { Capistrano::CLI.ui.ask('Username: ') }
set(:password) { Capistrano::CLI.password_prompt('Password: ') }
namespace :deploy do
task :nyan, :roles => [:app] do
run 'something interactive' do |channel, stream, output|
Capistrano::Configuration.default_io_proc.call(channel, stream, output)
channel.send_data(username + "\n") if output =~ /^Username:/
channel.send_data(password + "\n") if output =~ /^Password:/
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment