fpm-cookery 0.19.0 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.gitignore +1 -0
- data/.travis.yml +2 -2
- data/CHANGELOG.md +6 -0
- data/Rakefile +4 -7
- data/fpm-cookery.gemspec +1 -1
- data/lib/fpm/cookery/book.rb +1 -1
- data/lib/fpm/cookery/cli.rb +8 -1
- data/lib/fpm/cookery/config.rb +2 -1
- data/lib/fpm/cookery/package/package.rb +1 -0
- data/lib/fpm/cookery/recipe.rb +16 -8
- data/lib/fpm/cookery/version.rb +1 -1
- data/spec/config_spec.rb +48 -20
- data/spec/facts_spec.rb +11 -11
- data/spec/package_maintainer_spec.rb +22 -44
- data/spec/package_spec.rb +34 -26
- data/spec/package_version_spec.rb +20 -20
- data/spec/path_helper_spec.rb +19 -19
- data/spec/path_spec.rb +17 -17
- data/spec/recipe_spec.rb +95 -56
- data/spec/source_integrity_check_spec.rb +39 -52
- data/spec/source_spec.rb +7 -7
- data/spec/spec_helper.rb +11 -8
- metadata +23 -24
- data/.autotest +0 -21
@@ -2,175 +2,162 @@ require 'spec_helper'
|
|
2
2
|
require 'fpm/cookery/source_integrity_check'
|
3
3
|
require 'fpm/cookery/recipe'
|
4
4
|
|
5
|
-
class TestRecipe < FPM::Cookery::Recipe
|
6
|
-
source 'http://example.com/foo.tar.gz'
|
7
|
-
end
|
8
|
-
|
9
5
|
describe "SourceIntegrityCheck" do
|
10
|
-
let(:
|
6
|
+
let(:recipe_class) do
|
7
|
+
Class.new(FPM::Cookery::Recipe) {
|
8
|
+
source 'http://example.com/foo.tar.gz'
|
9
|
+
}
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:config) { double('Config').as_null_object }
|
13
|
+
let(:recipe) { recipe_class.new(__FILE__, config) }
|
11
14
|
let(:check) { FPM::Cookery::SourceIntegrityCheck.new(recipe) }
|
12
15
|
|
13
16
|
before do
|
14
|
-
recipe.
|
15
|
-
def local_path
|
16
|
-
fixture_path('test-source-1.0.tar.gz')
|
17
|
-
end
|
18
|
-
end
|
17
|
+
allow(recipe).to receive(:local_path).and_return(fixture_path('test-source-1.0.tar.gz'))
|
19
18
|
end
|
20
19
|
|
21
20
|
describe "without any checksum defined" do
|
22
21
|
describe "#error?" do
|
23
22
|
it "returns true" do
|
24
|
-
check.error
|
23
|
+
expect(check.error?).to eq(true)
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
28
27
|
describe "#checksum_missing?" do
|
29
28
|
it "returns true" do
|
30
|
-
check.checksum_missing
|
29
|
+
expect(check.checksum_missing?).to eq(true)
|
31
30
|
end
|
32
31
|
end
|
33
32
|
|
34
33
|
it "has checksum_expected set to nil" do
|
35
|
-
check.checksum_expected.
|
34
|
+
expect(check.checksum_expected).to eq(nil)
|
36
35
|
end
|
37
36
|
|
38
37
|
it "has checksum_actual set to the sha256 checksum" do
|
39
|
-
check.checksum_actual.
|
38
|
+
expect(check.checksum_actual).to eq('285a6b8098ecc9040ece8f621e37c20edba39545c5d195c4894f410ed9d44b22')
|
40
39
|
end
|
41
40
|
|
42
41
|
it "has filename set" do
|
43
|
-
check.filename.
|
42
|
+
expect(check.filename).to eq(fixture_path('test-source-1.0.tar.gz'))
|
44
43
|
end
|
45
44
|
|
46
45
|
it "has digest set to nil" do
|
47
|
-
check.digest.
|
46
|
+
expect(check.digest).to eq(:sha256)
|
48
47
|
end
|
49
48
|
end
|
50
49
|
|
51
50
|
describe "with a correct sha256 checksum defined" do
|
52
51
|
describe "#error?" do
|
53
52
|
it "returns false" do
|
54
|
-
|
55
|
-
'285a6b8098ecc9040ece8f621e37c20edba39545c5d195c4894f410ed9d44b22'
|
56
|
-
end
|
53
|
+
allow(recipe).to receive(:sha256).and_return('285a6b8098ecc9040ece8f621e37c20edba39545c5d195c4894f410ed9d44b22')
|
57
54
|
|
58
|
-
check.error
|
55
|
+
expect(check.error?).to eq(false)
|
59
56
|
end
|
60
57
|
end
|
61
58
|
end
|
62
59
|
|
63
60
|
describe "with a wrong sha256 checksum defined" do
|
64
61
|
before do
|
65
|
-
|
66
|
-
'xxxx6b8098ecc9040ece8f621e37c20edba39545c5d195c4894f410ed9d44b22'
|
67
|
-
end
|
62
|
+
allow(recipe).to receive(:sha256).and_return('xxxx6b8098ecc9040ece8f621e37c20edba39545c5d195c4894f410ed9d44b22')
|
68
63
|
end
|
69
64
|
|
70
65
|
describe "#error?" do
|
71
66
|
it "returns true" do
|
72
|
-
check.error
|
67
|
+
expect(check.error?).to eq(true)
|
73
68
|
end
|
74
69
|
end
|
75
70
|
|
76
71
|
it "has checksum_expected set to the expected checksum" do
|
77
|
-
check.checksum_expected.
|
72
|
+
expect(check.checksum_expected).to eq('xxxx6b8098ecc9040ece8f621e37c20edba39545c5d195c4894f410ed9d44b22')
|
78
73
|
end
|
79
74
|
|
80
75
|
it "has checksum_actual set to the actual checksum" do
|
81
|
-
check.checksum_actual.
|
76
|
+
expect(check.checksum_actual).to eq('285a6b8098ecc9040ece8f621e37c20edba39545c5d195c4894f410ed9d44b22')
|
82
77
|
end
|
83
78
|
|
84
79
|
it "has filename set" do
|
85
|
-
check.filename.
|
80
|
+
expect(check.filename).to eq(fixture_path('test-source-1.0.tar.gz'))
|
86
81
|
end
|
87
82
|
|
88
83
|
it "has digest set to :sha256" do
|
89
|
-
check.digest.
|
84
|
+
expect(check.digest).to eq(:sha256)
|
90
85
|
end
|
91
86
|
end
|
92
87
|
|
93
88
|
describe "with a correct sha1 checksum defined" do
|
94
89
|
describe "#error?" do
|
95
90
|
it "returns false" do
|
96
|
-
|
97
|
-
'dd4a8575c60f8122c30d21dfeed9f23f64948bf7'
|
98
|
-
end
|
91
|
+
allow(recipe).to receive(:sha1).and_return('dd4a8575c60f8122c30d21dfeed9f23f64948bf7')
|
99
92
|
|
100
|
-
check.error
|
93
|
+
expect(check.error?).to eq(false)
|
101
94
|
end
|
102
95
|
end
|
103
96
|
end
|
104
97
|
|
105
98
|
describe "with a wrong sha1 checksum defined" do
|
106
99
|
before do
|
107
|
-
|
108
|
-
'xxxx8575c60f8122c30d21dfeed9f23f64948bf7'
|
109
|
-
end
|
100
|
+
allow(recipe).to receive(:sha1).and_return('xxxx8575c60f8122c30d21dfeed9f23f64948bf7')
|
110
101
|
end
|
111
102
|
|
112
103
|
describe "#error?" do
|
113
104
|
it "returns true" do
|
114
|
-
check.error
|
105
|
+
expect(check.error?).to eq(true)
|
115
106
|
end
|
116
107
|
end
|
117
108
|
|
118
109
|
it "has checksum_expected set to the expected checksum" do
|
119
|
-
check.checksum_expected.
|
110
|
+
expect(check.checksum_expected).to eq('xxxx8575c60f8122c30d21dfeed9f23f64948bf7')
|
120
111
|
end
|
121
112
|
|
122
113
|
it "has checksum_actual set to the actual checksum" do
|
123
|
-
check.checksum_actual.
|
114
|
+
expect(check.checksum_actual).to eq('dd4a8575c60f8122c30d21dfeed9f23f64948bf7')
|
124
115
|
end
|
125
116
|
|
126
117
|
it "has filename set" do
|
127
|
-
check.filename.
|
118
|
+
expect(check.filename).to eq(fixture_path('test-source-1.0.tar.gz'))
|
128
119
|
end
|
129
120
|
|
130
121
|
it "has digest set to :sha1" do
|
131
|
-
check.digest.
|
122
|
+
expect(check.digest).to eq(:sha1)
|
132
123
|
end
|
133
124
|
end
|
134
125
|
|
135
126
|
describe "with a correct md5 checksum defined" do
|
136
127
|
describe "#error?" do
|
137
128
|
it "returns false" do
|
138
|
-
|
139
|
-
'd8f1330c3d1cec72287b88b2a6c1bc91'
|
140
|
-
end
|
129
|
+
allow(recipe).to receive(:md5).and_return('d8f1330c3d1cec72287b88b2a6c1bc91')
|
141
130
|
|
142
|
-
check.error
|
131
|
+
expect(check.error?).to eq(false)
|
143
132
|
end
|
144
133
|
end
|
145
134
|
end
|
146
135
|
|
147
136
|
describe "with a wrong md5 checksum defined" do
|
148
137
|
before do
|
149
|
-
|
150
|
-
'xxxx330c3d1cec72287b88b2a6c1bc91'
|
151
|
-
end
|
138
|
+
allow(recipe).to receive(:md5).and_return('xxxx330c3d1cec72287b88b2a6c1bc91')
|
152
139
|
end
|
153
140
|
|
154
141
|
describe "#error?" do
|
155
142
|
it "returns true" do
|
156
|
-
check.error
|
143
|
+
expect(check.error?).to eq(true)
|
157
144
|
end
|
158
145
|
end
|
159
146
|
|
160
147
|
it "has checksum_expected set to the expected checksum" do
|
161
|
-
check.checksum_expected.
|
148
|
+
expect(check.checksum_expected).to eq('xxxx330c3d1cec72287b88b2a6c1bc91')
|
162
149
|
end
|
163
150
|
|
164
151
|
it "has checksum_actual set to the actual checksum" do
|
165
|
-
check.checksum_actual.
|
152
|
+
expect(check.checksum_actual).to eq('d8f1330c3d1cec72287b88b2a6c1bc91')
|
166
153
|
end
|
167
154
|
|
168
155
|
it "has filename set" do
|
169
|
-
check.filename.
|
156
|
+
expect(check.filename).to eq(fixture_path('test-source-1.0.tar.gz'))
|
170
157
|
end
|
171
158
|
|
172
159
|
it "has digest set to :md5" do
|
173
|
-
check.digest.
|
160
|
+
expect(check.digest).to eq(:md5)
|
174
161
|
end
|
175
162
|
end
|
176
163
|
end
|
data/spec/source_spec.rb
CHANGED
@@ -7,7 +7,7 @@ describe "Source" do
|
|
7
7
|
it "returns true" do
|
8
8
|
source = FPM::Cookery::Source.new('http://example.com/', :with => :git)
|
9
9
|
|
10
|
-
source.provider
|
10
|
+
expect(source.provider?).to eq(true)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -15,7 +15,7 @@ describe "Source" do
|
|
15
15
|
it "returns false" do
|
16
16
|
source = FPM::Cookery::Source.new('http://example.com/')
|
17
17
|
|
18
|
-
source.provider
|
18
|
+
expect(source.provider?).to eq(false)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -25,7 +25,7 @@ describe "Source" do
|
|
25
25
|
it "returns true" do
|
26
26
|
source = FPM::Cookery::Source.new('file:///tmp')
|
27
27
|
|
28
|
-
source.local
|
28
|
+
expect(source.local?).to eq(true)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -33,7 +33,7 @@ describe "Source" do
|
|
33
33
|
it "returns false" do
|
34
34
|
source = FPM::Cookery::Source.new('https://www.example.com/')
|
35
35
|
|
36
|
-
source.local
|
36
|
+
expect(source.local?).to eq(false)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -42,7 +42,7 @@ describe "Source" do
|
|
42
42
|
it "returns the url path" do
|
43
43
|
source = FPM::Cookery::Source.new('file:///opt/src/foo')
|
44
44
|
|
45
|
-
source.path.
|
45
|
+
expect(source.path).to eq('/opt/src/foo')
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -50,8 +50,8 @@ describe "Source" do
|
|
50
50
|
it "can handle it" do
|
51
51
|
source = FPM::Cookery::Source.new('git@github.com:foo/bar.git')
|
52
52
|
|
53
|
-
source.url.
|
54
|
-
source.path.
|
53
|
+
expect(source.url).to eq('git@github.com:foo/bar.git')
|
54
|
+
expect(source.path).to eq('foo/bar.git')
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
RSpec.configure do |config|
|
2
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
3
|
+
config.run_all_when_everything_filtered = true
|
4
|
+
config.filter_run :focus
|
4
5
|
|
5
|
-
|
6
|
-
|
6
|
+
# Run specs in random order to surface order dependencies. If you find an
|
7
|
+
# order dependency and want to debug it, you can fix the order by providing
|
8
|
+
# the seed, which is printed after each run.
|
9
|
+
# --seed 1234
|
10
|
+
config.order = 'random'
|
7
11
|
end
|
8
12
|
|
9
|
-
|
10
|
-
|
11
|
-
alias_method :context, :describe
|
13
|
+
def fixture_path(file)
|
14
|
+
File.expand_path("../fixtures/#{file}", __FILE__)
|
12
15
|
end
|
metadata
CHANGED
@@ -1,111 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fpm-cookery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernd Ahlers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.14'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.14'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: fpm
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 1.0.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.0.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: facter
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: puppet
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: addressable
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: systemu
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
description: A tool for building software packages with fpm.
|
@@ -116,9 +116,8 @@ executables:
|
|
116
116
|
extensions: []
|
117
117
|
extra_rdoc_files: []
|
118
118
|
files:
|
119
|
-
- .
|
120
|
-
- .
|
121
|
-
- .travis.yml
|
119
|
+
- ".gitignore"
|
120
|
+
- ".travis.yml"
|
122
121
|
- CHANGELOG.md
|
123
122
|
- Gemfile
|
124
123
|
- LICENSE
|
@@ -219,12 +218,12 @@ require_paths:
|
|
219
218
|
- lib
|
220
219
|
required_ruby_version: !ruby/object:Gem::Requirement
|
221
220
|
requirements:
|
222
|
-
- -
|
221
|
+
- - ">="
|
223
222
|
- !ruby/object:Gem::Version
|
224
223
|
version: '0'
|
225
224
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
226
225
|
requirements:
|
227
|
-
- -
|
226
|
+
- - ">="
|
228
227
|
- !ruby/object:Gem::Version
|
229
228
|
version: '0'
|
230
229
|
requirements: []
|