berkshelf 3.0.0.beta3 → 3.0.0.beta4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +1 -0
- data/CHANGELOG.md +12 -2
- data/CONTRIBUTING.md +53 -53
- data/Gemfile +1 -1
- data/Guardfile +12 -6
- data/PLUGINS.md +2 -2
- data/README.md +7 -11
- data/berkshelf.gemspec +1 -1
- data/features/commands/apply.feature +15 -4
- data/features/commands/cookbook.feature +1 -1
- data/features/commands/install.feature +85 -15
- data/features/commands/list.feature +35 -2
- data/features/commands/outdated.feature +3 -3
- data/features/commands/package.feature +1 -0
- data/features/commands/show.feature +3 -3
- data/features/commands/update.feature +1 -0
- data/features/commands/upload.feature +28 -4
- data/features/json_formatter.feature +2 -0
- data/features/lockfile.feature +1 -0
- data/features/support/env.rb +8 -4
- data/generator_files/Gemfile.erb +9 -0
- data/generator_files/README.md.erb +15 -33
- data/generator_files/Vagrantfile.erb +6 -3
- data/lib/berkshelf.rb +32 -2
- data/lib/berkshelf/berksfile.rb +59 -83
- data/lib/berkshelf/cli.rb +15 -67
- data/lib/berkshelf/community_rest.rb +18 -2
- data/lib/berkshelf/dependency.rb +6 -4
- data/lib/berkshelf/downloader.rb +3 -0
- data/lib/berkshelf/errors.rb +15 -0
- data/lib/berkshelf/formatters.rb +1 -0
- data/lib/berkshelf/formatters/human_readable.rb +27 -4
- data/lib/berkshelf/formatters/json.rb +21 -5
- data/lib/berkshelf/git.rb +4 -0
- data/lib/berkshelf/installer.rb +3 -1
- data/lib/berkshelf/locations/git_location.rb +22 -10
- data/lib/berkshelf/locations/github_location.rb +3 -7
- data/lib/berkshelf/locations/path_location.rb +0 -19
- data/lib/berkshelf/lockfile.rb +66 -4
- data/lib/berkshelf/mixin/logging.rb +1 -1
- data/lib/berkshelf/version.rb +1 -1
- data/spec/spec_helper.rb +8 -4
- data/spec/support/git.rb +9 -9
- data/spec/support/mercurial.rb +9 -9
- data/spec/unit/berkshelf/api_client_spec.rb +1 -1
- data/spec/unit/berkshelf/berksfile_spec.rb +36 -59
- data/spec/unit/berkshelf/cli_spec.rb +16 -0
- data/spec/unit/berkshelf/config_spec.rb +1 -1
- data/spec/unit/berkshelf/cookbook_generator_spec.rb +4 -6
- data/spec/unit/berkshelf/locations/git_location_spec.rb +1 -1
- data/spec/unit/berkshelf/lockfile_spec.rb +81 -2
- data/spec/unit/berkshelf/resolver/graph_spec.rb +1 -1
- data/spec/unit/berkshelf/ui_spec.rb +4 -4
- metadata +7 -7
- data/features/commands/configure.feature +0 -89
@@ -81,7 +81,7 @@ describe Berkshelf::GitLocation do
|
|
81
81
|
it 'raises a CookbookNotFound error' do
|
82
82
|
subject.stub(:clone).and_return {
|
83
83
|
FileUtils.mkdir_p(fake_remote)
|
84
|
-
Dir.chdir(fake_remote) { |dir| `git init
|
84
|
+
Dir.chdir(fake_remote) { |dir| `git init && echo hi > README && git add README && git commit README -m 'README'`; dir }
|
85
85
|
}
|
86
86
|
|
87
87
|
expect { subject.download }.to raise_error(Berkshelf::CookbookNotFound)
|
@@ -11,7 +11,7 @@ describe Berkshelf::Lockfile do
|
|
11
11
|
describe '.initialize' do
|
12
12
|
it 'does not throw an exception' do
|
13
13
|
expect {
|
14
|
-
Berkshelf::Lockfile.
|
14
|
+
Berkshelf::Lockfile.from_berksfile(berksfile)
|
15
15
|
}.to_not raise_error
|
16
16
|
end
|
17
17
|
|
@@ -21,7 +21,86 @@ describe Berkshelf::Lockfile do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
subject { Berkshelf::Lockfile.
|
24
|
+
subject { Berkshelf::Lockfile.from_berksfile(berksfile) }
|
25
|
+
|
26
|
+
describe "#apply" do
|
27
|
+
let(:env_name) { 'berkshelf-test' }
|
28
|
+
let(:server_url) { Berkshelf::RSpec::ChefServer.server_url }
|
29
|
+
let(:client_name) { 'berkshelf' }
|
30
|
+
let(:client_key) {
|
31
|
+
"-----BEGIN RSA PRIVATE KEY-----
|
32
|
+
MII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bAZ70Meb9UMtVIYpVBalutCXKhl7D4K
|
47
|
+
qrCmV2gQryBz+S7AecFZSKvXdb7ueYzf8EcI/v+loNu9v9/4m4YV3bPBkMhW5kcK
|
48
|
+
xFnVIsYqUlR+dsS8JfjSCpk4lePVSSt7B26eIFfTAoGBAJHPDKSuBWtunNe+RkUp
|
49
|
+
O9PgPeYlbBgqBxT52WS17tAfxXSyiySXzHSuchRtKgb4GDkvcw73+MLsqhRxG7lN
|
50
|
+
EDO4fXyb1IgWFdWxFVhh+j4IbUWE7HVBoAThF7Lq8SGjx7Nl3J/NTtKvDyKTw9Pg
|
51
|
+
+PTYJeLmUFuabCGjIlG4zYllAoGBAIwe5oB4597GEl35xUyI+M+B/myuTtknIpjS
|
52
|
+
mFFBL1bdwqnYjJ+KKgwhvRwsRBTjzT5O+BVBks45ogKwA5OBdzoUXB6GTG9mJ05V
|
53
|
+
wm/XqYRNqdgkGsEG5oV9IZBUrHLd80bOErVBr4nzzyo+GI98MvCRG8zySd+X+lEL
|
54
|
+
U8dJQZvjAoGAWorll+fomfie6t5XbkpwMo8rn60yFUiRE7HWxA2qDj3IpoE6SfNE
|
55
|
+
eOpsf1Zzx30r8answ9lPnd753ACdgNzE66ScWD+cQeB6OlMZMaW5tVSjddZ7854L
|
56
|
+
00znt8b1OLkVY33xfsa89wKH343304BhVHABPMxm5Leua/H21/BqSK0=
|
57
|
+
-----END RSA PRIVATE KEY-----
|
58
|
+
"
|
59
|
+
}
|
60
|
+
let(:ridley) { Ridley.new(server_url: server_url, client_name: client_name, client_key: client_key) }
|
61
|
+
|
62
|
+
before do
|
63
|
+
Berkshelf.stub(:ridley_connection).and_yield(ridley)
|
64
|
+
berksfile.add_dependency('nginx', '>= 0.1.2')
|
65
|
+
end
|
66
|
+
|
67
|
+
context "when the chef environment exists" do
|
68
|
+
let(:dependencies) do
|
69
|
+
[
|
70
|
+
double(name: 'nginx', locked_version: '1.2.3'),
|
71
|
+
double(name: 'artifact', locked_version: '1.4.0')
|
72
|
+
]
|
73
|
+
end
|
74
|
+
|
75
|
+
before do
|
76
|
+
chef_environment(env_name)
|
77
|
+
subject.stub(:dependencies).and_return(dependencies)
|
78
|
+
end
|
79
|
+
|
80
|
+
# it "test", focus: true do
|
81
|
+
# p client_key
|
82
|
+
# p File.read(client_key)
|
83
|
+
# # p ridley.environment.find(env_name)
|
84
|
+
# end
|
85
|
+
|
86
|
+
it "applys the locked_versions of the Lockfile dependencies to the given Chef environment" do
|
87
|
+
subject.apply(env_name)
|
88
|
+
|
89
|
+
environment = ::JSON.parse(chef_server.data_store.get(['environments', env_name]))
|
90
|
+
expect(environment['cookbook_versions']).to have(2).items
|
91
|
+
expect(environment['cookbook_versions']['nginx']).to eq('= 1.2.3')
|
92
|
+
expect(environment['cookbook_versions']['artifact']).to eq('= 1.4.0')
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
context "when the environment does not exist" do
|
97
|
+
it "raises an EnvironmentNotFound error" do
|
98
|
+
expect {
|
99
|
+
subject.apply("not-there")
|
100
|
+
}.to raise_error(Berkshelf::EnvironmentNotFound)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
25
104
|
|
26
105
|
describe '#dependencies' do
|
27
106
|
it 'returns an array' do
|
@@ -29,7 +29,7 @@ describe Thor::Base.shell do
|
|
29
29
|
subject.stub(:quiet?).and_return(true)
|
30
30
|
end
|
31
31
|
|
32
|
-
it 'does not output anything' do
|
32
|
+
it 'does not output anything', :not_supported_on_windows do
|
33
33
|
stdout.should_not_receive(:puts)
|
34
34
|
subject.say 'message'
|
35
35
|
end
|
@@ -66,7 +66,7 @@ describe Thor::Base.shell do
|
|
66
66
|
end
|
67
67
|
|
68
68
|
it 'prints to stdout' do
|
69
|
-
stdout.should_receive(:puts).with("\e[1m\e[32m 5\e[0m message")
|
69
|
+
stdout.should_receive(:puts).with(windows? ? " 5 message" : "\e[1m\e[32m 5\e[0m message")
|
70
70
|
stdout.should_receive(:flush).with(no_args())
|
71
71
|
subject.say_status 5, 'message'
|
72
72
|
end
|
@@ -112,7 +112,7 @@ describe Thor::Base.shell do
|
|
112
112
|
subject.stub(:quiet?).and_return(true)
|
113
113
|
end
|
114
114
|
|
115
|
-
it 'does not output anything' do
|
115
|
+
it 'does not output anything', :not_supported_on_windows do
|
116
116
|
stdout.should_not_receive(:puts)
|
117
117
|
subject.error 'error!'
|
118
118
|
end
|
@@ -124,7 +124,7 @@ describe Thor::Base.shell do
|
|
124
124
|
end
|
125
125
|
|
126
126
|
it 'prints to stderr' do
|
127
|
-
stderr.should_receive(:puts).with("\e[31merror!\e[0m")
|
127
|
+
stderr.should_receive(:puts).with(windows? ? "error!" : "\e[31merror!\e[0m")
|
128
128
|
subject.error 'error!'
|
129
129
|
end
|
130
130
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: berkshelf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.beta4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Winsor
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-
|
15
|
+
date: 2013-12-05 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: addressable
|
@@ -132,14 +132,14 @@ dependencies:
|
|
132
132
|
requirements:
|
133
133
|
- - ~>
|
134
134
|
- !ruby/object:Gem::Version
|
135
|
-
version: '
|
135
|
+
version: '2.3'
|
136
136
|
type: :runtime
|
137
137
|
prerelease: false
|
138
138
|
version_requirements: !ruby/object:Gem::Requirement
|
139
139
|
requirements:
|
140
140
|
- - ~>
|
141
141
|
- !ruby/object:Gem::Version
|
142
|
-
version: '
|
142
|
+
version: '2.3'
|
143
143
|
- !ruby/object:Gem::Dependency
|
144
144
|
name: solve
|
145
145
|
requirement: !ruby/object:Gem::Requirement
|
@@ -322,7 +322,6 @@ files:
|
|
322
322
|
- bin/berks
|
323
323
|
- features/berksfile.feature
|
324
324
|
- features/commands/apply.feature
|
325
|
-
- features/commands/configure.feature
|
326
325
|
- features/commands/contingent.feature
|
327
326
|
- features/commands/cookbook.feature
|
328
327
|
- features/commands/init.feature
|
@@ -450,6 +449,7 @@ files:
|
|
450
449
|
- spec/unit/berkshelf/api_client_spec.rb
|
451
450
|
- spec/unit/berkshelf/berksfile_spec.rb
|
452
451
|
- spec/unit/berkshelf/cached_cookbook_spec.rb
|
452
|
+
- spec/unit/berkshelf/cli_spec.rb
|
453
453
|
- spec/unit/berkshelf/community_rest_spec.rb
|
454
454
|
- spec/unit/berkshelf/config_spec.rb
|
455
455
|
- spec/unit/berkshelf/cookbook_generator_spec.rb
|
@@ -498,14 +498,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
498
498
|
version: 1.8.0
|
499
499
|
requirements: []
|
500
500
|
rubyforge_project:
|
501
|
-
rubygems_version: 2.0.
|
501
|
+
rubygems_version: 2.0.14
|
502
502
|
signing_key:
|
503
503
|
specification_version: 4
|
504
504
|
summary: Manages a Cookbook's, or an Application's, Cookbook dependencies
|
505
505
|
test_files:
|
506
506
|
- features/berksfile.feature
|
507
507
|
- features/commands/apply.feature
|
508
|
-
- features/commands/configure.feature
|
509
508
|
- features/commands/contingent.feature
|
510
509
|
- features/commands/cookbook.feature
|
511
510
|
- features/commands/init.feature
|
@@ -568,6 +567,7 @@ test_files:
|
|
568
567
|
- spec/unit/berkshelf/api_client_spec.rb
|
569
568
|
- spec/unit/berkshelf/berksfile_spec.rb
|
570
569
|
- spec/unit/berkshelf/cached_cookbook_spec.rb
|
570
|
+
- spec/unit/berkshelf/cli_spec.rb
|
571
571
|
- spec/unit/berkshelf/community_rest_spec.rb
|
572
572
|
- spec/unit/berkshelf/config_spec.rb
|
573
573
|
- spec/unit/berkshelf/cookbook_generator_spec.rb
|
@@ -1,89 +0,0 @@
|
|
1
|
-
@spawn
|
2
|
-
Feature: berks configure
|
3
|
-
Background:
|
4
|
-
* I do not have a Berkshelf config
|
5
|
-
|
6
|
-
Scenario: Using custom values
|
7
|
-
When I run `berks configure` interactively
|
8
|
-
And I type "https://api.opscode.com/organizations/vialstudios"
|
9
|
-
And I type "node_name"
|
10
|
-
And I type "client_key"
|
11
|
-
And I type "reset"
|
12
|
-
And I type "/Users/reset/.chef/reset.pem"
|
13
|
-
And I type "Berkshelf-minimal"
|
14
|
-
And I type "https://dl.dropbox.com/Berkshelf.box"
|
15
|
-
Then the output should contain:
|
16
|
-
"""
|
17
|
-
Config written to:
|
18
|
-
"""
|
19
|
-
And a Berkshelf config file should exist and contain:
|
20
|
-
| chef.chef_server_url | https://api.opscode.com/organizations/vialstudios |
|
21
|
-
| chef.validation_client_name | reset |
|
22
|
-
| chef.node_name | node_name |
|
23
|
-
| chef.client_key | client_key |
|
24
|
-
| chef.validation_key_path | /Users/reset/.chef/reset.pem |
|
25
|
-
| vagrant.vm.box | Berkshelf-minimal |
|
26
|
-
| vagrant.vm.box_url | https://dl.dropbox.com/Berkshelf.box |
|
27
|
-
|
28
|
-
|
29
|
-
Scenario: Accepting the default values
|
30
|
-
Given I do not have a Chef config
|
31
|
-
When I run `berks configure` interactively
|
32
|
-
And I type ""
|
33
|
-
And I type ""
|
34
|
-
And I type ""
|
35
|
-
And I type ""
|
36
|
-
And I type ""
|
37
|
-
And I type ""
|
38
|
-
And I type ""
|
39
|
-
Then the output should contain:
|
40
|
-
"""
|
41
|
-
Config written to:
|
42
|
-
"""
|
43
|
-
And a Berkshelf config file should exist and contain:
|
44
|
-
| chef.chef_server_url | http://localhost:4000 |
|
45
|
-
| chef.validation_client_name | chef-validator |
|
46
|
-
| chef.client_key | /etc/chef/client.pem |
|
47
|
-
| chef.validation_key_path | /etc/chef/validation.pem |
|
48
|
-
| vagrant.vm.box | opscode_ubuntu-12.04_provisionerless |
|
49
|
-
| vagrant.vm.box_url | https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box |
|
50
|
-
| vagrant.omnibus.enabled | BOOLEAN[true] |
|
51
|
-
| vagrant.omnibus.version | latest |
|
52
|
-
|
53
|
-
|
54
|
-
Scenario: Creating a Berkshelf configuration file when one already exists
|
55
|
-
Given I already have a Berkshelf config file
|
56
|
-
When I run `berks configure`
|
57
|
-
Then the output should contain:
|
58
|
-
"""
|
59
|
-
A configuration file already exists. Re-run with the --force flag if you wish to overwrite it.
|
60
|
-
"""
|
61
|
-
And the exit status should be "ConfigExists"
|
62
|
-
|
63
|
-
|
64
|
-
Scenario Outline: Using the --path option
|
65
|
-
When I run `berks configure --path <path>` interactively
|
66
|
-
And I type "https://api.opscode.com/organizations/vialstudios"
|
67
|
-
And I type "node_name"
|
68
|
-
And I type "client_key"
|
69
|
-
And I type "reset"
|
70
|
-
And I type "/Users/reset/.chef/reset.pem"
|
71
|
-
And I type "Berkshelf-minimal"
|
72
|
-
And I type "https://dl.dropbox.com/Berkshelf.box"
|
73
|
-
Then the output should contain:
|
74
|
-
"""
|
75
|
-
Config written to:
|
76
|
-
"""
|
77
|
-
And a Berkshelf config file should exist at "<path>" and contain:
|
78
|
-
| chef.chef_server_url | https://api.opscode.com/organizations/vialstudios |
|
79
|
-
| chef.validation_client_name | reset |
|
80
|
-
| chef.node_name | node_name |
|
81
|
-
| chef.client_key | client_key |
|
82
|
-
| chef.validation_key_path | /Users/reset/.chef/reset.pem |
|
83
|
-
| vagrant.vm.box | Berkshelf-minimal |
|
84
|
-
| vagrant.vm.box_url | https://dl.dropbox.com/Berkshelf.box |
|
85
|
-
|
86
|
-
Examples:
|
87
|
-
| path |
|
88
|
-
| .berkshelf/config.json |
|
89
|
-
| berkshelf/config.json |
|