Class: Train::Transports::Local::Connection
- Inherits:
-
BaseConnection
- Object
- BaseConnection
- Train::Transports::Local::Connection
- Defined in:
- lib/train/transports/local.rb,
lib/train/transports/local_file.rb
Defined Under Namespace
Classes: File
Instance Method Summary collapse
- #file(path) ⇒ Object
-
#initialize(options) ⇒ Connection
constructor
A new instance of Connection.
- #login_command ⇒ Object
- #os ⇒ Object
- #run_command(cmd) ⇒ Object
Constructor Details
#initialize(options) ⇒ Connection
Returns a new instance of Connection.
23 24 25 26 27 28 |
# File 'lib/train/transports/local.rb', line 23 def initialize() super() @files = {} @cmd_wrapper = nil @cmd_wrapper = CommandWrapper.load(self, ) end |
Instance Method Details
#file(path) ⇒ Object
43 44 45 |
# File 'lib/train/transports/local.rb', line 43 def file(path) @files[path] ||= File.new(self, path) end |
#login_command ⇒ Object
47 48 49 |
# File 'lib/train/transports/local.rb', line 47 def login_command nil # none, open your shell end |
#os ⇒ Object
39 40 41 |
# File 'lib/train/transports/local.rb', line 39 def os @os ||= OS.new(self) end |
#run_command(cmd) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/train/transports/local.rb', line 30 def run_command(cmd) cmd = @cmd_wrapper.run(cmd) unless @cmd_wrapper.nil? res = Mixlib::ShellOut.new(cmd) res.run_command CommandResult.new(res.stdout, res.stderr, res.exitstatus) rescue Errno::ENOENT => _ CommandResult.new('', '', 1) end |