Module: Berkshelf
- Extended by:
- Mixin::Logging
- Defined in:
- lib/berkshelf.rb,
lib/berkshelf/ui.rb,
lib/berkshelf/cli.rb,
lib/berkshelf/git.rb,
lib/berkshelf/chef.rb,
lib/berkshelf/test.rb,
lib/berkshelf/mixin.rb,
lib/berkshelf/config.rb,
lib/berkshelf/errors.rb,
lib/berkshelf/logger.rb,
lib/berkshelf/command.rb,
lib/berkshelf/version.rb,
lib/berkshelf/location.rb,
lib/berkshelf/lockfile.rb,
lib/berkshelf/resolver.rb,
lib/berkshelf/berksfile.rb,
lib/berkshelf/downloader.rb,
lib/berkshelf/formatters.rb,
lib/berkshelf/mixin/logging.rb,
lib/berkshelf/base_generator.rb,
lib/berkshelf/community_rest.rb,
lib/berkshelf/cookbook_store.rb,
lib/berkshelf/init_generator.rb,
lib/berkshelf/cached_cookbook.rb,
lib/berkshelf/cookbook_source.rb,
lib/berkshelf/formatters/json.rb,
lib/berkshelf/cookbook_generator.rb,
lib/berkshelf/locations/git_location.rb,
lib/berkshelf/locations/path_location.rb,
lib/berkshelf/locations/site_location.rb,
lib/berkshelf/formatters/human_readable.rb,
lib/berkshelf/locations/github_location.rb,
lib/berkshelf/locations/chef_api_location.rb
Defined Under Namespace
Modules: Chef, Command, Formatters, Location, Mixin, UI Classes: AbstractFunction, AmbiguousCookbookName, AmbiguousGitRef, ArgumentError, BaseGenerator, BerksConfigNotFound, Berksfile, BerksfileNotFound, BerksfileReadError, BerkshelfError, CachedCookbook, ChefAPILocation, Cli, ClientKeyFileNotFound, CommandUnsuccessful, CommunityREST, CommunitySiteError, Config, ConfigExists, ConfigurationError, ConstraintNotSatisfied, CookbookGenerator, CookbookNotFound, CookbookSource, CookbookStore, CookbookSyntaxError, CookbookValidationFailure, Downloader, DuplicateLocationDefined, DuplicateSourceDefined, ExplicitCookbookNotFound, FrozenCookbook, Git, GitError, GitLocation, GitNotFound, GithubLocation, InitGenerator, InsufficientPrivledges, InternalError, InvalidChefAPILocation, InvalidConfiguration, InvalidGitRef, InvalidGitURI, InvalidSiteShortnameError, InvalidVersionConstraint, Lockfile, Mocks, NoSolution, NoVersionForConstraints, PathLocation, PrivateGitRepo, Resolver, SiteLocation, UnknownGitHubProtocol, UploadFailure, ValidationFailed
Constant Summary collapse
- DEFAULT_FILENAME =
'Berksfile'.freeze
- Logger =
Celluloid::Logger
- VERSION =
"1.4.3"
Class Attribute Summary collapse
Class Method Summary collapse
-
.berkshelf_path ⇒ String
Returns the filepath to the location Berskhelf will use for storage; temp files will go here, Cookbooks will be downloaded to or uploaded from here.
- .cookbooks_dir ⇒ Object
-
.find_metadata(path = Dir.pwd) ⇒ Pathname
Ascend the directory structure from the given path to find a metadata.rb file of a Chef Cookbook.
-
.formatter ⇒ ~Formatter
Get the appropriate Formatter object based on the formatter classes that have been registered.
- .logger ⇒ Logger
-
.mktmpdir ⇒ String
Creates a temporary directory within the Berkshelf path.
- .root ⇒ Pathname
-
.set_format(format_id) ⇒ ~Formatter
Specify the format for output.
- .tmp_dir ⇒ String
Methods included from Mixin::Logging
Class Attribute Details
.cookbook_store ⇒ Berkshelf::CookbookStore
99 100 101 |
# File 'lib/berkshelf.rb', line 99 def cookbook_store @cookbook_store ||= CookbookStore.new(cookbooks_dir) end |
Class Method Details
.berkshelf_path ⇒ String
Returns the filepath to the location Berskhelf will use for storage; temp files will go here, Cookbooks will be downloaded to or uploaded from here. By default this is ‘~/.berkshelf’ but can be overridden by specifying a value for the ENV variable ‘BERKSHELF_PATH’.
71 72 73 |
# File 'lib/berkshelf.rb', line 71 def berkshelf_path ENV["BERKSHELF_PATH"] || File.("~/.berkshelf") end |
.cookbooks_dir ⇒ Object
94 95 96 |
# File 'lib/berkshelf.rb', line 94 def cookbooks_dir File.join(berkshelf_path, "cookbooks") end |
.find_metadata(path = Dir.pwd) ⇒ Pathname
Ascend the directory structure from the given path to find a metadata.rb file of a Chef Cookbook. If no metadata.rb file was found, nil is returned.
109 110 111 112 113 114 115 116 |
# File 'lib/berkshelf.rb', line 109 def (path = Dir.pwd) path = Pathname.new(path) path.ascend do |potential_root| if potential_root.entries.collect(&:to_s).include?('metadata.rb') return potential_root.join('metadata.rb') end end end |
.formatter ⇒ ~Formatter
Get the appropriate Formatter object based on the formatter classes that have been registered.
122 123 124 |
# File 'lib/berkshelf.rb', line 122 def formatter @formatter ||= Formatters::HumanReadable.new end |
.mktmpdir ⇒ String
Creates a temporary directory within the Berkshelf path
89 90 91 92 |
# File 'lib/berkshelf.rb', line 89 def mktmpdir FileUtils.mkdir_p(tmp_dir) Dir.mktmpdir(nil, tmp_dir) end |
.root ⇒ Pathname
55 56 57 |
# File 'lib/berkshelf.rb', line 55 def root @root ||= Pathname.new(File.('../', File.dirname(__FILE__))) end |
.set_format(format_id) ⇒ ~Formatter
Specify the format for output
134 135 136 |
# File 'lib/berkshelf.rb', line 134 def set_format(format_id) @formatter = Formatters[format_id].new end |