berkshelf 5.2.0 → 8.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Gemfile +19 -47
- data/Rakefile +14 -4
- data/berkshelf.gemspec +61 -40
- data/bin/berks +2 -2
- data/lib/berkshelf/api-client.rb +1 -0
- data/lib/berkshelf/api_client/chef_server_connection.rb +29 -0
- data/lib/berkshelf/api_client/connection.rb +57 -0
- data/lib/berkshelf/api_client/errors.rb +10 -0
- data/lib/berkshelf/api_client/remote_cookbook.rb +56 -0
- data/lib/berkshelf/api_client/version.rb +5 -0
- data/lib/berkshelf/api_client.rb +24 -0
- data/lib/berkshelf/berksfile.rb +149 -122
- data/lib/berkshelf/cached_cookbook.rb +127 -24
- data/lib/berkshelf/chef_config_compat.rb +51 -0
- data/lib/berkshelf/chef_repo_universe.rb +47 -0
- data/lib/berkshelf/cli.rb +143 -174
- data/lib/berkshelf/commands/shelf.rb +20 -19
- data/lib/berkshelf/community_rest.rb +59 -94
- data/lib/berkshelf/config.rb +97 -127
- data/lib/berkshelf/cookbook_store.rb +7 -6
- data/lib/berkshelf/core_ext/file.rb +1 -1
- data/lib/berkshelf/core_ext/file_utils.rb +4 -4
- data/lib/berkshelf/core_ext.rb +1 -1
- data/lib/berkshelf/dependency.rb +25 -32
- data/lib/berkshelf/downloader.rb +66 -39
- data/lib/berkshelf/errors.rb +23 -17
- data/lib/berkshelf/file_syncer.rb +24 -47
- data/lib/berkshelf/formatters/human.rb +7 -5
- data/lib/berkshelf/formatters/json.rb +6 -6
- data/lib/berkshelf/installer.rb +120 -111
- data/lib/berkshelf/location.rb +14 -14
- data/lib/berkshelf/locations/base.rb +1 -1
- data/lib/berkshelf/locations/git.rb +16 -24
- data/lib/berkshelf/locations/github.rb +2 -2
- data/lib/berkshelf/locations/path.rb +2 -2
- data/lib/berkshelf/lockfile.rb +326 -328
- data/lib/berkshelf/logger.rb +64 -1
- data/lib/berkshelf/mixin/git.rb +6 -5
- data/lib/berkshelf/packager.rb +44 -10
- data/lib/berkshelf/resolver/graph.rb +1 -1
- data/lib/berkshelf/resolver.rb +4 -4
- data/lib/berkshelf/ridley_compat.rb +109 -0
- data/lib/berkshelf/shell.rb +2 -1
- data/lib/berkshelf/shell_out.rb +18 -0
- data/lib/berkshelf/source.rb +77 -33
- data/lib/berkshelf/source_uri.rb +4 -4
- data/lib/berkshelf/ssl_policies.rb +38 -0
- data/lib/berkshelf/thor.rb +1 -1
- data/lib/berkshelf/thor_ext/hash_with_indifferent_access.rb +1 -1
- data/lib/berkshelf/thor_ext.rb +1 -1
- data/lib/berkshelf/uploader.rb +106 -70
- data/lib/berkshelf/validator.rb +13 -5
- data/lib/berkshelf/version.rb +1 -1
- data/lib/berkshelf/visualizer.rb +16 -11
- data/lib/berkshelf.rb +106 -81
- data/spec/config/knife.rb +4 -4
- data/spec/data/trusted_certs/example.crt +22 -0
- data/spec/fixtures/Berksfile +3 -3
- data/spec/fixtures/complex-cookbook-path/cookbooks/app/metadata.rb +2 -0
- data/spec/fixtures/complex-cookbook-path/cookbooks/jenkins/metadata.rb +2 -0
- data/spec/fixtures/complex-cookbook-path/cookbooks/jenkins-config/metadata.rb +4 -0
- data/spec/fixtures/cookbook-path/jenkins-config/metadata.rb +3 -3
- data/spec/fixtures/cookbook-path-uploader/apt-2.3.6/metadata.rb +2 -0
- data/spec/fixtures/cookbook-path-uploader/build-essential-1.4.2/metadata.rb +2 -0
- data/spec/fixtures/cookbook-path-uploader/jenkins-2.0.3/metadata.rb +5 -0
- data/spec/fixtures/cookbook-path-uploader/jenkins-config-0.1.0/metadata.rb +4 -0
- data/spec/fixtures/cookbook-path-uploader/runit-1.5.8/metadata.rb +5 -0
- data/spec/fixtures/cookbook-path-uploader/yum-3.0.6/metadata.rb +2 -0
- data/spec/fixtures/cookbook-path-uploader/yum-epel-0.2.0/metadata.rb +3 -0
- data/spec/fixtures/cookbook-store/jenkins-2.0.3/metadata.rb +5 -5
- data/spec/fixtures/cookbook-store/jenkins-2.0.4/metadata.rb +4 -4
- data/spec/fixtures/cookbooks/example_cookbook/metadata.rb +3 -3
- data/spec/fixtures/cookbooks/example_cookbook-0.5.0/metadata.rb +3 -3
- data/spec/spec_helper.rb +56 -64
- data/spec/support/chef_api.rb +15 -16
- data/spec/support/chef_server.rb +71 -69
- data/spec/support/git.rb +59 -58
- data/spec/support/kitchen.rb +0 -14
- data/spec/support/matchers/file_system_matchers.rb +4 -5
- data/spec/support/matchers/filepath_matchers.rb +2 -2
- data/spec/support/path_helpers.rb +17 -17
- data/spec/support/shared_examples/formatter.rb +1 -1
- data/spec/tmp/berkshelf/cookbooks/fake-0.1.0/attributes/default.rb +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-0.1.0/files/default/file.h +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-0.1.0/metadata.rb +2 -0
- data/spec/tmp/berkshelf/cookbooks/fake-0.1.0/recipes/default.rb +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-0.1.0/templates/default/template.erb +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-0.2.0/attributes/default.rb +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-0.2.0/files/default/file.h +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-0.2.0/metadata.rb +2 -0
- data/spec/tmp/berkshelf/cookbooks/fake-0.2.0/recipes/default.rb +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-0.2.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 +2 -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 +84 -105
- data/spec/unit/berkshelf/berkshelf/api_client/chef_server_connection_spec.rb +65 -0
- data/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb +157 -0
- data/spec/unit/berkshelf/berkshelf/api_client/remote_cookbook_spec.rb +23 -0
- data/spec/unit/berkshelf/berkshelf/api_client_spec.rb +9 -0
- data/spec/unit/berkshelf/cached_cookbook_spec.rb +45 -47
- data/spec/unit/berkshelf/chef_repo_universe_spec.rb +37 -0
- data/spec/unit/berkshelf/cli_spec.rb +7 -8
- data/spec/unit/berkshelf/community_rest_spec.rb +82 -90
- data/spec/unit/berkshelf/config_spec.rb +51 -22
- data/spec/unit/berkshelf/cookbook_store_spec.rb +41 -41
- data/spec/unit/berkshelf/core_ext/file_utils_spec.rb +7 -8
- data/spec/unit/berkshelf/core_ext/pathname_spec.rb +1 -1
- data/spec/unit/berkshelf/dependency_spec.rb +48 -48
- data/spec/unit/berkshelf/downloader_spec.rb +191 -34
- data/spec/unit/berkshelf/errors_spec.rb +3 -3
- data/spec/unit/berkshelf/file_syncer_spec.rb +87 -87
- data/spec/unit/berkshelf/formatters/base_spec.rb +23 -23
- data/spec/unit/berkshelf/formatters/human_spec.rb +2 -2
- data/spec/unit/berkshelf/formatters/json_spec.rb +2 -2
- data/spec/unit/berkshelf/formatters/null_spec.rb +3 -3
- data/spec/unit/berkshelf/installer_spec.rb +8 -8
- data/spec/unit/berkshelf/location_spec.rb +11 -11
- data/spec/unit/berkshelf/locations/base_spec.rb +35 -36
- data/spec/unit/berkshelf/locations/git_spec.rb +90 -93
- data/spec/unit/berkshelf/locations/path_spec.rb +40 -41
- data/spec/unit/berkshelf/lockfile_parser_spec.rb +71 -71
- data/spec/unit/berkshelf/lockfile_spec.rb +205 -211
- data/spec/unit/berkshelf/logger_spec.rb +3 -3
- data/spec/unit/berkshelf/mixin/logging_spec.rb +5 -5
- data/spec/unit/berkshelf/packager_spec.rb +2 -2
- data/spec/unit/berkshelf/resolver/graph_spec.rb +10 -8
- data/spec/unit/berkshelf/resolver_spec.rb +17 -17
- data/spec/unit/berkshelf/ridley_compat_spec.rb +16 -0
- data/spec/unit/berkshelf/shell_spec.rb +34 -34
- data/spec/unit/berkshelf/source_spec.rb +186 -20
- data/spec/unit/berkshelf/source_uri_spec.rb +1 -1
- data/spec/unit/berkshelf/ssl_policies_spec.rb +86 -0
- data/spec/unit/berkshelf/uploader_spec.rb +146 -64
- data/spec/unit/berkshelf/validator_spec.rb +23 -16
- data/spec/unit/berkshelf/visualizer_spec.rb +24 -15
- data/spec/unit/berkshelf_spec.rb +18 -18
- metadata +138 -289
- data/.gitignore +0 -29
- data/.travis.yml +0 -64
- data/CHANGELOG.legacy.md +0 -307
- data/CHANGELOG.md +0 -1358
- data/CONTRIBUTING.md +0 -64
- data/Gemfile.lock +0 -399
- data/Guardfile +0 -23
- data/PLUGINS.md +0 -25
- data/README.md +0 -70
- data/Thorfile +0 -61
- data/appveyor.yml +0 -31
- data/docs/berkshelf_for_newcomers.md +0 -65
- data/features/berksfile.feature +0 -46
- data/features/commands/apply.feature +0 -41
- data/features/commands/contingent.feature +0 -48
- data/features/commands/cookbook.feature +0 -35
- data/features/commands/info.feature +0 -99
- data/features/commands/init.feature +0 -27
- data/features/commands/install.feature +0 -636
- data/features/commands/list.feature +0 -78
- data/features/commands/outdated.feature +0 -130
- 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 -143
- 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 -426
- data/features/commands/vendor.feature +0 -111
- data/features/commands/verify.feature +0 -29
- data/features/commands/viz.feature +0 -66
- data/features/community_site.feature +0 -37
- data/features/config.feature +0 -111
- data/features/help.feature +0 -11
- data/features/json_formatter.feature +0 -161
- data/features/lifecycle.feature +0 -378
- data/features/lockfile.feature +0 -378
- data/features/step_definitions/berksfile_steps.rb +0 -39
- 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 -7
- data/features/step_definitions/filesystem_steps.rb +0 -269
- data/features/step_definitions/gem_steps.rb +0 -13
- data/features/step_definitions/json_steps.rb +0 -23
- data/features/step_definitions/utility_steps.rb +0 -11
- data/features/support/aruba.rb +0 -12
- data/features/support/env.rb +0 -82
- data/generator_files/Berksfile.erb +0 -11
- data/generator_files/CHANGELOG.md.erb +0 -3
- data/generator_files/Gemfile.erb +0 -8
- data/generator_files/README.md.erb +0 -42
- data/generator_files/Thorfile.erb +0 -11
- data/generator_files/Vagrantfile.erb +0 -117
- data/generator_files/chefignore +0 -94
- data/generator_files/default_recipe.erb +0 -6
- data/generator_files/default_test.rb.erb +0 -11
- data/generator_files/gitignore.erb +0 -23
- data/generator_files/helpers.rb.erb +0 -7
- data/generator_files/licenses/apachev2.erb +0 -13
- data/generator_files/licenses/gplv2.erb +0 -15
- data/generator_files/licenses/gplv3.erb +0 -14
- data/generator_files/licenses/mit.erb +0 -20
- data/generator_files/licenses/reserved.erb +0 -3
- data/generator_files/metadata.rb.erb +0 -11
- data/lib/berkshelf/base_generator.rb +0 -43
- data/lib/berkshelf/commands/test_command.rb +0 -13
- data/lib/berkshelf/cookbook_generator.rb +0 -133
- data/lib/berkshelf/init_generator.rb +0 -195
- data/spec/fixtures/cookbooks/example_cookbook/.gitignore +0 -2
- data/spec/fixtures/cookbooks/example_cookbook/.kitchen.yml +0 -26
- data/spec/unit/berkshelf/cookbook_generator_spec.rb +0 -110
- data/spec/unit/berkshelf/init_generator_spec.rb +0 -263
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 547ce4d95888e7fd0fcfb2b50c449cc78c67ffb4885b44d953e69383d5d5ed26
|
|
4
|
+
data.tar.gz: 472be5adafecb5a2741701dc0c083017126c2cd9fb91bc5692a4d3f80beb2db6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b28e165ac351b1902ba1bc65f7715d5a1a709881f46c039f4186b7dd6e924a9412789332cae9c37db8e75caff2a503d4fa91637d872fc7f12b51fa6cc04dcea0
|
|
7
|
+
data.tar.gz: 78c7e37a5ebee0dbb8faa346cd5807f888fd16b8591688ee3248d04be4372035561ba65765700d6c39ab56d2d09f22acdc4d1aad24f416537babc5f042ae3caa
|
data/Gemfile
CHANGED
|
@@ -1,56 +1,28 @@
|
|
|
1
|
-
source
|
|
1
|
+
source "https://rubygems.org"
|
|
2
2
|
|
|
3
3
|
gemspec
|
|
4
4
|
|
|
5
|
-
group :
|
|
6
|
-
gem
|
|
7
|
-
gem 'guard'
|
|
8
|
-
gem 'guard-cucumber'
|
|
9
|
-
gem 'guard-rspec'
|
|
10
|
-
gem 'guard-spork'
|
|
11
|
-
|
|
12
|
-
require 'rbconfig'
|
|
13
|
-
|
|
14
|
-
if RbConfig::CONFIG['target_os'] =~ /darwin/i
|
|
15
|
-
gem 'growl', require: false
|
|
16
|
-
gem 'rb-fsevent', require: false
|
|
17
|
-
|
|
18
|
-
if `uname`.strip == 'Darwin' && `sw_vers -productVersion`.strip >= '10.8'
|
|
19
|
-
gem 'terminal-notifier-guard', '~> 1.5.3', require: false
|
|
20
|
-
end rescue Errno::ENOENT
|
|
21
|
-
|
|
22
|
-
elsif RbConfig::CONFIG['target_os'] =~ /linux/i
|
|
23
|
-
gem 'libnotify', '~> 0.8.0', require: false
|
|
24
|
-
gem 'rb-inotify', require: false
|
|
25
|
-
|
|
26
|
-
elsif RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
|
|
27
|
-
gem 'rb-notifu', '>= 0.0.4', require: false
|
|
28
|
-
gem 'wdm', require: false
|
|
29
|
-
gem 'win32console', require: false
|
|
30
|
-
end
|
|
5
|
+
group :build do
|
|
6
|
+
gem "rake", ">= 10.1"
|
|
31
7
|
end
|
|
32
8
|
|
|
33
9
|
group :development do
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
gem
|
|
37
|
-
gem
|
|
38
|
-
gem
|
|
39
|
-
gem
|
|
40
|
-
gem
|
|
41
|
-
gem
|
|
42
|
-
gem
|
|
43
|
-
gem
|
|
44
|
-
gem
|
|
45
|
-
gem
|
|
46
|
-
gem 'http', '>= 0.9.8'
|
|
47
|
-
gem 'activesupport', '~> 4.0' # pinning for ruby 2.1.x
|
|
10
|
+
gem "aruba", "~> 0.10" # Stay below 1 until aruba/in_process monkeypatching stops
|
|
11
|
+
gem "debug"
|
|
12
|
+
gem "cucumber", "< 4.0" # until we identify what is generating the ~@no_run tag in CI
|
|
13
|
+
gem "cucumber-expressions", "= 5.0.13"
|
|
14
|
+
gem "chef-zero", ">= 4.0"
|
|
15
|
+
gem "dep_selector", ">= 1.0"
|
|
16
|
+
gem "fuubar", ">= 2.0"
|
|
17
|
+
gem "rspec", ">= 3.0"
|
|
18
|
+
gem "rspec-its", ">= 1.2"
|
|
19
|
+
gem "webmock", ">= 1.11"
|
|
20
|
+
gem "http", ">= 0.9.8"
|
|
21
|
+
gem "chefstyle"
|
|
48
22
|
end
|
|
49
23
|
|
|
50
|
-
|
|
51
|
-
gem 'github_changelog_generator', "1.11.3"
|
|
52
|
-
end
|
|
24
|
+
instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
|
|
53
25
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
26
|
+
# If you want to load debugging tools into the bundle exec sandbox,
|
|
27
|
+
# add these additional dependencies into Gemfile.local
|
|
28
|
+
eval_gemfile(__FILE__ + ".local") if File.exist?(__FILE__ + ".local")
|
data/Rakefile
CHANGED
|
@@ -8,14 +8,14 @@ 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"
|
|
15
15
|
require "cucumber/rake/task"
|
|
16
16
|
Cucumber::Rake::Task.new(:features) do |t|
|
|
17
|
-
if RUBY_PLATFORM =~ WINDOWS_PLATFORM
|
|
18
|
-
t.cucumber_opts = "--tags
|
|
17
|
+
if RUBY_PLATFORM =~ WINDOWS_PLATFORM || RUBY_PLATFORM =~ /darwin/
|
|
18
|
+
t.cucumber_opts = "--tags 'not @not-windows'"
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
rescue LoadError
|
|
@@ -35,9 +35,19 @@ 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
|
|
42
42
|
Rake::Task[:features].invoke
|
|
43
43
|
end
|
|
44
|
+
|
|
45
|
+
begin
|
|
46
|
+
require "chefstyle"
|
|
47
|
+
require "rubocop/rake_task"
|
|
48
|
+
RuboCop::RakeTask.new(:style) do |task|
|
|
49
|
+
task.options += ["--display-cop-names", "--no-color"]
|
|
50
|
+
end
|
|
51
|
+
rescue LoadError
|
|
52
|
+
puts "chefstyle/rubocop is not available. gem install chefstyle to do style checking."
|
|
53
|
+
end
|
data/berkshelf.gemspec
CHANGED
|
@@ -1,48 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
require File.expand_path('../lib/berkshelf/version', __FILE__)
|
|
1
|
+
require File.expand_path("lib/berkshelf/version", __dir__)
|
|
3
2
|
|
|
4
3
|
Gem::Specification.new do |s|
|
|
5
|
-
s.authors
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
s.authors = [
|
|
5
|
+
"Jamie Winsor",
|
|
6
|
+
"Josiah Kiehl",
|
|
7
|
+
"Michael Ivey",
|
|
8
|
+
"Justin Campbell",
|
|
9
|
+
"Seth Vargo",
|
|
11
10
|
]
|
|
12
|
-
s.email
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
s.email = [
|
|
12
|
+
"jamie@vialstudios.com",
|
|
13
|
+
"jkiehl@riotgames.com",
|
|
14
|
+
"michael.ivey@riotgames.com",
|
|
15
|
+
"justin@justincampbell.me",
|
|
16
|
+
"sethvargo@gmail.com",
|
|
18
17
|
]
|
|
19
18
|
|
|
20
|
-
s.description = %q{Manages a
|
|
19
|
+
s.description = %q{Manages a Chef cookbook's dependencies}
|
|
21
20
|
s.summary = s.description
|
|
22
|
-
s.homepage =
|
|
23
|
-
s.license =
|
|
24
|
-
s.files =
|
|
25
|
-
s.executables =
|
|
26
|
-
s.
|
|
27
|
-
s.
|
|
28
|
-
s.require_paths = ['lib']
|
|
21
|
+
s.homepage = "https://docs.chef.io/berkshelf.html"
|
|
22
|
+
s.license = "Apache-2.0"
|
|
23
|
+
s.files = %w{LICENSE Gemfile Rakefile} + Dir.glob("*.gemspec") + Dir.glob("{lib,spec, features}/**/*")
|
|
24
|
+
s.executables = Dir.glob("bin/**/*").map { |f| File.basename(f) }
|
|
25
|
+
s.name = "berkshelf"
|
|
26
|
+
s.require_paths = ["lib"]
|
|
29
27
|
s.version = Berkshelf::VERSION
|
|
30
|
-
s.required_ruby_version =
|
|
31
|
-
s.required_rubygems_version =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
s.add_dependency
|
|
41
|
-
|
|
42
|
-
s.add_dependency
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
28
|
+
s.required_ruby_version = ">= 2.7.0"
|
|
29
|
+
s.required_rubygems_version = ">= 2.0.0"
|
|
30
|
+
s.metadata = {
|
|
31
|
+
"bug_tracker_uri" => "https://github.com/chef/berkshelf/issues",
|
|
32
|
+
"source_code_uri" => "https://github.com/chef/berkshelf",
|
|
33
|
+
"changelog_uri" => "https://github.com/chef/berkshelf/blob/main/CHANGELOG.md",
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
ruby_version = Gem::Version.new(RUBY_VERSION)
|
|
37
|
+
|
|
38
|
+
s.add_dependency "mixlib-shellout", ">= 2.0", "< 4.0"
|
|
39
|
+
|
|
40
|
+
s.add_dependency "chef-cleanroom", "~> 1.0"
|
|
41
|
+
|
|
42
|
+
if ruby_version >= Gem::Version.new("3.1.0")
|
|
43
|
+
s.add_dependency "minitar", "~> 1.0"
|
|
44
|
+
s.add_dependency "chef", ">= 18.0.0"
|
|
45
|
+
else
|
|
46
|
+
s.add_dependency "minitar", "~> 0.12"
|
|
47
|
+
|
|
48
|
+
if ruby_version >= Gem::Version.new("3.0.0")
|
|
49
|
+
s.add_dependency "chef", "~> 17.0" # needed for --skip-syntax-check
|
|
50
|
+
else
|
|
51
|
+
s.add_dependency "chef", ">= 15.7.32"
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
s.add_dependency "retryable", ">= 2.0", "< 4.0"
|
|
56
|
+
s.add_dependency "solve", "~> 4.0"
|
|
57
|
+
|
|
58
|
+
s.add_dependency "thor", ">= 0.20", "< 1.3.0"
|
|
59
|
+
s.add_dependency "octokit", ">= 4.0", "< 6.0"
|
|
60
|
+
|
|
61
|
+
s.add_dependency "mixlib-archive", ">= 1.1.4", "< 2.0" # needed for ruby 3.0 / Dir.chdir removal
|
|
62
|
+
s.add_dependency "concurrent-ruby", "~> 1.0"
|
|
63
|
+
|
|
64
|
+
s.add_dependency "ffi", "~> 1.9", "< 1.16.0" #
|
|
65
|
+
|
|
66
|
+
s.add_dependency "chef-config"
|
|
67
|
+
# this is required for Mixlib::Config#from_json
|
|
68
|
+
s.add_dependency "mixlib-config", ">= 2.2.5"
|
|
48
69
|
end
|
data/bin/berks
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require_relative "api_client"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require_relative "../ridley_compat"
|
|
2
|
+
|
|
3
|
+
module Berkshelf
|
|
4
|
+
module APIClient
|
|
5
|
+
require_relative "errors"
|
|
6
|
+
|
|
7
|
+
class ChefServerConnection
|
|
8
|
+
def initialize(**args)
|
|
9
|
+
@client = Berkshelf::RidleyCompat.new(**args)
|
|
10
|
+
@url = args[:server_url]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def universe
|
|
14
|
+
response = @client.get("universe")
|
|
15
|
+
|
|
16
|
+
[].tap do |cookbooks|
|
|
17
|
+
response.each do |name, versions|
|
|
18
|
+
versions.each do |version, attributes|
|
|
19
|
+
attributes[:location_path] = @url
|
|
20
|
+
cookbooks << RemoteCookbook.new(name, version, attributes)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
rescue Ridley::Errors::HTTPNotFound
|
|
25
|
+
raise ServiceNotFound, "service not found at: #{@url}"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
require_relative "../ridley_compat"
|
|
2
|
+
|
|
3
|
+
module Berkshelf
|
|
4
|
+
module APIClient
|
|
5
|
+
require_relative "errors"
|
|
6
|
+
|
|
7
|
+
class Connection
|
|
8
|
+
# @return [String]
|
|
9
|
+
attr_reader :url
|
|
10
|
+
|
|
11
|
+
# @return [Integer]
|
|
12
|
+
# how many retries to attempt on HTTP requests
|
|
13
|
+
attr_reader :retries
|
|
14
|
+
|
|
15
|
+
# @return [Float]
|
|
16
|
+
# time to wait between retries
|
|
17
|
+
attr_reader :retry_interval
|
|
18
|
+
|
|
19
|
+
# @param [String, Addressable::URI] url
|
|
20
|
+
#
|
|
21
|
+
# @option options [Integer] :open_timeout (3)
|
|
22
|
+
# how long to wait (in seconds) for connection open to the API server
|
|
23
|
+
# @option options [Integer] :timeout (30)
|
|
24
|
+
# how long to wait (in seconds) before getting a response from the API server
|
|
25
|
+
# @option options [Integer] :retries (3)
|
|
26
|
+
# how many retries to perform before giving up
|
|
27
|
+
# @option options [Float] :retry_interval (0.5)
|
|
28
|
+
# how long to wait (in seconds) between each retry
|
|
29
|
+
def initialize(url, options = {})
|
|
30
|
+
# it looks like Faraday mutates the URI argument it is given, when we ripped Faraday out of this
|
|
31
|
+
# API it stopped doing that. this may or may not be a breaking change (it broke some fairly
|
|
32
|
+
# brittle berkshelf tests). if it causes too much berkshelf chaos we could revert by uncommenting
|
|
33
|
+
# the next line. as it is removing this behavior feels more like fixing a bug.
|
|
34
|
+
# @url = url.normalize! if url.is_a?(Addressable::URI)
|
|
35
|
+
options = { retries: 3, retry_interval: 0.5, open_timeout: 30, timeout: 30 }.merge(options)
|
|
36
|
+
options[:server_url] = url
|
|
37
|
+
|
|
38
|
+
@client = Berkshelf::RidleyCompatJSON.new(**options)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Retrieves the entire universe of known cookbooks from the API source
|
|
42
|
+
#
|
|
43
|
+
# @raise [APIClient::TimeoutError]
|
|
44
|
+
#
|
|
45
|
+
# @return [Array<APIClient::RemoteCookbook>]
|
|
46
|
+
def universe
|
|
47
|
+
response = @client.get("universe")
|
|
48
|
+
|
|
49
|
+
[].tap do |cookbooks|
|
|
50
|
+
response.each do |name, versions|
|
|
51
|
+
versions.each { |version, attributes| cookbooks << RemoteCookbook.new(name, version, attributes) }
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
module Berkshelf
|
|
2
|
+
class APIClientError < StandardError; end
|
|
3
|
+
|
|
4
|
+
module APIClient
|
|
5
|
+
class TimeoutError < APIClientError; end
|
|
6
|
+
class BadResponse < APIClientError; end
|
|
7
|
+
class ServiceUnavailable < APIClientError; end
|
|
8
|
+
class ServiceNotFound < APIClientError; end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require "json" unless defined?(JSON)
|
|
2
|
+
require "chef/mash"
|
|
3
|
+
|
|
4
|
+
module Berkshelf
|
|
5
|
+
module APIClient
|
|
6
|
+
# A representation of cookbook metadata indexed by a Berkshelf API Server. Returned
|
|
7
|
+
# by sending messages to a {Berkshelf::APIClient} and used to download cookbooks
|
|
8
|
+
# indexed by the Berkshelf API Server.
|
|
9
|
+
class RemoteCookbook
|
|
10
|
+
# @return [String]
|
|
11
|
+
attr_reader :name
|
|
12
|
+
# @return [String]
|
|
13
|
+
attr_reader :version
|
|
14
|
+
|
|
15
|
+
# @param [String] name
|
|
16
|
+
# @param [String] version
|
|
17
|
+
# @param [Hash] attributes
|
|
18
|
+
def initialize(name, version, attributes = {})
|
|
19
|
+
@name = name
|
|
20
|
+
@version = version
|
|
21
|
+
@attributes = ::Mash.new(attributes)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# @return [Hash]
|
|
25
|
+
def dependencies
|
|
26
|
+
@attributes[:dependencies]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# @return [Hash]
|
|
30
|
+
def platforms
|
|
31
|
+
@attributes[:platforms]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# @return [Symbol]
|
|
35
|
+
def location_type
|
|
36
|
+
@attributes[:location_type].to_sym
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# @return [String]
|
|
40
|
+
def location_path
|
|
41
|
+
@attributes[:location_path]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def to_hash
|
|
45
|
+
{
|
|
46
|
+
name: name,
|
|
47
|
+
version: version,
|
|
48
|
+
}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def to_json(options = {})
|
|
52
|
+
::JSON.pretty_generate(to_hash, options)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Berkshelf
|
|
2
|
+
# Used to communicate with a remotely hosted [Berkshelf API Server](https://github.com/berkshelf/berkshelf-api).
|
|
3
|
+
#
|
|
4
|
+
# @example
|
|
5
|
+
# client = Berkshelf::APIClient.new("https://api.berkshelf.com")
|
|
6
|
+
# client.universe #=> [...]
|
|
7
|
+
module APIClient
|
|
8
|
+
require_relative "api_client/version"
|
|
9
|
+
require_relative "api_client/errors"
|
|
10
|
+
require_relative "api_client/remote_cookbook"
|
|
11
|
+
require_relative "api_client/connection"
|
|
12
|
+
require_relative "api_client/chef_server_connection"
|
|
13
|
+
|
|
14
|
+
class << self
|
|
15
|
+
def new(*args)
|
|
16
|
+
Connection.new(*args)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def chef_server(**args)
|
|
20
|
+
ChefServerConnection.new(**args)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|