require 'specinfra'
Specinfra.configuration.backend = :ssh
Specinfra.configuration.host = 'sample.udzura.jp'
Specinfra.configuration.ssh_options = {user: 'udzura', keys: '/Users/udzura/.ssh/udzura.pem'}
Specinfra.configuration.request_pty = true
Specinfra.backend
#=> #<Specinfra::Backend::Ssh:0x007fd10b9c4418 @config={}>
cmd = Specinfra::Runner.run_command('whoami')
#=> #<Specinfra::CommandResult:0x007fd10bb352e8 @stdout="root\n", @stderr="", @exit_status=0, @exit_signal=nil>
puts cmd.stdout
# root
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme