Class: GitGo::Connection::Local
- Defined in:
- lib/git_go/connection/local.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#bash(command) ⇒ Hash
Executes the provided COMMAND on the local machine.
-
#close ⇒ Object
Clears the ‘@connection` instance variable of this objects parent `Core` instance so new connections can be established.
-
#initialize(core) ⇒ GitGo::Connection::Local
constructor
Creates a new instance of GitGo::Connection::Local.
Methods inherited from Base
#cd, #close_and_exit, #directory?, #file?, #mkdir, #mv, #rm
Constructor Details
#initialize(core) ⇒ GitGo::Connection::Local
Creates a new instance of GitGo::Connection::Local.
11 12 13 |
# File 'lib/git_go/connection/local.rb', line 11 def initialize(core) super(core) end |
Instance Method Details
#bash(command) ⇒ Hash
Executes the provided COMMAND on the local machine. This is a blocking (non-asynchronous) operation.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/git_go/connection/local.rb', line 26 def bash(command) pid, _, stdout, stderr = Open4::popen4(%Q(#{source} cd "#{current_path}"; #{command})) _, status = Process::waitpid2(pid) { :stdout => stdout.read.strip, :stderr => stderr.read.strip, :exit_code => status.exitstatus } end |
#close ⇒ Object
Clears the ‘@connection` instance variable of this objects parent `Core` instance so new connections can be established.
17 18 19 |
# File 'lib/git_go/connection/local.rb', line 17 def close core.clear_connection end |