Class: KnifeChangelog::Changelog::Berksfile
- Inherits:
-
KnifeChangelog::Changelog
- Object
- KnifeChangelog::Changelog
- KnifeChangelog::Changelog::Berksfile
- Defined in:
- lib/knife/changelog/berksfile.rb
Constant Summary
Constants inherited from KnifeChangelog::Changelog
Instance Method Summary collapse
- #all_cookbooks ⇒ Object
-
#git?(name) ⇒ Boolean
return true if cookbook is downloaded from git.
-
#git_location(name) ⇒ Object
return a Changelog::Location for this cookbook.
- #guess_version_for(name) ⇒ Object
-
#initialize(berksfile, config) ⇒ Berksfile
constructor
A new instance of Berksfile.
-
#local?(name) ⇒ Boolean
return true if cookbook is downloaded from local path.
- #new_cookbook?(name) ⇒ Boolean
-
#supermarket?(name) ⇒ Boolean
return true if cookbook is downloaded from supermarket.
-
#supermarkets_for(_name) ⇒ Object
return a list of supermarket uri for a given cookbook example: [ ‘supermarket.chef.io’ ].
- #update(cookbooks) ⇒ Object
Methods inherited from KnifeChangelog::Changelog
#clean, #cookbook_highest_version, #detect_cur_revision, #execute, #format_changelog, #generate_from_changelog_file, #generate_from_git_history, #get_from_supermarket_sources, #handle_git, #handle_new_cookbook, #handle_source, #handle_submodule, #https_url, #linkify, #run, #short
Constructor Details
#initialize(berksfile, config) ⇒ Berksfile
Returns a new instance of Berksfile.
8 9 10 11 12 13 14 |
# File 'lib/knife/changelog/berksfile.rb', line 8 def initialize(berksfile, config) require 'berkshelf' @locked_versions = berksfile.lockfile.locks @sources = berksfile.sources @berksfile = berksfile super(config) end |
Instance Method Details
#all_cookbooks ⇒ Object
16 17 18 |
# File 'lib/knife/changelog/berksfile.rb', line 16 def all_cookbooks @locked_versions.keys end |
#git?(name) ⇒ Boolean
return true if cookbook is downloaded from git
32 33 34 |
# File 'lib/knife/changelog/berksfile.rb', line 32 def git?(name) ck_dep(name).location.is_a?(Berkshelf::GitLocation) end |
#git_location(name) ⇒ Object
return a Changelog::Location for this cookbook
42 43 44 45 |
# File 'lib/knife/changelog/berksfile.rb', line 42 def git_location(name) raise "#{name} has not a git location" unless git?(name) Location.from_berk_git_location(ck_dep(name).location) end |
#guess_version_for(name) ⇒ Object
53 54 55 |
# File 'lib/knife/changelog/berksfile.rb', line 53 def guess_version_for(name) @locked_versions[name].locked_version.to_s end |
#local?(name) ⇒ Boolean
return true if cookbook is downloaded from local path
37 38 39 |
# File 'lib/knife/changelog/berksfile.rb', line 37 def local?(name) ck_dep(name).location.is_a?(Berkshelf::PathLocation) end |
#new_cookbook?(name) ⇒ Boolean
20 21 22 |
# File 'lib/knife/changelog/berksfile.rb', line 20 def new_cookbook?(name) ck_dep(name).nil? end |
#supermarket?(name) ⇒ Boolean
return true if cookbook is downloaded from supermarket
25 26 27 28 29 |
# File 'lib/knife/changelog/berksfile.rb', line 25 def supermarket?(name) # here is berkshelf "expressive" way to say cookbook # comes from supermarket ck_dep(name).location.is_a?(NilClass) end |
#supermarkets_for(_name) ⇒ Object
return a list of supermarket uri for a given cookbook example: [ ‘supermarket.chef.io’ ]
49 50 51 |
# File 'lib/knife/changelog/berksfile.rb', line 49 def supermarkets_for(_name) @sources.map(&:uri) end |
#update(cookbooks) ⇒ Object
57 58 59 |
# File 'lib/knife/changelog/berksfile.rb', line 57 def update(cookbooks) @berksfile.update(*cookbooks) end |