class CommandRunner

Attributes

dry_run[R]
hexagon[R]
name[R]

Public Class Methods

new(hexagon, name, dry_run = false) click to toggle source
# File lib/command_runner.rb, line 3
def initialize(hexagon, name, dry_run = false)
  @hexagon = hexagon
  @dry_run = dry_run
  @name    = name
end

Public Instance Methods

call(command) click to toggle source
# File lib/command_runner.rb, line 9
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

Private Instance Methods

full_command(command) click to toggle source
# File lib/command_runner.rb, line 22
def full_command(command)
  (['hecks'] + command).join(' ')
end