Module: Inprovise::CmdChannel
- Defined in:
- lib/inprovise/cmd_channel.rb
Overview
Command channel for Inprovise
- Author
-
Martin Corino
- License
-
Distributes under the same license as Ruby
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Class Method Summary collapse
- .default_implementation ⇒ Object
- .default_implementation=(impl) ⇒ Object
- .define(impl, base = ::Object, &definition) ⇒ Object
- .implementations ⇒ Object
- .open(node, impl) ⇒ Object
Instance Method Summary collapse
-
#close ⇒ Object
session management.
- #download(from, to) ⇒ Object
- #initialize(node) ⇒ Object
-
#run(command, forcelog = false) ⇒ Object
command execution (MANDATORY).
-
#upload(from, to) ⇒ Object
MANDATORY file management routines.
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
37 38 39 |
# File 'lib/inprovise/cmd_channel.rb', line 37 def node @node end |
Class Method Details
.default_implementation ⇒ Object
14 15 16 |
# File 'lib/inprovise/cmd_channel.rb', line 14 def default_implementation @default ||= 'ssh' end |
.default_implementation=(impl) ⇒ Object
18 19 20 |
# File 'lib/inprovise/cmd_channel.rb', line 18 def default_implementation=(impl) @default = impl end |
.define(impl, base = ::Object, &definition) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/inprovise/cmd_channel.rb', line 22 def define(impl, base=::Object, &definition) implklass = Class.new(base) do include Inprovise::CmdChannel end implklass.class_eval(&definition) implementations[impl.to_s] = implklass implklass end |
.implementations ⇒ Object
10 11 12 |
# File 'lib/inprovise/cmd_channel.rb', line 10 def implementations @implementations ||= {} end |
.open(node, impl) ⇒ Object
31 32 33 |
# File 'lib/inprovise/cmd_channel.rb', line 31 def open(node, impl) implementations[impl || default_implementation].new(node) end |
Instance Method Details
#close ⇒ Object
session management
45 46 47 |
# File 'lib/inprovise/cmd_channel.rb', line 45 def close # noop end |
#download(from, to) ⇒ Object
61 62 63 |
# File 'lib/inprovise/cmd_channel.rb', line 61 def download(from, to) raise RuntimeError, 'UNIMPLEMENTED' end |
#initialize(node) ⇒ Object
39 40 41 |
# File 'lib/inprovise/cmd_channel.rb', line 39 def initialize(node) @node = node end |
#run(command, forcelog = false) ⇒ Object
command execution (MANDATORY)
51 52 53 |
# File 'lib/inprovise/cmd_channel.rb', line 51 def run(command, forcelog=false) raise RuntimeError, 'UNIMPLEMENTED' end |
#upload(from, to) ⇒ Object
MANDATORY file management routines
57 58 59 |
# File 'lib/inprovise/cmd_channel.rb', line 57 def upload(from, to) raise RuntimeError, 'UNIMPLEMENTED' end |