Class: Berkshelf::API::CacheBuilder::Worker::FileStore
- Includes:
- Logging
- Defined in:
- lib/berkshelf/api/cache_builder/worker/file_store.rb
Instance Attribute Summary collapse
- #path ⇒ String readonly
Attributes inherited from Base
Instance Method Summary collapse
-
#cookbooks ⇒ Array<RemoteCookbook>
The list of cookbooks this builder can find.
-
#initialize(options = {}) ⇒ FileStore
constructor
A new instance of FileStore.
- #metadata(remote) ⇒ Ridley::Chef::Cookbook::Metadata
- #to_s ⇒ String
Methods included from Logging
Methods inherited from Base
Methods included from Mixin::Services
Constructor Details
#initialize(options = {}) ⇒ FileStore
Returns a new instance of FileStore.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/berkshelf/api/cache_builder/worker/file_store.rb', line 14 def initialize( = {}) @path = Pathname([:path]) log.warn "You have configured a FileStore endpoint to index the contents of #{@path}." log.warn "Using unfinalized artifacts, which this path may contain, to satisfiy your" log.warn "dependencies is *STRONGLY FROWNED UPON* and potentially *DANGEROUS*." log.warn "" log.warn "Please consider setting up a release process for the cookbooks you wish to retrieve from this" log.warn "filepath where the cookbook is uploaded into a Hosted Chef organization, an internal" log.warn "Chef Server, or the community site, and then replace this endpoint with a chef_server endpoint." super() end |
Instance Attribute Details
#path ⇒ String (readonly)
10 11 12 |
# File 'lib/berkshelf/api/cache_builder/worker/file_store.rb', line 10 def path @path end |
Instance Method Details
#cookbooks ⇒ Array<RemoteCookbook>
Returns The list of cookbooks this builder can find.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/berkshelf/api/cache_builder/worker/file_store.rb', line 33 def cookbooks [].tap do |cookbook_versions| @path.each_child do |dir| next unless dir.cookbook? begin cookbook = Ridley::Chef::Cookbook.from_path(dir) cookbook_versions << RemoteCookbook.new(cookbook.cookbook_name, cookbook.version, self.class.worker_type, cookbook.path, priority) rescue => ex log.debug ex. end end end end |
#metadata(remote) ⇒ Ridley::Chef::Cookbook::Metadata
51 52 53 |
# File 'lib/berkshelf/api/cache_builder/worker/file_store.rb', line 51 def (remote) (remote.location_path) end |
#to_s ⇒ String
27 28 29 |
# File 'lib/berkshelf/api/cache_builder/worker/file_store.rb', line 27 def to_s friendly_name(path) end |