edelight/chef-mongodb — pull request #82 by vitalis (2013-01-22 18:47:57+00:00)
Title: extracts mongodb package and mongo gem install code into mongodb::base recipe and related changes

The story of this pull request starts with me using cookbook to define nodes run lists instead on run_list or role, it really makes things simpler for me.

So I created a cookbook that includes the following code:
```ruby
include_recipe "mongodb::10gen_repo"
include_recipe "mongodb"
```
I bootstrap a node with my cookbook and see that 10gen package wasn't installed.
After some digging I understood that the following line in `mongodb::default` recipe is causing
this issue:
```ruby
if node.recipe?("mongodb::default") or node.recipe?("mongodb")
```

I asked myself why this validation is required and the answer was cause of the following code in `mongodb::default` :
```ruby
package node[:mongodb][:package_name] do
action :install
end

needs_mongo_gem = (node.recipe?("mongodb::replicaset") or node.recipe?("mongodb::mongos"))

if needs_mongo_gem
# install the mongo ruby gem at compile time to make it globally available
gem_package 'mongo' do
action :nothing
end.run_action(:install)
Gem.clear_paths
end
```

So I moved this code to `mongodb::base` recipe and removed the validation,
and Ding! Everything works :)

I did a further digging and saw other code the validated cookbook inclusion and decided to refactor it a bit.
The result is this pull request, will be really glad it will be accepted, has many others on the way ;)