Sha256: d825e7ccee7e0ce7dd65112326d24b430c40598e57caa75a8fa53b30bc242447

Contents?: true

Size: 1.58 KB

Versions: 7

Compression:

Stored size: 1.58 KB

Contents

require 'active_support/all'
require 'settingslogic'
require 'AWS'
require 'aws/s3'
require 'net/ssh'
require 'highline'

require 'standup/core_ext'
require 'standup/settings'
require 'standup/ec2'
require 'standup/remoting'
require 'standup/scripts/base'
require 'standup/scripts/node'
require 'standup/node'

module Standup
  module Scripts; end
  
  def self.nodes
    Settings.nodes.keys.map{|name| Node.new name}
  end
  
  def self.gem_scripts_path
    File.expand_path('../../scripts',  __FILE__)
  end
  
  def self.local_scripts_path
    File.expand_path('config/standup') rescue nil
  end
  
  def self.scripts
    unless class_variable_defined? :@@scripts
      @@scripts = {}
      loaded = Set.new
      [local_scripts_path, gem_scripts_path].each do |dir|
        Dir.foreach dir do |name|
          next unless File.file? "#{dir}/#{name}"
          next unless name =~ /\.rb$/
          next if loaded.include? name
          load "#{dir}/#{name}", true
          loaded << name
        end if dir && File.exists?(dir)
      end
    end
    @@scripts
  end
  
  def self.script type = :node, &block
    name = block.__file__.match(/([^\/]*)\.rb$/)[1]
    superclass = case type
      when :node
        Scripts::Node
      when :local
        Scripts::Base
      else
        raise ArgumentError, "Unknown script type #{type}"
    end
    script_class = Class.new(superclass, &block)
    script_class.name = name
    Standup::Scripts.const_set name.camelize, script_class
    scripts[name] = script_class
  end
  
  def self.version
    File.read(File.expand_path('../../VERSION',  __FILE__)).strip
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
standup-0.3.11 lib/standup.rb
standup-0.3.10 lib/standup.rb
standup-0.3.9 lib/standup.rb
standup-0.3.8 lib/standup.rb
standup-0.3.7 lib/standup.rb
standup-0.3.6 lib/standup.rb
standup-0.3.5 lib/standup.rb