berkshelf 7.0.6 → 7.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +7 -7
- data/Rakefile +2 -2
- data/berkshelf.gemspec +9 -10
- data/bin/berks +5 -0
- data/lib/berkshelf.rb +2 -2
- data/lib/berkshelf/api_client/chef_server_connection.rb +3 -2
- data/lib/berkshelf/api_client/connection.rb +1 -1
- data/lib/berkshelf/berksfile.rb +47 -41
- data/lib/berkshelf/cached_cookbook.rb +6 -4
- data/lib/berkshelf/chef_config_compat.rb +1 -0
- data/lib/berkshelf/chef_repo_universe.rb +6 -4
- data/lib/berkshelf/cli.rb +12 -7
- data/lib/berkshelf/commands/shelf.rb +1 -1
- data/lib/berkshelf/community_rest.rb +4 -4
- data/lib/berkshelf/config.rb +1 -1
- data/lib/berkshelf/core_ext.rb +1 -1
- data/lib/berkshelf/core_ext/file_utils.rb +2 -2
- data/lib/berkshelf/dependency.rb +1 -1
- data/lib/berkshelf/downloader.rb +10 -3
- data/lib/berkshelf/errors.rb +2 -2
- data/lib/berkshelf/formatters/human.rb +1 -1
- data/lib/berkshelf/formatters/json.rb +4 -4
- data/lib/berkshelf/installer.rb +1 -1
- data/lib/berkshelf/location.rb +3 -3
- data/lib/berkshelf/lockfile.rb +14 -14
- data/lib/berkshelf/logger.rb +4 -2
- data/lib/berkshelf/mixin/git.rb +1 -1
- data/lib/berkshelf/packager.rb +2 -2
- data/lib/berkshelf/resolver.rb +1 -1
- data/lib/berkshelf/ridley_compat.rb +1 -1
- data/lib/berkshelf/shell.rb +1 -0
- data/lib/berkshelf/source.rb +6 -5
- data/lib/berkshelf/ssl_policies.rb +1 -3
- data/lib/berkshelf/thor.rb +1 -1
- data/lib/berkshelf/thor_ext.rb +1 -1
- data/lib/berkshelf/uploader.rb +11 -9
- data/lib/berkshelf/version.rb +1 -1
- data/lib/berkshelf/visualizer.rb +1 -1
- data/spec/config/knife.rb +1 -1
- data/spec/support/chef_server.rb +2 -2
- data/spec/support/git.rb +18 -18
- data/spec/support/path_helpers.rb +4 -4
- data/spec/tmp/berkshelf/cookbooks/dep-1.0.0/attributes/default.rb +0 -0
- data/spec/tmp/berkshelf/cookbooks/dep-1.0.0/files/default/file.h +0 -0
- data/spec/tmp/berkshelf/cookbooks/dep-1.0.0/metadata.rb +2 -0
- data/spec/tmp/berkshelf/cookbooks/dep-1.0.0/recipes/default.rb +0 -0
- data/spec/tmp/berkshelf/cookbooks/dep-1.0.0/templates/default/template.erb +0 -0
- data/spec/tmp/berkshelf/cookbooks/ekaf-1.0.0/attributes/default.rb +0 -0
- data/spec/tmp/berkshelf/cookbooks/ekaf-1.0.0/files/default/file.h +0 -0
- data/spec/tmp/berkshelf/cookbooks/ekaf-1.0.0/metadata.rb +3 -0
- data/spec/tmp/berkshelf/cookbooks/ekaf-1.0.0/recipes/default.rb +0 -0
- data/spec/tmp/berkshelf/cookbooks/ekaf-1.0.0/templates/default/template.erb +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-1.0.0/attributes/default.rb +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-1.0.0/files/default/file.h +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-1.0.0/metadata.rb +3 -0
- data/spec/tmp/berkshelf/cookbooks/fake-1.0.0/recipes/default.rb +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-1.0.0/templates/default/template.erb +0 -0
- data/spec/unit/berkshelf/berksfile_spec.rb +7 -7
- data/spec/unit/berkshelf/cli_spec.rb +1 -2
- data/spec/unit/berkshelf/community_rest_spec.rb +1 -1
- data/spec/unit/berkshelf/core_ext/file_utils_spec.rb +2 -2
- data/spec/unit/berkshelf/dependency_spec.rb +5 -5
- data/spec/unit/berkshelf/downloader_spec.rb +29 -8
- data/spec/unit/berkshelf/locations/base_spec.rb +1 -2
- data/spec/unit/berkshelf/locations/path_spec.rb +1 -2
- data/spec/unit/berkshelf/lockfile_spec.rb +9 -18
- data/spec/unit/berkshelf/ridley_compat_spec.rb +1 -1
- data/spec/unit/berkshelf/source_spec.rb +8 -7
- data/spec/unit/berkshelf/ssl_policies_spec.rb +3 -5
- data/spec/unit/berkshelf/uploader_spec.rb +6 -10
- metadata +49 -188
- data/.github/lock.yml +0 -1
- data/.gitignore +0 -30
- data/.rubocop.yml +0 -12
- data/.travis.yml +0 -73
- data/CHANGELOG.legacy.md +0 -307
- data/CHANGELOG.md +0 -1582
- data/CONTRIBUTING.md +0 -68
- data/Gemfile.lock +0 -301
- data/PLUGINS.md +0 -25
- data/README.md +0 -72
- data/Thorfile +0 -61
- data/appveyor.yml +0 -31
- data/docs/berkshelf_for_newcomers.md +0 -64
- data/features/artifactory.feature +0 -70
- data/features/berksfile.feature +0 -46
- data/features/commands/apply.feature +0 -41
- data/features/commands/contingent.feature +0 -47
- data/features/commands/info.feature +0 -141
- data/features/commands/install.feature +0 -646
- data/features/commands/list.feature +0 -78
- data/features/commands/outdated.feature +0 -127
- data/features/commands/package.feature +0 -17
- data/features/commands/search.feature +0 -17
- data/features/commands/shelf/list.feature +0 -32
- data/features/commands/shelf/show.feature +0 -113
- data/features/commands/shelf/uninstall.feature +0 -96
- data/features/commands/show.feature +0 -83
- data/features/commands/update.feature +0 -142
- data/features/commands/upload.feature +0 -499
- data/features/commands/vendor.feature +0 -154
- data/features/commands/verify.feature +0 -29
- data/features/commands/viz.feature +0 -66
- data/features/community_site.feature +0 -37
- data/features/help.feature +0 -11
- data/features/json_formatter.feature +0 -158
- data/features/lifecycle.feature +0 -378
- data/features/lockfile.feature +0 -378
- data/features/step_definitions/berksfile_steps.rb +0 -54
- data/features/step_definitions/chef/config_steps.rb +0 -12
- data/features/step_definitions/chef_server_steps.rb +0 -60
- data/features/step_definitions/cli_steps.rb +0 -18
- data/features/step_definitions/config_steps.rb +0 -46
- data/features/step_definitions/environment_steps.rb +0 -11
- data/features/step_definitions/filesystem_steps.rb +0 -286
- data/features/step_definitions/gem_steps.rb +0 -13
- data/features/step_definitions/json_steps.rb +0 -29
- data/features/step_definitions/utility_steps.rb +0 -11
- data/features/support/aruba.rb +0 -12
- data/features/support/env.rb +0 -77
- data/spec/fixtures/cookbooks/example_cookbook/.gitignore +0 -2
- data/spec/fixtures/cookbooks/example_cookbook/.kitchen.yml +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db4572fef41dd9da70dbc590f97cac73ff70ef9c5206ae82dca20145f2d64da7
|
4
|
+
data.tar.gz: b31969725a11b43359027fa3e729381bc1515fdc8845601d473aac647f521b7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f760c4eca41839953b82dc30c4cb50ef60aff3ec7fc7c13a80d313f72d4d0ce775a61ae4c49b95de52d5a29f963d6a0d70d5a511af37d8aca900f05f72ef7f7d
|
7
|
+
data.tar.gz: 40f5a28f40e62e91c0b69ac8020611f9513cf03fc4e376c3edb1d60ad327288ecb3060daf4b4fd3e392e2a068838ccc7b0e9da72d3be6a0620835bbc9e0783fa
|
data/Gemfile
CHANGED
@@ -10,13 +10,10 @@ group :build do
|
|
10
10
|
gem "rake", ">= 10.1"
|
11
11
|
end
|
12
12
|
|
13
|
-
# temporarily until 13.7.x is released
|
14
|
-
gem "chef", git: "https://github.com/chef/chef", branch: "master"
|
15
|
-
|
16
13
|
group :development do
|
17
|
-
|
18
|
-
|
19
|
-
gem "
|
14
|
+
gem "chef-bin" # for the proxy tests
|
15
|
+
gem "aruba", "~> 0.10" # Stay below 1 until aruba/in_process monkeypatching stops
|
16
|
+
gem "cucumber", "< 4.0" # until we identify what is generating the ~@no_run tag in CI
|
20
17
|
gem "cucumber-expressions", "= 5.0.13"
|
21
18
|
gem "chef-zero", ">= 4.0"
|
22
19
|
gem "dep_selector", ">= 1.0"
|
@@ -24,11 +21,14 @@ group :development do
|
|
24
21
|
gem "rspec", ">= 3.0"
|
25
22
|
gem "rspec-its", ">= 1.2"
|
26
23
|
gem "webmock", ">= 1.11"
|
27
|
-
gem "yard", ">= 0.8"
|
28
24
|
gem "http", ">= 0.9.8"
|
29
25
|
gem "chefstyle", git: "https://github.com/chef/chefstyle.git", branch: "master"
|
30
26
|
end
|
31
27
|
|
28
|
+
group :docs do
|
29
|
+
gem "yard", ">= 0.8"
|
30
|
+
end
|
31
|
+
|
32
32
|
instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
|
33
33
|
|
34
34
|
# If you want to load debugging tools into the bundle exec sandbox,
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ rescue LoadError
|
|
8
8
|
task :spec
|
9
9
|
end
|
10
10
|
|
11
|
-
WINDOWS_PLATFORM = /mswin|win32|mingw
|
11
|
+
WINDOWS_PLATFORM = /mswin|win32|mingw/.freeze unless defined? WINDOWS_PLATFORM
|
12
12
|
|
13
13
|
begin
|
14
14
|
require "cucumber"
|
@@ -35,7 +35,7 @@ begin
|
|
35
35
|
rescue LoadError
|
36
36
|
end
|
37
37
|
|
38
|
-
task default:
|
38
|
+
task default: %i{spec features}
|
39
39
|
task :ci do
|
40
40
|
ENV["CI"] = "true"
|
41
41
|
Rake::Task[:spec].invoke
|
data/berkshelf.gemspec
CHANGED
@@ -17,29 +17,28 @@ Gem::Specification.new do |s|
|
|
17
17
|
"sethvargo@gmail.com",
|
18
18
|
]
|
19
19
|
|
20
|
-
s.description = %q{Manages a
|
20
|
+
s.description = %q{Manages a Chef cookbook's dependencies}
|
21
21
|
s.summary = s.description
|
22
|
-
s.homepage = "
|
23
|
-
s.license = "Apache
|
24
|
-
s.files =
|
25
|
-
s.executables =
|
26
|
-
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
22
|
+
s.homepage = "https://docs.chef.io/berkshelf.html"
|
23
|
+
s.license = "Apache-2.0"
|
24
|
+
s.files = %w{LICENSE Gemfile Rakefile} + Dir.glob("*.gemspec") + Dir.glob("{lib,spec, features}/**/*")
|
25
|
+
s.executables = Dir.glob("bin/**/*").map { |f| File.basename(f) }
|
27
26
|
s.name = "berkshelf"
|
28
27
|
s.require_paths = ["lib"]
|
29
28
|
s.version = Berkshelf::VERSION
|
30
29
|
s.required_ruby_version = ">= 2.4.0"
|
31
30
|
s.required_rubygems_version = ">= 2.0.0"
|
32
31
|
|
33
|
-
s.add_dependency "mixlib-shellout", "
|
32
|
+
s.add_dependency "mixlib-shellout", ">= 2.0", "< 4.0"
|
34
33
|
s.add_dependency "cleanroom", "~> 1.0"
|
35
34
|
s.add_dependency "minitar", ">= 0.6"
|
36
|
-
s.add_dependency "retryable", "
|
35
|
+
s.add_dependency "retryable", ">= 2.0", "< 4.0"
|
37
36
|
s.add_dependency "solve", "~> 4.0"
|
38
37
|
s.add_dependency "thor", ">= 0.20"
|
39
38
|
s.add_dependency "octokit", "~> 4.0"
|
40
|
-
s.add_dependency "mixlib-archive", "
|
39
|
+
s.add_dependency "mixlib-archive", ">= 0.4", "< 2.0"
|
41
40
|
s.add_dependency "concurrent-ruby", "~> 1.0"
|
42
|
-
s.add_dependency "chef", ">=
|
41
|
+
s.add_dependency "chef", ">= 15.7.32" # needed for --skip-syntax-check
|
43
42
|
s.add_dependency "chef-config"
|
44
43
|
# this is required for Mixlib::Config#from_json
|
45
44
|
s.add_dependency "mixlib-config", ">= 2.2.5"
|
data/bin/berks
ADDED
data/lib/berkshelf.rb
CHANGED
@@ -23,7 +23,7 @@ JSON.create_id = nil
|
|
23
23
|
|
24
24
|
require_relative "berkshelf/core_ext"
|
25
25
|
require_relative "berkshelf/thor_ext"
|
26
|
-
|
26
|
+
require_relative "berkshelf/chef_config_compat"
|
27
27
|
|
28
28
|
module Berkshelf
|
29
29
|
Encoding.default_external = Encoding::UTF_8
|
@@ -169,7 +169,7 @@ module Berkshelf
|
|
169
169
|
raise ChefConnectionError, "Missing required attribute in your Berkshelf configuration: chef.client_key"
|
170
170
|
end
|
171
171
|
|
172
|
-
RidleyCompat.new_client(ridley_options, &block)
|
172
|
+
RidleyCompat.new_client(**ridley_options, &block)
|
173
173
|
rescue ChefConnectionError, BerkshelfError
|
174
174
|
raise
|
175
175
|
rescue => ex
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative "../ridley_compat"
|
2
2
|
|
3
3
|
module Berkshelf
|
4
4
|
module APIClient
|
@@ -19,7 +19,8 @@ module Berkshelf
|
|
19
19
|
response.each do |name, versions|
|
20
20
|
versions.each do |version, attributes|
|
21
21
|
attributes[:location_path] = @url
|
22
|
-
cookbooks << RemoteCookbook.new(name, version, attributes)
|
22
|
+
cookbooks << RemoteCookbook.new(name, version, attributes)
|
23
|
+
end
|
23
24
|
end
|
24
25
|
end
|
25
26
|
rescue Ridley::Errors::HTTPNotFound
|
data/lib/berkshelf/berksfile.rb
CHANGED
@@ -13,7 +13,7 @@ module Berkshelf
|
|
13
13
|
def from_options(options = {})
|
14
14
|
options[:berksfile] ||= File.join(Dir.pwd, Berkshelf::DEFAULT_FILENAME)
|
15
15
|
symbolized = Hash[options.map { |k, v| [k.to_sym, v] }]
|
16
|
-
from_file(options[:berksfile], symbolized.select { |k,|
|
16
|
+
from_file(options[:berksfile], symbolized.select { |k,| %i{except only delete}.include? k })
|
17
17
|
end
|
18
18
|
|
19
19
|
# @param [#to_s] file
|
@@ -66,8 +66,8 @@ module Berkshelf
|
|
66
66
|
# group to be installed and all others to be ignored
|
67
67
|
def initialize(path, options = {})
|
68
68
|
@filepath = File.expand_path(path)
|
69
|
-
@dependencies =
|
70
|
-
@sources =
|
69
|
+
@dependencies = {}
|
70
|
+
@sources = {}
|
71
71
|
@delete = options[:delete]
|
72
72
|
|
73
73
|
# defaults for what solvers to use
|
@@ -146,7 +146,7 @@ module Berkshelf
|
|
146
146
|
# @see PathLocation
|
147
147
|
# @see GitLocation
|
148
148
|
def cookbook(*args)
|
149
|
-
options = args.last.is_a?(Hash) ? args.pop :
|
149
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
150
150
|
name, constraint = args
|
151
151
|
|
152
152
|
options[:path] &&= File.expand_path(options[:path], File.dirname(filepath))
|
@@ -176,10 +176,10 @@ module Berkshelf
|
|
176
176
|
# @option options [String] :path
|
177
177
|
# path to the metadata file
|
178
178
|
def metadata(options = {})
|
179
|
-
path
|
179
|
+
path = options[:path] || File.dirname(filepath)
|
180
180
|
|
181
181
|
loader = Chef::Cookbook::CookbookVersionLoader.new(path)
|
182
|
-
loader.
|
182
|
+
loader.load!
|
183
183
|
cookbook_version = loader.cookbook_version
|
184
184
|
metadata = cookbook_version.metadata
|
185
185
|
|
@@ -282,7 +282,7 @@ module Berkshelf
|
|
282
282
|
if @dependencies[name]
|
283
283
|
# Only raise an exception if the dependency is a true duplicate
|
284
284
|
groups = (options[:group].nil? || options[:group].empty?) ? [:default] : options[:group]
|
285
|
-
|
285
|
+
unless (@dependencies[name].groups & groups).empty?
|
286
286
|
raise DuplicateDependencyDefined.new(name)
|
287
287
|
end
|
288
288
|
end
|
@@ -468,6 +468,10 @@ module Berkshelf
|
|
468
468
|
# List of all the cookbooks which have a newer version found at a source
|
469
469
|
# that satisfies the constraints of your dependencies.
|
470
470
|
#
|
471
|
+
# @param [Boolean] include_non_satisfying
|
472
|
+
# include cookbooks that would not satisfy the given constraints in the
|
473
|
+
# +Berksfile+. Defaults to false.
|
474
|
+
#
|
471
475
|
# @return [Hash]
|
472
476
|
# a hash of cached cookbooks and their latest version grouped by their
|
473
477
|
# remote API source. The hash will be empty if there are no newer
|
@@ -483,7 +487,7 @@ module Berkshelf
|
|
483
487
|
# }
|
484
488
|
# }
|
485
489
|
# }
|
486
|
-
def outdated(*names)
|
490
|
+
def outdated(*names, include_non_satisfying: false)
|
487
491
|
validate_lockfile_present!
|
488
492
|
validate_lockfile_trusted!
|
489
493
|
validate_dependencies_installed!
|
@@ -494,9 +498,9 @@ module Berkshelf
|
|
494
498
|
cookbooks = source.versions(name)
|
495
499
|
|
496
500
|
latest = cookbooks.select do |cookbook|
|
497
|
-
dependency.version_constraint.satisfies?(cookbook.version) &&
|
501
|
+
(include_non_satisfying || dependency.version_constraint.satisfies?(cookbook.version)) &&
|
498
502
|
Semverse::Version.coerce(cookbook.version) > dependency.locked_version
|
499
|
-
end.sort_by
|
503
|
+
end.sort_by(&:version).last
|
500
504
|
|
501
505
|
unless latest.nil?
|
502
506
|
hash[name] ||= {
|
@@ -655,7 +659,7 @@ module Berkshelf
|
|
655
659
|
files.reject! { |file_path| chefignore.ignored?(file_path) }
|
656
660
|
|
657
661
|
# convert Pathname objects back to strings
|
658
|
-
files.map!
|
662
|
+
files.map!(&:to_s)
|
659
663
|
|
660
664
|
# copy each file to destination
|
661
665
|
files.each do |rpath|
|
@@ -736,39 +740,41 @@ module Berkshelf
|
|
736
740
|
|
737
741
|
private
|
738
742
|
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
743
|
+
# Ensure the lockfile is present on disk.
|
744
|
+
#
|
745
|
+
# @raise [LockfileNotFound]
|
746
|
+
# if the lockfile does not exist on disk
|
747
|
+
#
|
748
|
+
# @return [true]
|
745
749
|
def validate_lockfile_present!
|
746
750
|
raise LockfileNotFound unless lockfile.present?
|
751
|
+
|
747
752
|
true
|
748
753
|
end
|
749
754
|
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
755
|
+
# Ensure that all dependencies defined in the Berksfile exist in this
|
756
|
+
# lockfile.
|
757
|
+
#
|
758
|
+
# @raise [LockfileOutOfSync]
|
759
|
+
# if there are dependencies specified in the Berksfile which do not
|
760
|
+
# exist (or are not satisifed by) the lockfile
|
761
|
+
#
|
762
|
+
# @return [true]
|
758
763
|
def validate_lockfile_trusted!
|
759
764
|
raise LockfileOutOfSync unless lockfile.trusted?
|
765
|
+
|
760
766
|
true
|
761
767
|
end
|
762
768
|
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
769
|
+
# Ensure that all dependencies in the lockfile are installed on this
|
770
|
+
# system. You should validate that the lockfile can be trusted before
|
771
|
+
# using this method.
|
772
|
+
#
|
773
|
+
# @raise [DependencyNotInstalled]
|
774
|
+
# if the dependency in the lockfile is not in the Berkshelf shelf on
|
775
|
+
# this system
|
776
|
+
#
|
777
|
+
# @return [true]
|
772
778
|
def validate_dependencies_installed!
|
773
779
|
lockfile.graph.locks.each do |_, dependency|
|
774
780
|
unless dependency.installed?
|
@@ -779,13 +785,13 @@ module Berkshelf
|
|
779
785
|
true
|
780
786
|
end
|
781
787
|
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
788
|
+
# Determine if any cookbooks were specified that aren't in our shelf.
|
789
|
+
#
|
790
|
+
# @param [Array<String>] names
|
791
|
+
# a list of cookbook names
|
792
|
+
#
|
793
|
+
# @raise [DependencyNotFound]
|
794
|
+
# if a cookbook name is given that does not exist
|
789
795
|
def validate_cookbook_names!(names)
|
790
796
|
missing = names - lockfile.graph.locks.keys
|
791
797
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "chef/cookbook/cookbook_version_loader"
|
2
2
|
require "chef/cookbook/syntax_check"
|
3
|
-
|
3
|
+
require_relative "errors"
|
4
4
|
require "chef/json_compat"
|
5
5
|
|
6
6
|
module Berkshelf
|
@@ -66,7 +66,7 @@ module Berkshelf
|
|
66
66
|
@loader ||=
|
67
67
|
begin
|
68
68
|
loader = Chef::Cookbook::CookbookVersionLoader.new(@path)
|
69
|
-
loader.
|
69
|
+
loader.load!
|
70
70
|
loader
|
71
71
|
end
|
72
72
|
end
|
@@ -94,7 +94,7 @@ module Berkshelf
|
|
94
94
|
[cookbook_name, version] <=> [other.cookbook_name, other.version]
|
95
95
|
end
|
96
96
|
|
97
|
-
DIRNAME_REGEXP = /^(.+)-(.+)
|
97
|
+
DIRNAME_REGEXP = /^(.+)-(.+)$/.freeze
|
98
98
|
|
99
99
|
extend Forwardable
|
100
100
|
|
@@ -151,7 +151,8 @@ module Berkshelf
|
|
151
151
|
def validate
|
152
152
|
raise IOError, "No Cookbook found at: #{path}" unless path.exist?
|
153
153
|
|
154
|
-
syntax_checker = Chef::Cookbook::SyntaxCheck.
|
154
|
+
syntax_checker = Chef::Cookbook::SyntaxCheck.new(path.to_path)
|
155
|
+
|
155
156
|
unless syntax_checker.validate_ruby_files
|
156
157
|
raise Berkshelf::Errors::CookbookSyntaxError, "Invalid ruby files in cookbook: #{cookbook_name} (#{version})."
|
157
158
|
end
|
@@ -166,6 +167,7 @@ module Berkshelf
|
|
166
167
|
json_file = "#{path}/metadata.json"
|
167
168
|
rb_file = "#{path}/metadata.rb"
|
168
169
|
return nil if File.exist?(json_file)
|
170
|
+
|
169
171
|
md = Chef::Cookbook::Metadata.new
|
170
172
|
md.from_file(rb_file)
|
171
173
|
f = File.open(json_file, "w")
|
@@ -13,6 +13,7 @@ module Berkshelf
|
|
13
13
|
ChefConfig::WorkstationConfigLoader.new(path).load
|
14
14
|
ChefConfig::Config.merge!(options)
|
15
15
|
ChefConfig::Config.export_proxies # Set proxy settings as environment variables
|
16
|
+
ChefConfig::Config.init_openssl # setup openssl + fips mode
|
16
17
|
end
|
17
18
|
|
18
19
|
# Keep defaults that aren't in ChefConfig::Config
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require_relative "api_client/remote_cookbook"
|
2
|
+
require_relative "cached_cookbook"
|
3
3
|
|
4
4
|
module Berkshelf
|
5
5
|
# Shim to look like a Berkshelf::APIClient but for a chef repo folder.
|
@@ -15,12 +15,14 @@ module Berkshelf
|
|
15
15
|
def universe
|
16
16
|
Dir.entries(cookbooks_path).sort.each_with_object([]) do |entry, cookbooks|
|
17
17
|
next if entry[0] == "." # Skip hidden folders.
|
18
|
+
|
18
19
|
entry_path = "#{cookbooks_path}/#{entry}"
|
19
20
|
next unless File.directory?(entry_path) # Skip non-dirs.
|
21
|
+
|
20
22
|
cookbook = begin
|
21
23
|
Berkshelf::CachedCookbook.from_path(entry_path)
|
22
|
-
|
23
|
-
|
24
|
+
rescue IOError
|
25
|
+
next # It wasn't a cookbook.
|
24
26
|
end
|
25
27
|
cookbooks << Berkshelf::APIClient::RemoteCookbook.new(
|
26
28
|
cookbook.cookbook_name,
|
data/lib/berkshelf/cli.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative "../berkshelf"
|
2
2
|
require_relative "config"
|
3
3
|
require_relative "commands/shelf"
|
4
4
|
|
@@ -235,10 +235,15 @@ module Berkshelf
|
|
235
235
|
type: :array,
|
236
236
|
desc: "Only cookbooks that are in these groups.",
|
237
237
|
aliases: "-o"
|
238
|
+
method_option :all,
|
239
|
+
type: :boolean,
|
240
|
+
desc: "Include cookbooks that don't satisfy the version constraints.",
|
241
|
+
aliases: "-a",
|
242
|
+
default: false
|
238
243
|
desc "outdated [COOKBOOKS]", "List dependencies that have new versions available that satisfy their constraints"
|
239
244
|
def outdated(*names)
|
240
245
|
berksfile = Berksfile.from_options(options)
|
241
|
-
outdated = berksfile.outdated(*names)
|
246
|
+
outdated = berksfile.outdated(*names, include_non_satisfying: options[:all])
|
242
247
|
Berkshelf.formatter.outdated(outdated)
|
243
248
|
end
|
244
249
|
|
@@ -414,11 +419,11 @@ module Berkshelf
|
|
414
419
|
|
415
420
|
private
|
416
421
|
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
+
# Print a list of the given cookbooks. This is used by various
|
423
|
+
# methods like {list} and {contingent}.
|
424
|
+
#
|
425
|
+
# @param [Array<CachedCookbook>] cookbooks
|
426
|
+
#
|
422
427
|
def print_list(cookbooks)
|
423
428
|
Array(cookbooks).sort.each do |cookbook|
|
424
429
|
Berkshelf.formatter.msg " * #{cookbook.cookbook_name} (#{cookbook.version})"
|
@@ -13,7 +13,7 @@ module Berkshelf
|
|
13
13
|
else
|
14
14
|
Berkshelf.formatter.msg "Cookbooks in the Berkshelf shelf:"
|
15
15
|
cookbooks.sort.each do |cookbook, versions|
|
16
|
-
Berkshelf.formatter.msg(" * #{cookbook} (#{versions.sort.join(
|
16
|
+
Berkshelf.formatter.msg(" * #{cookbook} (#{versions.sort.join(", ")})")
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|