berkshelf 7.0.8 → 8.0.0
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 +4 -4
- data/Gemfile +3 -12
- data/Rakefile +3 -3
- data/berkshelf.gemspec +3 -4
- data/bin/berks +1 -1
- data/lib/berkshelf/api_client/chef_server_connection.rb +7 -8
- data/lib/berkshelf/api_client/connection.rb +1 -1
- data/lib/berkshelf/api_client/remote_cookbook.rb +1 -1
- data/lib/berkshelf/api_client.rb +2 -2
- data/lib/berkshelf/berksfile.rb +44 -42
- data/lib/berkshelf/cached_cookbook.rb +5 -3
- data/lib/berkshelf/chef_config_compat.rb +1 -1
- data/lib/berkshelf/chef_repo_universe.rb +4 -2
- data/lib/berkshelf/cli.rb +6 -6
- data/lib/berkshelf/commands/shelf.rb +1 -1
- data/lib/berkshelf/community_rest.rb +6 -6
- data/lib/berkshelf/config.rb +3 -3
- data/lib/berkshelf/cookbook_store.rb +2 -4
- data/lib/berkshelf/core_ext/file_utils.rb +3 -3
- data/lib/berkshelf/core_ext.rb +1 -1
- data/lib/berkshelf/dependency.rb +1 -1
- data/lib/berkshelf/downloader.rb +9 -6
- data/lib/berkshelf/errors.rb +5 -2
- data/lib/berkshelf/file_syncer.rb +10 -12
- data/lib/berkshelf/formatters/human.rb +1 -1
- data/lib/berkshelf/formatters/json.rb +1 -1
- data/lib/berkshelf/installer.rb +8 -8
- data/lib/berkshelf/location.rb +4 -4
- data/lib/berkshelf/locations/git.rb +6 -12
- data/lib/berkshelf/locations/github.rb +1 -1
- data/lib/berkshelf/lockfile.rb +11 -11
- data/lib/berkshelf/logger.rb +4 -2
- data/lib/berkshelf/mixin/git.rb +3 -3
- data/lib/berkshelf/packager.rb +5 -7
- data/lib/berkshelf/resolver.rb +1 -1
- data/lib/berkshelf/ridley_compat.rb +1 -1
- data/lib/berkshelf/shell.rb +2 -1
- data/lib/berkshelf/shell_out.rb +4 -3
- data/lib/berkshelf/source.rb +8 -7
- data/lib/berkshelf/source_uri.rb +1 -1
- data/lib/berkshelf/ssl_policies.rb +6 -10
- 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 +37 -35
- data/lib/berkshelf/validator.rb +2 -8
- data/lib/berkshelf/version.rb +1 -1
- data/lib/berkshelf/visualizer.rb +3 -3
- data/lib/berkshelf.rb +8 -9
- data/spec/config/knife.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- data/spec/support/chef_server.rb +2 -2
- data/spec/support/git.rb +19 -19
- data/spec/support/path_helpers.rb +4 -4
- 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 +7 -7
- data/spec/unit/berkshelf/berkshelf/api_client/chef_server_connection_spec.rb +65 -0
- 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 +6 -6
- data/spec/unit/berkshelf/downloader_spec.rb +4 -8
- data/spec/unit/berkshelf/location_spec.rb +1 -1
- data/spec/unit/berkshelf/locations/base_spec.rb +1 -2
- data/spec/unit/berkshelf/locations/git_spec.rb +2 -5
- 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 +2 -2
- data/spec/unit/berkshelf/source_spec.rb +30 -19
- data/spec/unit/berkshelf/ssl_policies_spec.rb +3 -6
- data/spec/unit/berkshelf/uploader_spec.rb +6 -10
- data/spec/unit/berkshelf/validator_spec.rb +0 -13
- metadata +26 -10
data/spec/config/knife.rb
CHANGED
|
@@ -4,7 +4,7 @@ node_name "berkshelf"
|
|
|
4
4
|
client_key File.expand_path("spec/config/berkshelf.pem")
|
|
5
5
|
validation_client_name "validator"
|
|
6
6
|
validation_key File.expand_path("spec/config/validator.pem")
|
|
7
|
-
chef_server_url "http://
|
|
7
|
+
chef_server_url "http://127.0.0.1:26310"
|
|
8
8
|
cache_type "BasicFile"
|
|
9
|
-
cache_options( path: "#{ENV[
|
|
9
|
+
cache_options( path: "#{ENV["HOME"]}/.chef/checksums" )
|
|
10
10
|
cookbook_path []
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/chef_server.rb
CHANGED
data/spec/support/git.rb
CHANGED
|
@@ -5,7 +5,7 @@ module Berkshelf
|
|
|
5
5
|
include Berkshelf::RSpec::PathHelpers
|
|
6
6
|
|
|
7
7
|
def git_origin_for(repo, options = {})
|
|
8
|
-
"file://#{generate_fake_git_remote("git@github.com/
|
|
8
|
+
"file://#{generate_fake_git_remote("git@github.com/chef/#{repo}.git", options)}/.git"
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def generate_fake_git_remote(uri, options = {})
|
|
@@ -84,26 +84,26 @@ module Berkshelf
|
|
|
84
84
|
|
|
85
85
|
private
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
# The path to store the local git clones.
|
|
88
|
+
#
|
|
89
|
+
# @return [Pathname]
|
|
90
90
|
def clones
|
|
91
91
|
ensure_and_return(tmp_path.join("clones"))
|
|
92
92
|
end
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
# The path to store the git remotes.
|
|
95
|
+
#
|
|
96
|
+
# @return [Pathname]
|
|
97
97
|
def remotes
|
|
98
98
|
ensure_and_return(tmp_path.join("remotes"))
|
|
99
99
|
end
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
# Generate a cookbook by the given name.
|
|
102
|
+
#
|
|
103
|
+
# @param [#to_s] name
|
|
104
|
+
# the name of the cookbook to create
|
|
105
|
+
# @param [Hash] options
|
|
106
|
+
# the list ooptions to pass to the generator
|
|
107
107
|
def generate_git_cookbook(name, options = {})
|
|
108
108
|
options = {
|
|
109
109
|
skip_vagrant: true,
|
|
@@ -114,12 +114,12 @@ module Berkshelf
|
|
|
114
114
|
Berkshelf::Cli.new.invoke(:cookbook, [name.to_s], options)
|
|
115
115
|
end
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
117
|
+
# Make sure the given path exists and return the path
|
|
118
|
+
#
|
|
119
|
+
# @param [#to_s] path
|
|
120
|
+
# the path to create and return
|
|
121
|
+
#
|
|
122
|
+
# @return [Pathname]
|
|
123
123
|
def ensure_and_return(path)
|
|
124
124
|
FileUtils.mkdir(path) unless File.exist?(path)
|
|
125
125
|
Pathname.new(path).expand_path
|
|
@@ -50,10 +50,10 @@ module Berkshelf
|
|
|
50
50
|
|
|
51
51
|
private
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
# This is the magical "reset" function that gives us a clean working
|
|
54
|
+
# directory on each run.
|
|
55
|
+
#
|
|
56
|
+
# @return [nil]
|
|
57
57
|
def reload_configs
|
|
58
58
|
Berkshelf.chef_config = chef_config
|
|
59
59
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -200,10 +200,10 @@ describe Berkshelf::Berksfile do
|
|
|
200
200
|
|
|
201
201
|
describe "#dependencies" do
|
|
202
202
|
let(:groups) do
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
%i{
|
|
204
|
+
nautilus
|
|
205
|
+
skarner
|
|
206
|
+
}
|
|
207
207
|
end
|
|
208
208
|
|
|
209
209
|
it "returns all Berkshelf::Dependencys added to the instance of Berksfile" do
|
|
@@ -235,8 +235,8 @@ describe Berkshelf::Berksfile do
|
|
|
235
235
|
describe "#groups" do
|
|
236
236
|
before do
|
|
237
237
|
allow(subject).to receive(:dependencies) { [dependency_one, dependency_two] }
|
|
238
|
-
allow(dependency_one).to receive(:groups) {
|
|
239
|
-
allow(dependency_two).to receive(:groups) {
|
|
238
|
+
allow(dependency_one).to receive(:groups) { %i{nautilus skarner} }
|
|
239
|
+
allow(dependency_two).to receive(:groups) { %i{nautilus riven} }
|
|
240
240
|
end
|
|
241
241
|
|
|
242
242
|
it "returns a hash containing keys for every group a dependency is a member of" do
|
|
@@ -255,7 +255,7 @@ describe Berkshelf::Berksfile do
|
|
|
255
255
|
describe "#add_dependency" do
|
|
256
256
|
let(:name) { "cookbook_one" }
|
|
257
257
|
let(:constraint) { "= 1.2.0" }
|
|
258
|
-
let(:options) {
|
|
258
|
+
let(:options) { {} }
|
|
259
259
|
|
|
260
260
|
before(:each) do
|
|
261
261
|
subject.add_dependency(name, constraint, options)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe Berkshelf::APIClient::ChefServerConnection do
|
|
4
|
+
let(:instance) do
|
|
5
|
+
described_class.new(
|
|
6
|
+
server_url: "https://chef.example.org/organizations/foobar",
|
|
7
|
+
timeout: 30,
|
|
8
|
+
open_timeout: 3,
|
|
9
|
+
ssl: {}
|
|
10
|
+
)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe "#universe" do
|
|
14
|
+
before do
|
|
15
|
+
body_response = %q{{"ruby":{"1.2.3":{"endpoint_priority":0,"platforms":{},"dependencies":{"build-essential":">= 1.2.2"},"location_type":"supermarket","location_path":"https://supermarket.getchef.com/"},"2.0.0":{"endpoint_priority":0,"platforms":{},"dependencies":{"build-essential":">= 1.2.2"},"location_type":"supermarket","location_path":"https://supermarket.getchef.com/"}},"elixir":{"1.0.0":{"endpoint_priority":0,"platforms":{"CentOS":"= 6.0.0"},"dependencies":{},"location_type":"supermarket","location_path":"https://supermarket.getchef.com/"}}}}
|
|
16
|
+
|
|
17
|
+
stub_request(:get, "https://chef.example.org/organizations/foobar/universe")
|
|
18
|
+
.to_return(status: 200, body: body_response, headers: { "Content-Type" => "application/json; charset=utf-8" })
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
subject { instance.universe }
|
|
22
|
+
|
|
23
|
+
it "returns an array of APIClient::RemoteCookbook" do
|
|
24
|
+
expect(subject).to be_a(Array)
|
|
25
|
+
|
|
26
|
+
subject.each do |remote|
|
|
27
|
+
expect(remote).to be_a(Berkshelf::APIClient::RemoteCookbook)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "contains a item for each dependency" do
|
|
32
|
+
expect(subject.size).to eq(3)
|
|
33
|
+
expect(subject[0].name).to eql("ruby")
|
|
34
|
+
expect(subject[0].version).to eql("1.2.3")
|
|
35
|
+
expect(subject[1].name).to eql("ruby")
|
|
36
|
+
expect(subject[1].version).to eql("2.0.0")
|
|
37
|
+
expect(subject[2].name).to eql("elixir")
|
|
38
|
+
expect(subject[2].version).to eql("1.0.0")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "has the dependencies for each" do
|
|
42
|
+
expect(subject[0].dependencies).to include("build-essential" => ">= 1.2.2")
|
|
43
|
+
expect(subject[1].dependencies).to include("build-essential" => ">= 1.2.2")
|
|
44
|
+
expect(subject[2].dependencies).to be_empty
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it "has the platforms for each" do
|
|
48
|
+
expect(subject[0].platforms).to be_empty
|
|
49
|
+
expect(subject[1].platforms).to be_empty
|
|
50
|
+
expect(subject[2].platforms).to include("CentOS" => "= 6.0.0")
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
it "has a location_path for each" do
|
|
54
|
+
subject.each do |remote|
|
|
55
|
+
expect(remote.location_path).to_not be_nil
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it "has a location_type for each" do
|
|
60
|
+
subject.each do |remote|
|
|
61
|
+
expect(remote.location_type).to_not be_nil
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -13,8 +13,7 @@ module Berkshelf
|
|
|
13
13
|
describe "#upload" do
|
|
14
14
|
it "calls to upload with params if passed in cli" do
|
|
15
15
|
expect(berksfile).to receive(:upload).with(cookbooks,
|
|
16
|
-
include(skip_syntax_check: true, freeze: false)
|
|
17
|
-
)
|
|
16
|
+
include(skip_syntax_check: true, freeze: false))
|
|
18
17
|
|
|
19
18
|
subject.options[:skip_syntax_check] = true
|
|
20
19
|
subject.options[:no_freeze] = true
|
|
@@ -68,7 +68,7 @@ describe Berkshelf::CommunityREST do
|
|
|
68
68
|
let(:archive) { double("archive", path: "/foo/bar", unlink: true) }
|
|
69
69
|
|
|
70
70
|
before do
|
|
71
|
-
allow(subject).to receive(:stream).with(any_args
|
|
71
|
+
allow(subject).to receive(:stream).with(any_args).and_return(archive)
|
|
72
72
|
allow(Berkshelf::CommunityREST).to receive(:unpack)
|
|
73
73
|
.and_return("/some/path")
|
|
74
74
|
end
|
|
@@ -7,12 +7,12 @@ describe FileUtils do
|
|
|
7
7
|
let(:options) { {} }
|
|
8
8
|
|
|
9
9
|
it "uses mv by default" do
|
|
10
|
-
expect(FileUtils).to receive(:old_mv).with(src, dest, options)
|
|
10
|
+
expect(FileUtils).to receive(:old_mv).with(src, dest, **options)
|
|
11
11
|
FileUtils.mv(src, dest, options)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
it "replaces mv with cp_r and rm_rf" do
|
|
15
|
-
expect(FileUtils).to receive(:cp_r).with(src, dest, options)
|
|
15
|
+
expect(FileUtils).to receive(:cp_r).with(src, dest, **options)
|
|
16
16
|
expect(FileUtils).to receive(:rm_rf).with(src)
|
|
17
17
|
|
|
18
18
|
FileUtils.mv(src, dest, options)
|
|
@@ -35,7 +35,7 @@ describe Berkshelf::Dependency do
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
context "given a location key :git" do
|
|
38
|
-
let(:url) { "
|
|
38
|
+
let(:url) { "https://url_to_git" }
|
|
39
39
|
let(:source) { described_class.new(berksfile, cookbook_name, git: url) }
|
|
40
40
|
|
|
41
41
|
it "initializes a GitLocation for location" do
|
|
@@ -71,7 +71,7 @@ describe Berkshelf::Dependency do
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
context "given a group option containing an array of groups" do
|
|
74
|
-
let(:groups) {
|
|
74
|
+
let(:groups) { %i{development test} }
|
|
75
75
|
let(:source) { described_class.new(berksfile, cookbook_name, group: groups) }
|
|
76
76
|
|
|
77
77
|
it "assigns all the groups to the group attribute" do
|
|
@@ -95,24 +95,24 @@ describe Berkshelf::Dependency do
|
|
|
95
95
|
describe "#add_group" do
|
|
96
96
|
it "stores strings as symbols" do
|
|
97
97
|
subject.add_group "foo"
|
|
98
|
-
expect(subject.groups).to eq(
|
|
98
|
+
expect(subject.groups).to eq(%i{default foo})
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
it "does not store duplicate groups" do
|
|
102
102
|
subject.add_group "bar"
|
|
103
103
|
subject.add_group "bar"
|
|
104
104
|
subject.add_group :bar
|
|
105
|
-
expect(subject.groups).to eq(
|
|
105
|
+
expect(subject.groups).to eq(%i{default bar})
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
it "adds multiple groups" do
|
|
109
109
|
subject.add_group "baz", "quux"
|
|
110
|
-
expect(subject.groups).to eq(
|
|
110
|
+
expect(subject.groups).to eq(%i{default baz quux})
|
|
111
111
|
end
|
|
112
112
|
|
|
113
113
|
it "handles multiple groups as an array" do
|
|
114
114
|
subject.add_group %w{baz quux}
|
|
115
|
-
expect(subject.groups).to eq(
|
|
115
|
+
expect(subject.groups).to eq(%i{default baz quux})
|
|
116
116
|
end
|
|
117
117
|
end
|
|
118
118
|
|
|
@@ -5,14 +5,12 @@ module Berkshelf
|
|
|
5
5
|
let(:berksfile) do
|
|
6
6
|
double(Berksfile,
|
|
7
7
|
lockfile: lockfile,
|
|
8
|
-
dependencies: []
|
|
9
|
-
)
|
|
8
|
+
dependencies: [])
|
|
10
9
|
end
|
|
11
10
|
|
|
12
11
|
let(:lockfile) do
|
|
13
12
|
double(Lockfile,
|
|
14
|
-
graph: graph
|
|
15
|
-
)
|
|
13
|
+
graph: graph)
|
|
16
14
|
end
|
|
17
15
|
|
|
18
16
|
let(:graph) { double(Lockfile::Graph, locks: {}) }
|
|
@@ -124,15 +122,13 @@ module Berkshelf
|
|
|
124
122
|
cookbook_copyright: "user",
|
|
125
123
|
cookbook_email: "user@example.com",
|
|
126
124
|
cookbook_license: "apachev2",
|
|
127
|
-
trusted_certs_dir: self_signed_crt_path
|
|
128
|
-
)
|
|
125
|
+
trusted_certs_dir: self_signed_crt_path)
|
|
129
126
|
end
|
|
130
127
|
|
|
131
128
|
let(:berkshelf_config) do
|
|
132
129
|
double(Config,
|
|
133
130
|
ssl: double(verify: true),
|
|
134
|
-
chef: chef_config
|
|
135
|
-
)
|
|
131
|
+
chef: chef_config)
|
|
136
132
|
end
|
|
137
133
|
|
|
138
134
|
before do
|
|
@@ -11,7 +11,7 @@ module Berkshelf
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
it "finds a :git location by key" do
|
|
14
|
-
instance = described_class.init(dependency, git: "
|
|
14
|
+
instance = described_class.init(dependency, git: "https://foo.com/meats/bacon.git")
|
|
15
15
|
expect(instance).to be_a(GitLocation)
|
|
16
16
|
end
|
|
17
17
|
|
|
@@ -104,11 +104,10 @@ module Berkshelf
|
|
|
104
104
|
|
|
105
105
|
context "when the repository is cached" do
|
|
106
106
|
it "pulls a new version" do
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
cache_path = subject.send(:cache_path)
|
|
109
108
|
allow(subject).to receive(:cached?).and_return(true)
|
|
110
109
|
expect(subject).to receive(:git).with(
|
|
111
|
-
'fetch --force --tags https://repo.com "refs/heads/*:refs/heads/*"'
|
|
110
|
+
'fetch --force --tags https://repo.com "refs/heads/*:refs/heads/*"', cwd: cache_path.to_s
|
|
112
111
|
)
|
|
113
112
|
subject.install
|
|
114
113
|
end
|
|
@@ -116,8 +115,6 @@ module Berkshelf
|
|
|
116
115
|
|
|
117
116
|
context "when the revision is not cached" do
|
|
118
117
|
it "clones the repository" do
|
|
119
|
-
allow(Dir).to receive(:chdir) { |args, &b| b.call } # Force eval the chdir block
|
|
120
|
-
|
|
121
118
|
cache_path = subject.send(:cache_path)
|
|
122
119
|
allow(subject).to receive(:cached?).and_return(false)
|
|
123
120
|
expect(subject).to receive(:git).with(
|
|
@@ -8,8 +8,7 @@ module Berkshelf
|
|
|
8
8
|
double("dependency",
|
|
9
9
|
name: "nginx",
|
|
10
10
|
version_constraint: constraint,
|
|
11
|
-
berksfile: berksfile
|
|
12
|
-
)
|
|
11
|
+
berksfile: berksfile)
|
|
13
12
|
end
|
|
14
13
|
let(:path) { fixtures_path.join("cookbooks", "example_cookbook") }
|
|
15
14
|
let(:relative_path) { Pathname.new("../../../fixtures/cookbooks/example_cookbook") }
|
|
@@ -8,8 +8,7 @@ describe Berkshelf::Lockfile do
|
|
|
8
8
|
let(:lock_path) { File.absolute_path("/path/to/Bacon") }
|
|
9
9
|
let(:berksfile) do
|
|
10
10
|
double("Berksfile",
|
|
11
|
-
filepath: lock_path
|
|
12
|
-
)
|
|
11
|
+
filepath: lock_path)
|
|
13
12
|
end
|
|
14
13
|
|
|
15
14
|
subject { described_class.from_berksfile(berksfile) }
|
|
@@ -77,8 +76,7 @@ describe Berkshelf::Lockfile do
|
|
|
77
76
|
version: "1.0.0",
|
|
78
77
|
location: "api",
|
|
79
78
|
dependencies: {},
|
|
80
|
-
cached_cookbook: cookbook
|
|
81
|
-
)
|
|
79
|
+
cached_cookbook: cookbook)
|
|
82
80
|
berksfile = double("berksfile", dependencies: [apt])
|
|
83
81
|
subject.instance_variable_set(:@berksfile, berksfile)
|
|
84
82
|
allow(subject).to receive(:find).with(apt).and_return(apt)
|
|
@@ -95,8 +93,7 @@ describe Berkshelf::Lockfile do
|
|
|
95
93
|
version: "1.0.0",
|
|
96
94
|
location: "api",
|
|
97
95
|
dependencies: { "bacon" => "1.0.0" },
|
|
98
|
-
cached_cookbook: cookbook
|
|
99
|
-
)
|
|
96
|
+
cached_cookbook: cookbook)
|
|
100
97
|
bacon = double(name: "bacon", version: "1.0.0", dependencies: {})
|
|
101
98
|
berksfile = double("berksfile", dependencies: [apt])
|
|
102
99
|
subject.instance_variable_set(:@berksfile, berksfile)
|
|
@@ -115,15 +112,13 @@ describe Berkshelf::Lockfile do
|
|
|
115
112
|
version: "1.0.0",
|
|
116
113
|
location: "api",
|
|
117
114
|
dependencies: { "bacon" => "1.0.0" },
|
|
118
|
-
cached_cookbook: cookbook
|
|
119
|
-
)
|
|
115
|
+
cached_cookbook: cookbook)
|
|
120
116
|
bacon = double("bacon",
|
|
121
117
|
name: "bacon",
|
|
122
118
|
version_constraint: Semverse::Constraint.new(">= 0.0.0"),
|
|
123
119
|
version: "1.0.0",
|
|
124
120
|
location: "api",
|
|
125
|
-
dependencies: { "apt" => "1.0.0" }
|
|
126
|
-
)
|
|
121
|
+
dependencies: { "apt" => "1.0.0" })
|
|
127
122
|
berksfile = double("berksfile", dependencies: [apt])
|
|
128
123
|
subject.instance_variable_set(:@berksfile, berksfile)
|
|
129
124
|
allow(subject).to receive(:find).with(apt).and_return(apt)
|
|
@@ -141,8 +136,7 @@ describe Berkshelf::Lockfile do
|
|
|
141
136
|
version: "1.0.0",
|
|
142
137
|
location: "api",
|
|
143
138
|
dependencies: { "bacon" => "1.0.0" },
|
|
144
|
-
cached_cookbook: cookbook
|
|
145
|
-
)
|
|
139
|
+
cached_cookbook: cookbook)
|
|
146
140
|
berksfile = double("berksfile", dependencies: [apt])
|
|
147
141
|
subject.instance_variable_set(:@berksfile, berksfile)
|
|
148
142
|
allow(subject).to receive(:find).with(apt).and_return(apt)
|
|
@@ -177,8 +171,7 @@ describe Berkshelf::Lockfile do
|
|
|
177
171
|
version: "1.0.0",
|
|
178
172
|
location: "api",
|
|
179
173
|
dependencies: {},
|
|
180
|
-
cached_cookbook: cookbook
|
|
181
|
-
)
|
|
174
|
+
cached_cookbook: cookbook)
|
|
182
175
|
berksfile = double("berksfile", dependencies: [apt])
|
|
183
176
|
subject.instance_variable_set(:@berksfile, berksfile)
|
|
184
177
|
allow(subject).to receive(:find).with(apt).and_return(apt)
|
|
@@ -195,8 +188,7 @@ describe Berkshelf::Lockfile do
|
|
|
195
188
|
version: "1.0.0",
|
|
196
189
|
location: "api",
|
|
197
190
|
dependencies: {},
|
|
198
|
-
cached_cookbook: cookbook
|
|
199
|
-
)
|
|
191
|
+
cached_cookbook: cookbook)
|
|
200
192
|
apt_master = apt.dup
|
|
201
193
|
allow(apt_master).to receive_messages(location: "github")
|
|
202
194
|
allow(apt_master).to receive_messages(cached_cookbook: cookbook)
|
|
@@ -393,8 +385,7 @@ describe Berkshelf::Lockfile::Graph do
|
|
|
393
385
|
name: "test-0.0.1",
|
|
394
386
|
version: "0.0.1",
|
|
395
387
|
cookbook_name: "test",
|
|
396
|
-
dependencies: {}
|
|
397
|
-
)
|
|
388
|
+
dependencies: {})
|
|
398
389
|
subject.update([cookbook])
|
|
399
390
|
|
|
400
391
|
expect(subject.locks.keys).to include(cookbook.cookbook_name)
|
|
@@ -2,9 +2,9 @@ require "spec_helper"
|
|
|
2
2
|
require "chef/cookbook_manifest"
|
|
3
3
|
|
|
4
4
|
describe Berkshelf::RidleyCompat do
|
|
5
|
-
let(:opts) {
|
|
5
|
+
let(:opts) { {} }
|
|
6
6
|
|
|
7
|
-
subject { described_class.new(opts) }
|
|
7
|
+
subject { described_class.new(**opts) }
|
|
8
8
|
|
|
9
9
|
context "default" do
|
|
10
10
|
it "has a cookbook version_class" do
|