berkshelf 1.3.1 → 1.4.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/berkshelf.gemspec +1 -1
- data/lib/berkshelf.rb +5 -12
- data/lib/berkshelf/berksfile.rb +104 -70
- data/lib/berkshelf/cached_cookbook.rb +1 -1
- data/lib/berkshelf/chef/cookbook/chefignore.rb +15 -0
- data/lib/berkshelf/cli.rb +19 -33
- data/lib/berkshelf/cookbook_source.rb +111 -27
- data/lib/berkshelf/errors.rb +3 -1
- data/lib/berkshelf/locations/git_location.rb +19 -0
- data/lib/berkshelf/locations/path_location.rb +2 -1
- data/lib/berkshelf/logger.rb +9 -0
- data/lib/berkshelf/mixin/logging.rb +18 -0
- data/lib/berkshelf/version.rb +1 -1
- data/spec/support/chef_api.rb +2 -2
- data/spec/unit/berkshelf/berksfile_spec.rb +275 -279
- data/spec/unit/berkshelf/chef/cookbook/chefignore_spec.rb +23 -0
- data/spec/unit/berkshelf/cookbook_source_spec.rb +32 -8
- data/spec/unit/berkshelf/locations/git_location_spec.rb +14 -0
- data/spec/unit/berkshelf/logger_spec.rb +29 -0
- data/spec/unit/berkshelf/mixin/logging_spec.rb +25 -0
- data/spec/unit/berkshelf_spec.rb +2 -2
- metadata +17 -12
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Berkshelf::Chef::Cookbook::Chefignore do
|
4
|
+
describe "ClassMethods" do
|
5
|
+
subject { described_class }
|
6
|
+
|
7
|
+
describe "::find_relative_to" do
|
8
|
+
let(:path) { tmp_path.join('chefignore-test') }
|
9
|
+
before(:each) { FileUtils.mkdir_p(path) }
|
10
|
+
|
11
|
+
it "finds a chefignore file in a 'cookbooks' directory relative to the given path" do
|
12
|
+
FileUtils.touch(path.join('chefignore'))
|
13
|
+
subject.find_relative_to(path)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "finds a chefignore file relative to the given path" do
|
17
|
+
FileUtils.mkdir_p(path.join('cookbooks'))
|
18
|
+
FileUtils.touch(path.join('cookbooks', 'chefignore'))
|
19
|
+
subject.find_relative_to(path)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -11,24 +11,48 @@ module Berkshelf
|
|
11
11
|
context "given no location key (i.e. :git, :path, :site)" do
|
12
12
|
let(:source) { subject.new(cookbook_name) }
|
13
13
|
|
14
|
-
it "sets a nil
|
14
|
+
it "sets a nil valie for location" do
|
15
15
|
source.location.should be_nil
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
context
|
19
|
+
context 'given no value for :locked_version' do
|
20
20
|
let(:source) { subject.new(cookbook_name) }
|
21
21
|
|
22
|
-
it
|
23
|
-
source.version_constraint.to_s.
|
22
|
+
it 'returns a wildcard match for any version' do
|
23
|
+
expect(source.version_constraint.to_s).to eq('>= 0.0.0')
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
context
|
28
|
-
let(:source) { subject.new(cookbook_name,
|
27
|
+
context 'given a value for :locked_version' do
|
28
|
+
let(:source) { subject.new(cookbook_name, locked_version: '1.2.3') }
|
29
29
|
|
30
|
-
it
|
31
|
-
source.version_constraint.to_s.
|
30
|
+
it 'returns the locked_version as the constraint' do
|
31
|
+
expect(source.version_constraint.to_s).to eq('= 1.2.3')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'given no value for :constraint' do
|
36
|
+
let(:source) { subject.new(cookbook_name) }
|
37
|
+
|
38
|
+
it 'returns a wildcard match for any version' do
|
39
|
+
expect(source.version_constraint.to_s).to eq('>= 0.0.0')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'given a value for :constraint' do
|
44
|
+
let(:source) { subject.new(cookbook_name, constraint: '~> 1.0.84') }
|
45
|
+
|
46
|
+
it 'returns a Solve::Constraint for the given version for version_constraint' do
|
47
|
+
expect(source.version_constraint.to_s).to eq('~> 1.0.84')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'given a value for :locked_version and :constraint' do
|
52
|
+
let(:source) { subject.new(cookbook_name, constraint: '~> 1.0.84', locked_version: '1.2.3') }
|
53
|
+
|
54
|
+
it 'uses the :locked_version' do
|
55
|
+
expect(source.version_constraint.to_s).to eq('= 1.2.3')
|
32
56
|
end
|
33
57
|
end
|
34
58
|
|
@@ -24,6 +24,20 @@ describe Berkshelf::GitLocation do
|
|
24
24
|
subject { described_class.new("nginx", complacent_constraint, git: "git://github.com/opscode-cookbooks/nginx.git") }
|
25
25
|
|
26
26
|
describe "#download" do
|
27
|
+
context "when a local revision is present" do
|
28
|
+
let(:cached) { double('cached') }
|
29
|
+
|
30
|
+
before do
|
31
|
+
Berkshelf::GitLocation.any_instance.stub(:cached?).and_return(true)
|
32
|
+
Berkshelf::GitLocation.any_instance.stub(:validate_cached).with(cached).and_return(cached)
|
33
|
+
Berkshelf::CachedCookbook.stub(:from_store_path).with(any_args()).and_return(cached)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "returns the cached cookbook" do
|
37
|
+
expect(subject.download(tmp_path)).to eq(cached)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
27
41
|
it "returns an instance of Berkshelf::CachedCookbook" do
|
28
42
|
subject.download(tmp_path).should be_a(Berkshelf::CachedCookbook)
|
29
43
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Berkshelf::Logger do
|
4
|
+
subject { described_class }
|
5
|
+
|
6
|
+
it "responds to :info" do
|
7
|
+
subject.should respond_to(:info)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "responds to :warn" do
|
11
|
+
subject.should respond_to(:warn)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "responds to :error" do
|
15
|
+
subject.should respond_to(:error)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "responds to :fatal" do
|
19
|
+
subject.should respond_to(:fatal)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "responds to :debug" do
|
23
|
+
subject.should respond_to(:debug)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "responds to :deprecate" do
|
27
|
+
subject.should respond_to(:deprecate)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Berkshelf::Mixin::Logging do
|
4
|
+
subject do
|
5
|
+
Class.new do
|
6
|
+
include Berkshelf::Mixin::Logging
|
7
|
+
end.new
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "#log" do
|
11
|
+
it "returns the Berkshelf::Logger" do
|
12
|
+
subject.log.should eql(Berkshelf::Logger)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#log_exception" do
|
17
|
+
it "logs the exception and it's backtrace as fatal" do
|
18
|
+
ex = Exception.new('msg')
|
19
|
+
ex.stub(:backtrace).and_return(['one', 'two'])
|
20
|
+
subject.log.should_receive(:fatal).exactly(2).times
|
21
|
+
|
22
|
+
subject.log_exception(ex)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/spec/unit/berkshelf_spec.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: berkshelf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.4.0.rc1
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jamie Winsor
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-03-
|
15
|
+
date: 2013-03-22 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: celluloid
|
@@ -115,17 +115,17 @@ dependencies:
|
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
|
-
- -
|
118
|
+
- - ~>
|
119
119
|
- !ruby/object:Gem::Version
|
120
|
-
version: 0.
|
120
|
+
version: 0.9.0
|
121
121
|
type: :runtime
|
122
122
|
prerelease: false
|
123
123
|
version_requirements: !ruby/object:Gem::Requirement
|
124
124
|
none: false
|
125
125
|
requirements:
|
126
|
-
- -
|
126
|
+
- - ~>
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
version: 0.
|
128
|
+
version: 0.9.0
|
129
129
|
- !ruby/object:Gem::Dependency
|
130
130
|
name: chozo
|
131
131
|
requirement: !ruby/object:Gem::Requirement
|
@@ -513,7 +513,9 @@ files:
|
|
513
513
|
- lib/berkshelf/locations/path_location.rb
|
514
514
|
- lib/berkshelf/locations/site_location.rb
|
515
515
|
- lib/berkshelf/lockfile.rb
|
516
|
+
- lib/berkshelf/logger.rb
|
516
517
|
- lib/berkshelf/mixin.rb
|
518
|
+
- lib/berkshelf/mixin/logging.rb
|
517
519
|
- lib/berkshelf/mixin/path_helpers.rb
|
518
520
|
- lib/berkshelf/resolver.rb
|
519
521
|
- lib/berkshelf/thor.rb
|
@@ -570,6 +572,7 @@ files:
|
|
570
572
|
- spec/support/test_generators.rb
|
571
573
|
- spec/unit/berkshelf/berksfile_spec.rb
|
572
574
|
- spec/unit/berkshelf/cached_cookbook_spec.rb
|
575
|
+
- spec/unit/berkshelf/chef/cookbook/chefignore_spec.rb
|
573
576
|
- spec/unit/berkshelf/community_rest_spec.rb
|
574
577
|
- spec/unit/berkshelf/config_spec.rb
|
575
578
|
- spec/unit/berkshelf/cookbook_generator_spec.rb
|
@@ -587,6 +590,8 @@ files:
|
|
587
590
|
- spec/unit/berkshelf/locations/path_location_spec.rb
|
588
591
|
- spec/unit/berkshelf/locations/site_location_spec.rb
|
589
592
|
- spec/unit/berkshelf/lockfile_spec.rb
|
593
|
+
- spec/unit/berkshelf/logger_spec.rb
|
594
|
+
- spec/unit/berkshelf/mixin/logging_spec.rb
|
590
595
|
- spec/unit/berkshelf/resolver_spec.rb
|
591
596
|
- spec/unit/berkshelf/ui_spec.rb
|
592
597
|
- spec/unit/berkshelf_spec.rb
|
@@ -607,12 +612,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
607
612
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
608
613
|
none: false
|
609
614
|
requirements:
|
610
|
-
- - ! '
|
615
|
+
- - ! '>'
|
611
616
|
- !ruby/object:Gem::Version
|
612
|
-
version:
|
613
|
-
segments:
|
614
|
-
- 0
|
615
|
-
hash: 1990198724109386499
|
617
|
+
version: 1.3.1
|
616
618
|
requirements: []
|
617
619
|
rubyforge_project:
|
618
620
|
rubygems_version: 1.8.24
|
@@ -694,6 +696,7 @@ test_files:
|
|
694
696
|
- spec/support/test_generators.rb
|
695
697
|
- spec/unit/berkshelf/berksfile_spec.rb
|
696
698
|
- spec/unit/berkshelf/cached_cookbook_spec.rb
|
699
|
+
- spec/unit/berkshelf/chef/cookbook/chefignore_spec.rb
|
697
700
|
- spec/unit/berkshelf/community_rest_spec.rb
|
698
701
|
- spec/unit/berkshelf/config_spec.rb
|
699
702
|
- spec/unit/berkshelf/cookbook_generator_spec.rb
|
@@ -711,6 +714,8 @@ test_files:
|
|
711
714
|
- spec/unit/berkshelf/locations/path_location_spec.rb
|
712
715
|
- spec/unit/berkshelf/locations/site_location_spec.rb
|
713
716
|
- spec/unit/berkshelf/lockfile_spec.rb
|
717
|
+
- spec/unit/berkshelf/logger_spec.rb
|
718
|
+
- spec/unit/berkshelf/mixin/logging_spec.rb
|
714
719
|
- spec/unit/berkshelf/resolver_spec.rb
|
715
720
|
- spec/unit/berkshelf/ui_spec.rb
|
716
721
|
- spec/unit/berkshelf_spec.rb
|