Sha256: d9683195dabe7083c7740d06c66e829817550f3e9f8f51920fe399a94f9af200

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

module PoolParty
  module Pool
    
    def pool(name=:app, &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 = @describe_instances = 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)
        setup_defaults
        
        @name = name
        instance_eval &block if block
      end
      
      def setup_defaults
        plugin_directory "#{::Dir.pwd}/plugins" 
      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

2 entries across 2 versions & 1 rubygems

Version Path
auser-poolparty-0.2.59 lib/poolparty/pool/pool.rb
auser-poolparty-0.2.60 lib/poolparty/pool/pool.rb