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
- #uri ⇒ Object
Constructor Details
#initialize(options) ⇒ Connection
Returns a new instance of Connection.
23 24 25 26 27 |
# File 'lib/train/transports/local.rb', line 23 def initialize() super() @cmd_wrapper = nil @cmd_wrapper = CommandWrapper.load(self, ) end |
Instance Method Details
#file(path) ⇒ Object
42 43 44 |
# File 'lib/train/transports/local.rb', line 42 def file(path) @files[path] ||= File.new(self, path) end |
#login_command ⇒ Object
46 47 48 |
# File 'lib/train/transports/local.rb', line 46 def login_command nil # none, open your shell end |
#os ⇒ Object
38 39 40 |
# File 'lib/train/transports/local.rb', line 38 def os @os ||= OS.new(self) end |
#run_command(cmd) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/train/transports/local.rb', line 29 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 |
#uri ⇒ Object
50 51 52 |
# File 'lib/train/transports/local.rb', line 50 def uri 'local://' end |