Class: HecksCLI::CommandRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/cli/command_runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(hexagon, name, dry_run = false) ⇒ CommandRunner

Runs CLI Commands



5
6
7
8
9
# File 'lib/cli/command_runner.rb', line 5

def initialize(hexagon, name, dry_run = false)
  @hexagon = hexagon
  @dry_run = dry_run
  @name    = name
end

Instance Method Details

#call(command) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/cli/command_runner.rb', line 11

def call(command)
  output = full_command(command)
  unless File.directory?('tmp')
    FileUtils.mkdir('tmp')
  end
  File.open('tmp/hecks', 'a') { |file| file.write(output + "\n")  }
  return if dry_run
end