Class: GithubBackup::Shell
- Inherits:
-
Object
- Object
- GithubBackup::Shell
- Defined in:
- lib/github-backup/shell.rb
Instance Attribute Summary collapse
-
#debug ⇒ Object
readonly
Returns the value of attribute debug.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Shell
constructor
A new instance of Shell.
- #run(command) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Shell
Returns a new instance of Shell.
5 6 7 |
# File 'lib/github-backup/shell.rb', line 5 def initialize(opts = {}) @debug = opts[:debug] || false end |
Instance Attribute Details
#debug ⇒ Object (readonly)
Returns the value of attribute debug.
3 4 5 |
# File 'lib/github-backup/shell.rb', line 3 def debug @debug end |
Instance Method Details
#run(command) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/github-backup/shell.rb', line 9 def run(command) puts "EXECUTING: #{command}" if debug IO.popen(command, 'r') do |io| output = io.read puts "OUTPUT:" if debug puts output if debug end end |