class TiyoHw::Runners::Base

Attributes

commands[R]
pwd[R]

Public Class Methods

get_commands(pwd) click to toggle source
# File lib/tiyo_hw/runners/base.rb, line 32
def self.get_commands(pwd)
  self.new(pwd).commands
end
new(pwd) click to toggle source
# File lib/tiyo_hw/runners/base.rb, line 6
def initialize(pwd)
  @commands = []
  @pwd = pwd
  prepare_commands
end

Public Instance Methods

add_command(cmd) click to toggle source
# File lib/tiyo_hw/runners/base.rb, line 12
def add_command(cmd)
  @commands << cmd
end
file?(*args) click to toggle source
# File lib/tiyo_hw/runners/base.rb, line 20
def file?(*args)
  File.exist?(file_path(*args))
end
file_contents?(regex, *args) click to toggle source
# File lib/tiyo_hw/runners/base.rb, line 24
def file_contents?(regex, *args)
  !File.readlines(file_path(*args)).grep(regex).empty?
end
file_path(*args) click to toggle source
# File lib/tiyo_hw/runners/base.rb, line 16
def file_path(*args)
  File.expand_path(File.join(pwd, *args))
end
prepare_commands() click to toggle source
# File lib/tiyo_hw/runners/base.rb, line 28
def prepare_commands
  raise NotImplementedError, "Subclases of Tiyo::Runners::Base must implement prepare_commands"
end