Sha256: 78d0a05bcc7840afab43200c23680231d52f527d209754e2f602e9bc3678a17a

Contents?: true

Size: 1.19 KB

Versions: 11

Compression:

Stored size: 1.19 KB

Contents

module PoolParty
  module Pool
    
    def pool(name=:main, &block)
      pools.has_key?(name) ? pools[name] : (pools[name] = Pool.new(name, &block))
    end    
    
    def pools
      $pools ||= {}
    end
    
    def with_pool(pool, opts={}, &block)
      pool.options.merge!(opts)
      pool.instance_eval &block if block
    end
        
    def reset!
      $pools = $clouds = $plugins = nil
    end

    class Pool
      attr_accessor :name
      include PoolParty::Cloud
      include MethodMissingSugar
      # include PluginModel
      include Configurable
      include PrettyPrinter
      include CloudResourcer
      include Remote
      
      default_options({
        :access_key => Base.access_key,
        :secret_access_key => Base.secret_access_key
      })
      
      def initialize(name,&block)
        @name = name
        instance_eval &block if block
      end
      
      def plugin_directory(*args)
        args.each {|arg| Dir["#{arg}/*/*.rb"].each {|f| require f }}
      end
            
      # This is where the entire process starts
      def inflate
      end
    end
    
    # Helpers
    def remove_pool(name)
      pools.delete(name) if pools.has_key?(name)
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
auser-poolparty-0.2.15 lib/poolparty/pool/pool.rb
auser-poolparty-0.2.16 lib/poolparty/pool/pool.rb
auser-poolparty-0.2.20 lib/poolparty/pool/pool.rb
auser-poolparty-0.2.21 lib/poolparty/pool/pool.rb
auser-poolparty-0.2.22 lib/poolparty/pool/pool.rb
auser-poolparty-0.2.23 lib/poolparty/pool/pool.rb
auser-poolparty-0.2.24 lib/poolparty/pool/pool.rb
auser-poolparty-0.2.25 lib/poolparty/pool/pool.rb
auser-poolparty-0.2.26 lib/poolparty/pool/pool.rb
auser-poolparty-0.2.9 lib/poolparty/pool/pool.rb
poolparty-0.2.18 lib/poolparty/pool/pool.rb