Sha256: a791274db9e0e5d1618f341d8a674b3b97b1be089580ce6c97c0c3f6960b74e0

Contents?: true

Size: 997 Bytes

Versions: 2

Compression:

Stored size: 997 Bytes

Contents

require 'deployml/shell'

module DeploYML
  #
  # Represents a shell running on the local system.
  #
  class LocalShell

    include Shell

    #
    # Runs a program locally.
    #
    # @param [String] program
    #   The name or path of the program to run.
    #
    # @param [Array<String>] args
    #   Additional arguments for the program.
    #
    def run(program,*args)
      program = program.to_s
      args = args.map { |arg| arg.to_s }

      system(program,*args)
    end

    #
    # Prints out a message.
    #
    # @param [String] message
    #   The message to print.
    #
    def echo(message)
      puts message
    end

    #
    # Changes the current working directory.
    #
    # @param [String] path
    #   The path of the new current working directory to use.
    #
    # @yield []
    #   If a block is given, then the directory will be changed back after
    #   the block has returned.
    #
    def cd(path,&block)
      Dir.chdir(path,&block)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
deployml-0.4.2 lib/deployml/local_shell.rb
deployml-0.4.1 lib/deployml/local_shell.rb