Class: GithubBackup::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/github-backup/shell.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#debugObject (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