Sha256: cc798a3eaf98ff4febed9cf68a03f9336a1665e720b96973290c7c325418592d

Contents?: true

Size: 770 Bytes

Versions: 3

Compression:

Stored size: 770 Bytes

Contents

module Shell
  private
  def run(command)
    puts "--> #{command}"
    if (!system(command))
      raise "error running command: #{command}"
    end
  end
  
  def run_command(full_command)
    if (@command_runner)
      @command_runner.call(full_command)
    else
      run(full_command)
    end
  end

  def check_directory(path)
    raise "#{path} is not a directory" unless File.directory? path    
    return path
  end
  
  def get_environment(name)
    value = ENV[name]
    raise "#{name} is not set" unless value
    return value
  end
  
  def get_environment_or_default(name, default_value='')
    value = ENV[name]
    value = default_value if not value
    return value
  end

end

class SystemCommandRunner
    
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
BuildMaster-0.7.0 lib/buildmaster/shell_command.rb
BuildMaster-0.8.0 lib/buildmaster/shell_command.rb
BuildMaster-0.8.1 lib/buildmaster/shell_command.rb