Class: Capistrano::Forwarding::Remote
- Inherits:
-
Object
- Object
- Capistrano::Forwarding::Remote
- Includes:
- Processable
- Defined in:
- lib/capistrano/forwarding/remote.rb
Defined Under Namespace
Classes: Forwarding
Instance Attribute Summary collapse
-
#forwardings ⇒ Object
readonly
Returns the value of attribute forwardings.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#sessions ⇒ Object
readonly
Returns the value of attribute sessions.
Class Method Summary collapse
Instance Method Summary collapse
- #forward! {|sessions| ... } ⇒ Object
-
#initialize(forwardings, sessions, options = {}) ⇒ Remote
constructor
A new instance of Remote.
Constructor Details
#initialize(forwardings, sessions, options = {}) ⇒ Remote
Returns a new instance of Remote.
62 63 64 65 66 67 68 69 70 |
# File 'lib/capistrano/forwarding/remote.rb', line 62 def initialize(forwardings, sessions, = {}) @forwardings = sessions.map do |session| forwardings.map do |forwarding| Forwarding.new(forwarding, session) end end.flatten @sessions = sessions = end |
Instance Attribute Details
#forwardings ⇒ Object (readonly)
Returns the value of attribute forwardings.
56 57 58 |
# File 'lib/capistrano/forwarding/remote.rb', line 56 def forwardings @forwardings end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
56 57 58 |
# File 'lib/capistrano/forwarding/remote.rb', line 56 def end |
#sessions ⇒ Object (readonly)
Returns the value of attribute sessions.
56 57 58 |
# File 'lib/capistrano/forwarding/remote.rb', line 56 def sessions @sessions end |
Class Method Details
.forward(forwardings, sessions, options = {}, &block) ⇒ Object
58 59 60 |
# File 'lib/capistrano/forwarding/remote.rb', line 58 def self.forward(forwardings, sessions, = {}, &block) new(forwardings, sessions, ).forward!(&block) end |
Instance Method Details
#forward! {|sessions| ... } ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/capistrano/forwarding/remote.rb', line 72 def forward! start([:timeout]) # If we use run or similar command in the block for the connections, # the forwardings are also processed by the loop of these commands. # See lib/capistrano/command.rb and lib/capistrano/processable.rb. yield(sessions) if block_given? # Since we may still have channels which are not completely processed by the # loop of these commands, run the loop for taking care of them until # all channels has been gone. loop unless [:no_wait] stop([:timeout]) end |