Sha256: beaf87f1b7bbd5386100325e30ca0aa0f53e6c8f3175859b3df8a510f15a0d25

Contents?: true

Size: 1.58 KB

Versions: 3

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 = {}
      [gem_scripts_path, local_scripts_path].each do |dir|
        Dir.foreach dir do |name|
          next unless File.file? "#{dir}/#{name}"
          next unless name =~ /\.rb$/
          load "#{dir}/#{name}", true
        end if dir && File.exists?(dir)
      end
    end
    @@scripts
  end

  def self.script type = :node, &block
    name = block.__file__.match(/([^\/]*)\.rb$/)[1]
    superclass = scripts[name] || 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.send(:remove_const, name.camelize) if scripts[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

3 entries across 3 versions & 1 rubygems

Version Path
standup-0.3.14 lib/standup.rb
standup-0.3.13 lib/standup.rb
standup-0.3.12 lib/standup.rb