Sha256: 829b8e26160adfe2bff6616beb82629f0745f77a5befca39930862345b2124be

Contents?: true

Size: 520 Bytes

Versions: 7

Compression:

Stored size: 520 Bytes

Contents

module Pave
  module Shell
    def Shell.included base
      base.extend Shell
    end

    def shell(command)
      output = `#{command}`
      Struct.new(:status, :output).new($?, output)
    end

    def sh(cmd)
      result = shell(cmd)
      puts result.output
      result.status
    end

    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
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pave-0.16.0 lib/pave/shell.rb
pave-0.15.0 lib/pave/shell.rb
pave-0.14.2 lib/pave/shell.rb
pave-0.14.1 lib/pave/shell.rb
pave-0.14.0 lib/pave/shell.rb
pave-0.13.0 lib/pave/shell.rb
pave-0.12.0 lib/pave/shell.rb