opscode/chef — pull request #1241 by danielsdeleo (2014-02-01 00:54:59+00:00)
Title: Expose resource creation via more static methods

Adds methods to the DSL to let you create resources directly by type without going through `method_missing`. There is also a method to create a resource without inserting it into the resource collection, which could be useful when reusing resources in providers (you get to use most of the DSL so the code looks more familiar).

This should allow for easier customization of resources by defining methods on the DSL that "hide" the normal resource creation method. For example:

```ruby
def file(name, &attrs_block)
r = declare_resource(:file, name, &attrs_block)
r.notifies :restart, "service[foo]"
r
end
```

The downside (as implemented now) is that the customization happens _after_ the recipe code is applied, so it would win in the case of conflict. Therefore more work is needed to allow the user to set defaults that a recipe might override (e.g., to set all files to a certain mode, but allow the recipe to overrule the default).