Sha256: 107dbde79d9f9c5249ad3a163d55cc1af2fe9efbdc0ff3657fccaed72c9e1867

Contents?: true

Size: 1.19 KB

Versions: 7

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| load 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

7 entries across 7 versions & 2 rubygems

Version Path
auser-poolparty-0.2.2 lib/poolparty/pool/pool.rb
auser-poolparty-0.2.3 lib/poolparty/pool/pool.rb
auser-poolparty-0.2.4 lib/poolparty/pool/pool.rb
auser-poolparty-0.2.5 lib/poolparty/pool/pool.rb
auser-poolparty-0.2.6 lib/poolparty/pool/pool.rb
auser-poolparty-0.2.8 lib/poolparty/pool/pool.rb
poolparty-0.2.6 lib/poolparty/pool/pool.rb