Sha256: 5cbb265167976f548f23b2a33a7a34b4d4de4c5061cf947679717c2a43949d0b

Contents?: true

Size: 1.24 KB

Versions: 18

Compression:

Stored size: 1.24 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, :file_exists?, :install_package, :install_packages, :install_gem, :update_cron,
               :with_context, :exec, :sudo, :su_exec, :in_dir, :in_temp_dir, :as_user, :with_prefix, :remote_command,
               :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

18 entries across 18 versions & 1 rubygems

Version Path
standup-0.6.9 lib/standup/scripts/node.rb
standup-0.6.8 lib/standup/scripts/node.rb
standup-0.6.7 lib/standup/scripts/node.rb
standup-0.6.6 lib/standup/scripts/node.rb
standup-0.6.5 lib/standup/scripts/node.rb
standup-0.6.4 lib/standup/scripts/node.rb
standup-0.6.3 lib/standup/scripts/node.rb
standup-0.6.2 lib/standup/scripts/node.rb
standup-0.6.1 lib/standup/scripts/node.rb
standup-0.6.0 lib/standup/scripts/node.rb
standup-0.5.14 lib/standup/scripts/node.rb
standup-0.5.13 lib/standup/scripts/node.rb
standup-0.5.11 lib/standup/scripts/node.rb
standup-0.5.10 lib/standup/scripts/node.rb
standup-0.5.9 lib/standup/scripts/node.rb
standup-0.5.8 lib/standup/scripts/node.rb
standup-0.5.7 lib/standup/scripts/node.rb
standup-0.5.6 lib/standup/scripts/node.rb