Module: CapUtil::Run::InstanceMethods
- Defined in:
- lib/cap-util/run.rb
Instance Method Summary collapse
- #run(*args, &block) ⇒ Object
- #run_as(user, cmd_str, opts = {}, &block) ⇒ Object
- #run_as_with_stdin(user, cmd_str, input, opts = {}) ⇒ Object
- #run_with_stdin(cmd_str, input, opts = {}) ⇒ Object
- #sudo(*args, &block) ⇒ Object
Instance Method Details
#run(*args, &block) ⇒ Object
28 29 30 |
# File 'lib/cap-util/run.rb', line 28 def run(*args, &block) cap.run(*args, &block) end |
#run_as(user, cmd_str, opts = {}, &block) ⇒ Object
36 37 38 39 |
# File 'lib/cap-util/run.rb', line 36 def run_as(user, cmd_str, opts = {}, &block) as_cmd_str = "su #{user} -lc '#{cmd_str.gsub("'", "\\'")}'" run(as_cmd_str, opts, &block) end |
#run_as_with_stdin(user, cmd_str, input, opts = {}) ⇒ Object
41 42 43 |
# File 'lib/cap-util/run.rb', line 41 def run_as_with_stdin(user, cmd_str, input, opts={}) run_as(user, cmd_str, opts) {|ch, stream, out| ch.send_data(input + "\n")} end |
#run_with_stdin(cmd_str, input, opts = {}) ⇒ Object
32 33 34 |
# File 'lib/cap-util/run.rb', line 32 def run_with_stdin(cmd_str, input, opts = {}) run(cmd_str, opts.merge(:pty => true)) {|ch, stream, out| ch.send_data(input + "\n")} end |
#sudo(*args, &block) ⇒ Object
45 46 47 |
# File 'lib/cap-util/run.rb', line 45 def sudo(*args, &block) cap.sudo(*args, &block) end |