Class: Berkshelf::CachedCookbook
- Inherits:
-
Ridley::Chef::Cookbook
- Object
- Ridley::Chef::Cookbook
- Berkshelf::CachedCookbook
- Defined in:
- lib/berkshelf/cached_cookbook.rb
Overview
Constant Summary collapse
- DIRNAME_REGEXP =
/^(.+)-(.+)$/
Class Method Summary collapse
-
.from_store_path(path) ⇒ CachedCookbook
An instance of CachedCookbook initialized by the contents found at the given path.
Instance Method Summary collapse
Class Method Details
.from_store_path(path) ⇒ CachedCookbook
Returns an instance of CachedCookbook initialized by the contents found at the given path.
11 12 13 14 15 16 17 |
# File 'lib/berkshelf/cached_cookbook.rb', line 11 def from_store_path(path) path = Pathname.new(path) cached_name = File.basename(path.to_s).slice(DIRNAME_REGEXP, 1) return nil if cached_name.nil? from_path(path, name: cached_name) end |
Instance Method Details
#dependencies ⇒ Hash
23 24 25 |
# File 'lib/berkshelf/cached_cookbook.rb', line 23 def dependencies .recommendations.merge(.dependencies) end |
#pretty_print ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/berkshelf/cached_cookbook.rb', line 27 def pretty_print [].tap do |a| a.push " Name: #{cookbook_name}" unless name.blank? a.push " Version: #{version}" unless version.blank? a.push " Description: #{.description}" unless .description.blank? a.push " Author: #{.maintainer}" unless .maintainer.blank? a.push " Email: #{.maintainer_email}" unless .maintainer_email.blank? a.push " License: #{.license}" unless .license.blank? a.push " Platforms: #{pretty_map(.platforms, 14)}" unless .platforms.blank? a.push "Dependencies: #{pretty_map(dependencies, 14)}" unless dependencies.blank? end.join("\n") end |