module Pave::Shell

Public Class Methods

included(base) click to toggle source
# File lib/pave/shell.rb, line 3
def Shell.included base
  base.extend Shell
end

Public Instance Methods

file_insert(insert_file, insert_pattern, insert_lines) click to toggle source
# File lib/pave/shell.rb, line 18
def file_insert(insert_file, insert_pattern, insert_lines)
  file_string = File.read(insert_file).sub(insert_pattern, "#{insert_pattern}\n#{insert_lines}")
  File.write(insert_file, file_string)
end
sh(cmd) click to toggle source
# File lib/pave/shell.rb, line 12
def sh(cmd)
  result = shell(cmd)
  puts result.output
  result.status
end
shell(command) click to toggle source
# File lib/pave/shell.rb, line 7
def shell(command)
  output = `#{command}`
  Struct.new(:status, :output).new($?, output)
end