Method: Chef::Cookbook::Metadata#depends
- Defined in:
- lib/chef/cookbook/metadata.rb
#depends(cookbook, *version_args) ⇒ Object
Adds a dependency on another cookbook, with version checking strings.
Parameters
- cookbook<String>
-
The cookbook
- version<String>
-
A version constraint of the form “OP VERSION”,
where OP is one of < <= = > >= ~> and VERSION has the form x.y.z or x.y.
Returns
- versions<Array>
-
Returns the list of versions for the platform
284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/chef/cookbook/metadata.rb', line 284 def depends(cookbook, *version_args) if cookbook == name raise "Cookbook depends on itself in cookbook #{name}, please remove the this unnecessary self-dependency" else version = new_args_format(:depends, cookbook, version_args) constraint = validate_version_constraint(:depends, cookbook, version) @dependencies[cookbook] = constraint.to_s end @dependencies[cookbook] end |