Module: Bash
- Included in:
- RoCommands::Base
- Defined in:
- lib/ro_commands/helpers/bash.rb
Instance Method Summary collapse
- #_bash(cmd) ⇒ Object
- #bash(*cmds) ⇒ Object
- #bash_lines(cmd) ⇒ Object
- #bash_per(*cmds) ⇒ Object
- #handle_path(cmd) ⇒ Object
Instance Method Details
#_bash(cmd) ⇒ Object
3 4 5 6 7 |
# File 'lib/ro_commands/helpers/bash.rb', line 3 def _bash(cmd) cmd = handle_path(cmd) result = `#{cmd}` Out.out result end |
#bash(*cmds) ⇒ Object
18 19 20 21 22 |
# File 'lib/ro_commands/helpers/bash.rb', line 18 def bash(*cmds) unless cmds.empty? _bash(cmds.flatten.join(" && ")) end end |
#bash_lines(cmd) ⇒ Object
30 31 32 |
# File 'lib/ro_commands/helpers/bash.rb', line 30 def bash_lines(cmd) bash(cmd).split("\n") end |
#bash_per(*cmds) ⇒ Object
24 25 26 27 28 |
# File 'lib/ro_commands/helpers/bash.rb', line 24 def bash_per(*cmds) cmds.each do |c| bash c end end |
#handle_path(cmd) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/ro_commands/helpers/bash.rb', line 9 def handle_path(cmd) r = cmd[/\/(\w|\/)*/] if r cmd.gsub! r, "\'#{r}\'" else cmd end end |