Sha256: 54948d9cf4c3f463a1d83770c0829ba4e3141b5bfc7db1f622714eecfb34a66f

Contents?: true

Size: 848 Bytes

Versions: 16

Compression:

Stored size: 848 Bytes

Contents

module Mccloud
  module Command
    class ForwardCommand < Base

      register "forward [NAME]", "Forwards ports from a machine to localhost"
      argument :selection, :type => :string, :optional => true, :default => nil

      def execute
        env.load!
        threads=Array.new
        env.config.providers.each do |name,provider|
          env.logger.debug("Asking provider #{name} to forward ports from #{selection} to localhost")
          trap("INT") { puts "You've hit CTRL-C . Stopping server now"; exit }
          provider.on_selected_components("vm",selection) do |id,vm|
            fwds=vm.forward(options)
            unless fwds.nil?
              fwds.each do |f|
                threads << f
              end
            end
            threads.each { |thr| thr.join}
          end

        end

      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mccloud-0.1.1 lib/mccloud/command/forward.rb
mccloud-0.0.28 lib/mccloud/command/forward.rb
mccloud-0.0.27 lib/mccloud/command/forward.rb
mccloud-0.0.26 lib/mccloud/command/forward.rb
mccloud-0.0.25 lib/mccloud/command/forward.rb
mccloud-0.0.24 lib/mccloud/command/forward.rb
mccloud-0.0.23 lib/mccloud/command/forward.rb
mccloud-0.0.22 lib/mccloud/command/forward.rb
mccloud-0.0.21 lib/mccloud/command/forward.rb
mccloud-0.0.20 lib/mccloud/command/forward.rb
mccloud-0.0.19 lib/mccloud/command/forward.rb
mccloud-0.0.18 lib/mccloud/command/forward.rb
mccloud-0.0.17 lib/mccloud/command/forward.rb
mccloud-0.0.16 lib/mccloud/command/forward.rb
mccloud-0.0.15 lib/mccloud/command/forward.rb
mccloud-0.0.14 lib/mccloud/command/forward.rb