Sha256: 5ec6aad721353a4818fbe0d38365417e02e3e6744b5eba24ef9c2704ddccf949

Contents?: true

Size: 1.63 KB

Versions: 8

Compression:

Stored size: 1.63 KB

Contents

#
# Author:: Adam Jacob (<adam@opscode.com>)
# Copyright:: Copyright (c) 2008, 2009 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require 'chef/log'

class Chef
  module Mixin
    module LanguageIncludeRecipe

      def include_recipe(*args)
        args.flatten.each do |recipe|
          if @node.run_state[:seen_recipes].has_key?(recipe)
            Chef::Log.debug("I am not loading #{recipe}, because I have already seen it.")
            next
          end        

          Chef::Log.debug("Loading Recipe #{recipe} via include_recipe")
          @node.run_state[:seen_recipes][recipe] = true

          rmatch = recipe.match(/(.+?)::(.+)/)
          if rmatch
            cookbook = @cookbook_loader[rmatch[1]]
            cookbook.load_recipe(rmatch[2], @node, @collection, @definitions, @cookbook_loader)
          else
            cookbook = @cookbook_loader[recipe]
            cookbook.load_recipe("default", @node, @collection, @definitions, @cookbook_loader)
          end
        end
      end

      def require_recipe(*args)
        include_recipe(*args)
      end

    end
  end
end
      

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
chef-0.8.16 lib/chef/mixin/language_include_recipe.rb
chef-0.8.14 lib/chef/mixin/language_include_recipe.rb
chef-0.8.10 lib/chef/mixin/language_include_recipe.rb
chef-0.8.8 lib/chef/mixin/language_include_recipe.rb
chef-0.8.6 lib/chef/mixin/language_include_recipe.rb
chef-0.8.4 lib/chef/mixin/language_include_recipe.rb
chef-0.8.2 lib/chef/mixin/language_include_recipe.rb
runa-chef-0.8.0.1 lib/chef/mixin/language_include_recipe.rb