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
45 46 47 |
# File 'lib/cap-util/run.rb', line 45 def run(*args, &block) cap.run(*args, &block) end |
#run_as(user, cmd_str, opts = {}, &block) ⇒ Object
53 54 55 56 |
# File 'lib/cap-util/run.rb', line 53 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
58 59 60 |
# File 'lib/cap-util/run.rb', line 58 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
49 50 51 |
# File 'lib/cap-util/run.rb', line 49 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
62 63 64 |
# File 'lib/cap-util/run.rb', line 62 def sudo(*args, &block) cap.sudo(*args, &block) end |