cookbook-omnifetch 0.2.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +11 -0
- data/Gemfile +6 -1
- data/README.md +3 -4
- data/Rakefile +17 -0
- data/cookbook-omnifetch.gemspec +17 -17
- data/lib/cookbook-omnifetch.rb +3 -3
- data/lib/cookbook-omnifetch/artifactserver.rb +9 -26
- data/lib/cookbook-omnifetch/base.rb +1 -1
- data/lib/cookbook-omnifetch/chef_server.rb +108 -0
- data/lib/cookbook-omnifetch/exceptions.rb +3 -3
- data/lib/cookbook-omnifetch/git.rb +21 -21
- data/lib/cookbook-omnifetch/integration.rb +1 -2
- data/lib/cookbook-omnifetch/path.rb +3 -3
- data/lib/cookbook-omnifetch/version.rb +1 -1
- data/spec/fixtures/cookbooks/example_cookbook-0.5.0/metadata.rb +3 -3
- data/spec/fixtures/cookbooks/example_cookbook/metadata.rb +3 -3
- data/spec/spec_helper.rb +4 -5
- data/spec/unit/artifactserver_spec.rb +10 -9
- data/spec/unit/base_spec.rb +35 -35
- data/spec/unit/chef_server_spec.rb +75 -0
- data/spec/unit/exceptions_spec.rb +2 -2
- data/spec/unit/git_spec.rb +97 -98
- data/spec/unit/path_spec.rb +42 -42
- metadata +10 -6
data/spec/unit/path_spec.rb
CHANGED
@@ -1,116 +1,116 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "spec_helper"
|
2
|
+
require "cookbook-omnifetch/path"
|
3
3
|
|
4
4
|
module CookbookOmnifetch
|
5
5
|
describe PathLocation do
|
6
6
|
let(:relative_paths_root) { File.dirname(__FILE__) }
|
7
|
-
let(:constraint) { double(
|
7
|
+
let(:constraint) { double("constraint", satisfies?: true) }
|
8
8
|
let(:dependency) do
|
9
|
-
double(
|
10
|
-
name:
|
9
|
+
double("dependency",
|
10
|
+
name: "nginx",
|
11
11
|
version_constraint: constraint,
|
12
12
|
relative_paths_root: relative_paths_root
|
13
13
|
)
|
14
14
|
end
|
15
|
-
let(:path) { fixtures_path.join(
|
16
|
-
let(:relative_path) { Pathname.new(
|
15
|
+
let(:path) { fixtures_path.join("cookbooks", "example_cookbook") }
|
16
|
+
let(:relative_path) { Pathname.new("../fixtures/cookbooks/example_cookbook") }
|
17
17
|
|
18
18
|
subject { described_class.new(dependency, path: path) }
|
19
19
|
|
20
|
-
describe
|
21
|
-
it
|
20
|
+
describe "#installed?" do
|
21
|
+
it "returns false" do
|
22
22
|
expect(subject.installed?).to be false
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
describe
|
27
|
-
it
|
26
|
+
describe "#install" do
|
27
|
+
it "validates the cached cookbook" do
|
28
28
|
expect(subject).to receive(:validate_cached!).with(path)
|
29
29
|
subject.install
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
describe
|
34
|
-
it
|
33
|
+
describe "#cached_cookbook" do
|
34
|
+
it "loads the cached cookbook at the path" do
|
35
35
|
expect(MockCachedCookbook).to receive(:from_path).with(path)
|
36
36
|
subject.cached_cookbook
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
describe
|
41
|
-
it
|
40
|
+
describe "#relative_path" do
|
41
|
+
it "returns the path to the Berksfile" do
|
42
42
|
expect(subject.relative_path).to eq(relative_path)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
describe
|
47
|
-
it
|
46
|
+
describe "#expanded_path" do
|
47
|
+
it "returns the expanded path, relative to the Berksfile" do
|
48
48
|
absolute_path = Pathname.new(File.expand_path(relative_path, relative_paths_root))
|
49
49
|
expect(subject.expanded_path).to eq(absolute_path)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
describe
|
54
|
-
it
|
55
|
-
this = PathLocation.new(dependency, path:
|
56
|
-
that =
|
53
|
+
describe "#==" do
|
54
|
+
it "is false when compared with a non-PathLocation" do
|
55
|
+
this = PathLocation.new(dependency, path: ".")
|
56
|
+
that = "A string"
|
57
57
|
expect(this).to_not eq(that)
|
58
58
|
end
|
59
59
|
|
60
|
-
it
|
61
|
-
this = PathLocation.new(dependency, path:
|
62
|
-
that = PathLocation.new(dependency, path:
|
60
|
+
it "is false when the metadata? is not the same" do
|
61
|
+
this = PathLocation.new(dependency, path: ".")
|
62
|
+
that = PathLocation.new(dependency, path: ".", metadata: true)
|
63
63
|
expect(this).to_not eq(that)
|
64
64
|
end
|
65
65
|
|
66
|
-
it
|
67
|
-
this = PathLocation.new(dependency, path:
|
68
|
-
that = PathLocation.new(dependency, path:
|
66
|
+
it "is false when the expanded paths are different" do
|
67
|
+
this = PathLocation.new(dependency, path: ".")
|
68
|
+
that = PathLocation.new(dependency, path: "..")
|
69
69
|
expect(this).to_not eq(that)
|
70
70
|
end
|
71
71
|
|
72
|
-
it
|
73
|
-
this = PathLocation.new(dependency, path:
|
74
|
-
that = PathLocation.new(dependency, path:
|
72
|
+
it "is true when they are the same" do
|
73
|
+
this = PathLocation.new(dependency, path: ".", metadata: true)
|
74
|
+
that = PathLocation.new(dependency, path: ".", metadata: true)
|
75
75
|
expect(this).to eq(that)
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
describe
|
80
|
-
it
|
81
|
-
expect(subject.to_lock).to eq <<-EOH.gsub(/^ {10}/,
|
79
|
+
describe "#to_lock" do
|
80
|
+
it "includes the path relative to the Berksfile" do
|
81
|
+
expect(subject.to_lock).to eq <<-EOH.gsub(/^ {10}/, "")
|
82
82
|
path: #{relative_path}
|
83
83
|
EOH
|
84
84
|
end
|
85
85
|
|
86
|
-
it
|
86
|
+
it "includes the metadata attribute" do
|
87
87
|
subject.stub(:metadata?).and_return(true)
|
88
|
-
expect(subject.to_lock).to eq <<-EOH.gsub(/^ {10}/,
|
88
|
+
expect(subject.to_lock).to eq <<-EOH.gsub(/^ {10}/, "")
|
89
89
|
path: #{relative_path}
|
90
90
|
metadata: true
|
91
91
|
EOH
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
-
describe
|
96
|
-
it
|
95
|
+
describe "#lock_data" do
|
96
|
+
it "includes the path relative to the Berksfile" do
|
97
97
|
expect(subject.lock_data).to eq({ "path" => relative_path.to_s })
|
98
98
|
end
|
99
99
|
|
100
|
-
it
|
100
|
+
it "includes the metadata attribute" do
|
101
101
|
subject.stub(:metadata?).and_return(true)
|
102
102
|
expect(subject.lock_data).to eq({ "path" => relative_path.to_s, "metadata" => true })
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
-
describe
|
107
|
-
it
|
106
|
+
describe "#to_s" do
|
107
|
+
it "uses the relative path" do
|
108
108
|
expect(subject.to_s).to eq("source at #{relative_path}")
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
-
describe
|
113
|
-
it
|
112
|
+
describe "#inspect" do
|
113
|
+
it "includes the right information" do
|
114
114
|
subject.stub(:metadata?).and_return(true)
|
115
115
|
expect(subject.inspect).to eq("#<CookbookOmnifetch::PathLocation metadata: true, path: #{relative_path}>")
|
116
116
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cookbook-omnifetch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Winsor
|
@@ -13,22 +13,22 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2017-01-17 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
|
-
name:
|
19
|
+
name: mixlib-archive
|
20
20
|
requirement: !ruby/object:Gem::Requirement
|
21
21
|
requirements:
|
22
22
|
- - "~>"
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: 0.
|
24
|
+
version: '0.2'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
28
28
|
requirements:
|
29
29
|
- - "~>"
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
version: 0.
|
31
|
+
version: '0.2'
|
32
32
|
- !ruby/object:Gem::Dependency
|
33
33
|
name: rake
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,6 +71,7 @@ extra_rdoc_files: []
|
|
71
71
|
files:
|
72
72
|
- ".gitignore"
|
73
73
|
- ".rspec"
|
74
|
+
- ".travis.yml"
|
74
75
|
- Gemfile
|
75
76
|
- LICENSE
|
76
77
|
- README.md
|
@@ -79,6 +80,7 @@ files:
|
|
79
80
|
- lib/cookbook-omnifetch.rb
|
80
81
|
- lib/cookbook-omnifetch/artifactserver.rb
|
81
82
|
- lib/cookbook-omnifetch/base.rb
|
83
|
+
- lib/cookbook-omnifetch/chef_server.rb
|
82
84
|
- lib/cookbook-omnifetch/exceptions.rb
|
83
85
|
- lib/cookbook-omnifetch/git.rb
|
84
86
|
- lib/cookbook-omnifetch/github.rb
|
@@ -98,6 +100,7 @@ files:
|
|
98
100
|
- spec/spec_helper.rb
|
99
101
|
- spec/unit/artifactserver_spec.rb
|
100
102
|
- spec/unit/base_spec.rb
|
103
|
+
- spec/unit/chef_server_spec.rb
|
101
104
|
- spec/unit/exceptions_spec.rb
|
102
105
|
- spec/unit/git_spec.rb
|
103
106
|
- spec/unit/path_spec.rb
|
@@ -121,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
124
|
version: '0'
|
122
125
|
requirements: []
|
123
126
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.
|
127
|
+
rubygems_version: 2.5.1
|
125
128
|
signing_key:
|
126
129
|
specification_version: 4
|
127
130
|
summary: Library code to fetch Chef cookbooks from a variety of sources to a local
|
@@ -140,6 +143,7 @@ test_files:
|
|
140
143
|
- spec/spec_helper.rb
|
141
144
|
- spec/unit/artifactserver_spec.rb
|
142
145
|
- spec/unit/base_spec.rb
|
146
|
+
- spec/unit/chef_server_spec.rb
|
143
147
|
- spec/unit/exceptions_spec.rb
|
144
148
|
- spec/unit/git_spec.rb
|
145
149
|
- spec/unit/path_spec.rb
|