class NewlineHw::Shell::Runners::Base
Attributes
commands[R]
pwd[R]
Public Class Methods
get_commands(pwd)
click to toggle source
# File lib/newline_hw/shell/runners/base.rb, line 34 def self.get_commands(pwd) new(pwd).commands end
new(pwd)
click to toggle source
# File lib/newline_hw/shell/runners/base.rb, line 7 def initialize(pwd) @commands = [] @pwd = pwd prepare_commands end
Public Instance Methods
add_command(cmd)
click to toggle source
# File lib/newline_hw/shell/runners/base.rb, line 13 def add_command(cmd) @commands << cmd end
file?(*args)
click to toggle source
# File lib/newline_hw/shell/runners/base.rb, line 21 def file?(*args) File.exist?(file_path(*args)) end
file_contents?(regex, *args)
click to toggle source
# File lib/newline_hw/shell/runners/base.rb, line 25 def file_contents?(regex, *args) return false unless file?(*args) !File.readlines(file_path(*args)).grep(regex).empty? end
file_path(*args)
click to toggle source
# File lib/newline_hw/shell/runners/base.rb, line 17 def file_path(*args) File.expand_path(File.join(pwd, *args)) end
prepare_commands()
click to toggle source
# File lib/newline_hw/shell/runners/base.rb, line 30 def prepare_commands raise NotImplementedError, "Subclases of Tiyo::Runners::Base must implement prepare_commands" end