Sha256: 8b51207b6a400163e5388803e164cc3aa873c2f082d10df0d52c2440749f9064

Contents?: true

Size: 1.17 KB

Versions: 29

Compression:

Stored size: 1.17 KB

Contents

module Standup
  module Scripts
    class Node < Base
      def initialize node
        super
        merge_params node.params[name]
        @node = node
        @remoting = nil
      end
      
      delegate :instance, :open_port, :open_ports, :remoting, :scripts,
               :to => :@node
    
      delegate :download, :upload, :remote_update, :exec, :sudo, :su_exec, :in_dir, :in_temp_dir, :file_exists?, :install_package, :install_packages, :install_gem, :update_cron,
               :to => :remoting
    
      attr_accessor :node
      
      def put_title
        bright_p "#{@node.name}:#{name}", HighLine::CYAN
      end
      
      def self.execute
        all_nodes = Settings.nodes.keys
        
        nodes = if all_nodes.length > 1
          node_args = argument('<node[,node]>', 'node', ['all'] + all_nodes).strip.split(',')
          
          if node_args.include? 'all'
            all_nodes
          else
            node_args
          end
        else
          all_nodes
        end
        
        run_on_nodes nodes
      end
      
      def self.run_on_nodes nodes
        nodes.each {|node| Standup::Node.new(node).run_script name}
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
standup-0.4.0 lib/standup/scripts/node.rb
standup-0.3.37 lib/standup/scripts/node.rb
standup-0.3.36 lib/standup/scripts/node.rb
standup-0.3.35 lib/standup/scripts/node.rb
standup-0.3.34 lib/standup/scripts/node.rb
standup-0.3.33 lib/standup/scripts/node.rb
standup-0.3.32 lib/standup/scripts/node.rb
standup-0.3.31 lib/standup/scripts/node.rb
standup-0.3.30 lib/standup/scripts/node.rb
standup-0.3.29 lib/standup/scripts/node.rb
standup-0.3.28 lib/standup/scripts/node.rb
standup-0.3.27 lib/standup/scripts/node.rb
standup-0.3.26 lib/standup/scripts/node.rb
standup-0.3.25 lib/standup/scripts/node.rb
standup-0.3.24 lib/standup/scripts/node.rb
standup-0.3.23 lib/standup/scripts/node.rb
standup-0.3.22 lib/standup/scripts/node.rb
standup-0.3.20 lib/standup/scripts/node.rb
standup-0.3.19 lib/standup/scripts/node.rb
standup-0.3.18 lib/standup/scripts/node.rb