module Chef::Sugar::RecipeDSL

Public Instance Methods

compile_time(&block) click to toggle source

@deprecated The description is in the method body pretty accurately…

# File lib/chef/sugar/filters.rb, line 157
      def compile_time(&block)
        message = <<-EOH

The Chef Sugar recipe DSL method `compile_time' has been renamed to
`at_compile_time'! This is a breaking change that was released in a patch
version, so please continue reading to understand the necessary semantic
versioning violation.

Chef Software implemented a version of `compile_time' in Chef 12.1, breaking any 
cookbook that uses or depends on Chef Sugar on Chef 12.1:

    https://www.chef.io/blog/2015/03/03/chef-12-1-0-released

In order to progress Chef Sugar forward, the DSL method has been renamed to
avoid the namespace collision.

In short, you should change this:

    compile_time do
      # ...
    end

to this:

    at_compile_time do
      # ...
    end

EOH

        if Chef::Resource::ChefGem.instance_methods(false).include?(:compile_time)
          message << <<-EOH
You are running a version of Chef Client that includes the `compile_time'
attribute on core Chef resources (most likely Chef 12.1+). Instead of continuing
and having Chef provide you with an obscure error message, I am going to error
here. There is no way for the Chef Recipe to successfully continue unless you
change the Chef Sugar `compile_time' method to `at_compile_time' in your Chef
recipes.

You should NOT change resource-level `compile_time' attributes:

    package "foo" do
      compile_time true # Do NOT change these
    end

I truly apologize for the inconvienence and hope the reason for introducing this
breaking change is clear. I am sorry if it causes extra work, but I promise this
error message is much more informative than "wrong number of arguments".

If you have any questions, please feel free to open an issue on GitHub at:

    https://github.com/sethvargo/chef-sugar

Thank you, and have a great day!
EOH
          raise RuntimeError, message
        else
          message << <<-EOH
You are running a version of Chef Client that does not include the
`compile_time' attribute on core Chef resources (most likely less than
Chef 12.1), so this is just a warning. Please consider changing the Chef Sugar
`compile_time' method to `at_compile_time' in your Chef recipes. If you upgrade
Chef, your recipes WILL break.
EOH
          Chef::Log.warn(message)
          at_compile_time(&block)
        end
      end