Skip to content

Instantly share code, notes, and snippets.

@drbrain
Created June 9, 2016 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drbrain/feb579c1066f7fca9df4225342c9af83 to your computer and use it in GitHub Desktop.
Save drbrain/feb579c1066f7fca9df4225342c9af83 to your computer and use it in GitHub Desktop.
Rake sh capabilities
** Invoke default (first_time)
** Invoke shellmode (first_time)
** Execute shellmode
echo hello world
hello world
** Invoke shellmode_ENV (first_time)
** Execute shellmode_ENV
{"MESSAGE"=>"hello world"} echo $MESSAGE
hello world
** Invoke direct (first_time)
** Execute direct
echo hello world
hello world
** Invoke io (first_time)
** Execute io
rake aborted!
ArgumentError: no such option: out
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/file_utils_ext.rb:138:in `rake_check_options'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/file_utils.rb:50:in `sh'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/file_utils_ext.rb:37:in `sh'
/Users/erichodel/Rakefile:20:in `block in <top (required)>'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:201:in `block in invoke_prerequisites'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:199:in `each'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:199:in `invoke_prerequisites'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:178:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
/usr/local/lib/ruby/gems/2.3.0/gems/rake-10.5.0/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:22:in `load'
/usr/local/bin/rake:22:in `<main>'
Tasks: TOP => default => io
task default: %w[shellmode shellmode_ENV direct io]
task :shellmode do
sh "echo hello world"
end
task :shellmode_ENV do
env = {
'MESSAGE' => 'hello world',
}
sh env, "echo $MESSAGE"
end
task :direct do
sh "echo", "hello world"
end
task :io do
sh "echo", "hello world", out: IO::NULL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment