# class Chef::RunList::VersionedRecipeList

### Public Class Methods

new() click to toggle source
Calls superclass method

    # File lib/chef/run_list/versioned_recipe_list.rb, line 27
    def initialize
      super
      @versions = Hash.new
    end

### Public Instance Methods

add_recipe(name, version=nil) click to toggle source

    # File lib/chef/run_list/versioned_recipe_list.rb, line 32
    def add_recipe(name, version=nil)
      if version && @versions.has_key?(name)
        unless Chef::Version.new(@versions[name]) == Chef::Version.new(version)
          raise Chef::Exceptions::CookbookVersionConflict, "Run list requires #{name} at versions #{@versions[name]} and #{version}"
        end
      end
      @versions[name] = version if version
      self << name unless self.include?(name)
    end

with_version_constraints() click to toggle source

Return an Array of Hashes, each of the form:

    {:name => RECIPE_NAME, :version_constraint => Chef::VersionConstraint }

    # File lib/chef/run_list/versioned_recipe_list.rb, line 48
    def with_version_constraints
      self.map do |recipe_name|
        constraint = Chef::VersionConstraint.new(@versions[recipe_name])
        { :name => recipe_name, :version_constraint => constraint }
      end
    end

with_version_constraints_strings() click to toggle source

Return an Array of Strings, each of the form:

    "NAME@VERSION"

    # File lib/chef/run_list/versioned_recipe_list.rb, line 57
    def with_version_constraints_strings
      self.map do |recipe_name|
        if @versions[recipe_name]
          "#{recipe_name}@#{@versions[recipe_name]}"
        else
          recipe_name
        end
      end
    end

with_versions() click to toggle source

    # File lib/chef/run_list/versioned_recipe_list.rb, line 42
    def with_versions
      self.map {|recipe_name| {:name => recipe_name, :version => @versions[recipe_name]}}
    end