Class: DeploYML::LocalShell

Inherits:
Shell
  • Object
show all
Defined in:
lib/deployml/local_shell.rb

Overview

Represents a shell running on the local system.

Instance Attribute Summary

Attributes inherited from Shell

#uri

Instance Method Summary collapse

Methods inherited from Shell

#initialize, #rake, #rake_task, #ruby, #shellescape, #status

Constructor Details

This class inherits a constructor from DeploYML::Shell

Instance Method Details

#cd(path) { ... } ⇒ Object

Changes the current working directory.

Parameters:

  • path (String)

    The path of the new current working directory to use.

Yields:

  • [] If a block is given, then the directory will be changed back after the block has returned.



57
58
59
# File 'lib/deployml/local_shell.rb', line 57

def cd(path,&block)
  Dir.chdir(path,&block)
end

#echo(message) ⇒ Object

Prints out a message.

Parameters:

  • message (String)

    The message to print.



43
44
45
# File 'lib/deployml/local_shell.rb', line 43

def echo(message)
  puts message
end

#exec(command) ⇒ Object

Executes a command.

Parameters:

  • command (String)

    The command to be executed.

Since:

  • 0.5.2



33
34
35
# File 'lib/deployml/local_shell.rb', line 33

def exec(command)
  system(command)
end

#run(program, *arguments) ⇒ Object

Runs a program locally.

Parameters:

  • program (String)

    The name or path of the program to run.

  • arguments (Array<String>)

    Additional arguments for the program.



18
19
20
21
22
23
# File 'lib/deployml/local_shell.rb', line 18

def run(program,*arguments)
  program = program.to_s
  arguments = arguments.map { |arg| arg.to_s }

  system(program,*arguments)
end