Sha256: 0a5a6e9b1836c933193da5ca77cf3ddebd29252b7ef3167e1e1e2438ea4ed3af

Contents?: true

Size: 1.35 KB

Versions: 5

Compression:

Stored size: 1.35 KB

Contents

module Ridley
  # @author Jamie Winsor <jamie@vialstudios.com>
  class Environment
    include Ridley::Resource
    
    class << self
      # Delete all of the environments on the remote connection. The
      # '_default' environment will never be deleted.
      #
      # @param [Ridley::Connection] connection
      #
      # @return [Array<Ridley::Environment>]
      def delete_all(connection)
        envs = all(connection).reject { |env| env.name.to_s == '_default' }
        envs.collect { |obj| delete(connection, obj) }
      end
    end

    set_chef_id "name"
    set_chef_type "environment"
    set_chef_json_class "Chef::Environment"
    set_resource_path "environments"

    attribute :name
    validates_presence_of :name

    attribute :description, default: String.new
    attribute :default_attributes, default: Hash.new
    attribute :override_attributes, default: Hash.new
    attribute :cookbook_versions, default: Hash.new
  end

  module DSL
    # Coerces instance functions into class functions on Ridley::Environment. This coercion
    # sends an instance of the including class along to the class function.
    #
    # @see Ridley::Context
    #
    # @return [Ridley::Context]
    #   a context object to delegate instance functions to class functions on Ridley::Environment
    def environment
      Context.new(Ridley::Environment, self)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ridley-0.0.5 lib/ridley/resources/environment.rb
ridley-0.0.4 lib/ridley/resources/environment.rb
ridley-0.0.3 lib/ridley/resources/environment.rb
ridley-0.0.2 lib/ridley/resources/environment.rb
ridley-0.0.1 lib/ridley/resources/environment.rb