Take a look at the gist below for the code in question. Essentially it is taking a hash of packages with name and version key/value pairs, then iterating over them to populate the chef_gem resource.
We just discovered that this code is being run twice when executing chef-client on the node. After a bit of digging in the anatomy of a chef run wiki page, we discovered the following snippet that explained why this is happening.
http://wiki.opscode.com/display/chef/Anatomy+of+a+Chef+Run
Here:
Load Recipes >