polisher 0.10.2 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/binary_gem_resolver.rb +2 -2
- data/bin/bundler2yum.rb +51 -0
- data/bin/check_ruby_spec.rb +32 -0
- data/bin/gem_dependency_checker.rb +13 -242
- data/bin/gem_mapper.rb +27 -0
- data/bin/gems2update.rb +27 -0
- data/bin/git_gem_diff.rb +48 -0
- data/bin/git_gem_updater.rb +3 -3
- data/bin/missing_deps.rb +29 -0
- data/bin/polisher-config.rb +17 -0
- data/bin/ruby_rpm_spec_updater.rb +23 -2
- data/lib/polisher.rb +5 -12
- data/lib/polisher/adaptors/checker_loader.rb +78 -0
- data/lib/polisher/{upstream.rb → adaptors/upstream.rb} +1 -0
- data/lib/polisher/adaptors/version_checker.rb +57 -0
- data/lib/polisher/adaptors/version_checker/bodhi.rb +29 -0
- data/lib/polisher/adaptors/version_checker/errata.rb +29 -0
- data/lib/polisher/adaptors/version_checker/fedora.rb +29 -0
- data/lib/polisher/adaptors/version_checker/gem.rb +27 -0
- data/lib/polisher/adaptors/version_checker/git.rb +29 -0
- data/lib/polisher/adaptors/version_checker/koji.rb +29 -0
- data/lib/polisher/adaptors/version_checker/yum.rb +29 -0
- data/lib/polisher/cli/all.rb +22 -0
- data/lib/polisher/cli/bin/gem_dependency_checker.rb +85 -0
- data/lib/polisher/cli/bin/gem_mapper.rb +37 -0
- data/lib/polisher/cli/bin/gems2update.rb +86 -0
- data/lib/polisher/cli/bin/missing_deps.rb +35 -0
- data/lib/polisher/cli/conf.rb +18 -0
- data/lib/polisher/cli/default.rb +25 -0
- data/lib/polisher/cli/format.rb +130 -0
- data/lib/polisher/cli/sources.rb +106 -0
- data/lib/polisher/cli/specifier.rb +30 -0
- data/lib/polisher/cli/status.rb +50 -0
- data/lib/polisher/cli/targets.rb +88 -0
- data/lib/polisher/gem.rb +41 -338
- data/lib/polisher/gem/attributes.rb +20 -0
- data/lib/polisher/gem/dependencies.rb +63 -0
- data/lib/polisher/gem/diff.rb +39 -0
- data/lib/polisher/gem/files.rb +111 -0
- data/lib/polisher/gem/parser.rb +85 -0
- data/lib/polisher/gem/retriever.rb +137 -0
- data/lib/polisher/{gem_state.rb → gem/state.rb} +6 -6
- data/lib/polisher/gem/versions.rb +131 -0
- data/lib/polisher/gemfile.rb +20 -89
- data/lib/polisher/gemfile/attributes.rb +19 -0
- data/lib/polisher/gemfile/deps.rb +43 -0
- data/lib/polisher/gemfile/parser.rb +45 -0
- data/lib/polisher/git/pkg.rb +33 -238
- data/lib/polisher/git/pkg/attributes.rb +60 -0
- data/lib/polisher/git/pkg/builder.rb +47 -0
- data/lib/polisher/git/pkg/repo.rb +82 -0
- data/lib/polisher/git/pkg/updater.rb +53 -0
- data/lib/polisher/git/pkg/versions.rb +40 -0
- data/lib/polisher/git/project.rb +1 -1
- data/lib/polisher/git/repo.rb +79 -76
- data/lib/polisher/{vendor.rb → mixins/vendored_deps.rb} +4 -7
- data/lib/polisher/mixins/versioned_dependencies.rb +86 -0
- data/lib/polisher/record.rb +2 -0
- data/lib/polisher/rpm.rb +23 -0
- data/lib/polisher/rpm/patch.rb +10 -8
- data/lib/polisher/rpm/requirement.rb +33 -189
- data/lib/polisher/rpm/requirement/attributes.rb +43 -0
- data/lib/polisher/rpm/requirement/comparison.rb +97 -0
- data/lib/polisher/rpm/requirement/gem_reference.rb +46 -0
- data/lib/polisher/rpm/requirement/parser.rb +41 -0
- data/lib/polisher/rpm/spec.rb +97 -436
- data/lib/polisher/rpm/spec/check.rb +14 -0
- data/lib/polisher/rpm/spec/comparison.rb +64 -0
- data/lib/polisher/rpm/spec/files.rb +15 -0
- data/lib/polisher/rpm/spec/gem_files.rb +65 -0
- data/lib/polisher/rpm/spec/gem_reference.rb +59 -0
- data/lib/polisher/rpm/spec/gem_requirements.rb +73 -0
- data/lib/polisher/rpm/spec/parser.rb +106 -0
- data/lib/polisher/rpm/spec/requirements.rb +31 -0
- data/lib/polisher/rpm/spec/subpackages.rb +23 -0
- data/lib/polisher/rpm/spec/updater.rb +268 -0
- data/lib/polisher/specifier.rb +13 -0
- data/lib/polisher/targets.rb +36 -0
- data/lib/polisher/{apt.rb → targets/apt.rb} +1 -1
- data/lib/polisher/targets/bodhi.rb +43 -0
- data/lib/polisher/{bugzilla.rb → targets/bugzilla.rb} +1 -1
- data/lib/polisher/targets/errata.rb +55 -0
- data/lib/polisher/targets/errata/build.rb +24 -0
- data/lib/polisher/targets/fedora.rb +47 -0
- data/lib/polisher/targets/koji.rb +39 -0
- data/lib/polisher/targets/koji/builder.rb +38 -0
- data/lib/polisher/targets/koji/diff.rb +39 -0
- data/lib/polisher/targets/koji/rpc.rb +43 -0
- data/lib/polisher/targets/koji/versions.rb +67 -0
- data/lib/polisher/targets/rhn.rb +12 -0
- data/lib/polisher/targets/yum.rb +36 -0
- data/lib/polisher/{component.rb → util/component.rb} +3 -3
- data/lib/polisher/util/conf_helpers.rb +77 -0
- data/lib/polisher/util/config.rb +45 -0
- data/lib/polisher/util/core_ext.rb +59 -0
- data/lib/polisher/{error.rb → util/error.rb} +0 -0
- data/lib/polisher/{gem_cache.rb → util/gem_cache.rb} +1 -1
- data/lib/polisher/{git_cache.rb → util/git_cache.rb} +0 -0
- data/lib/polisher/{logger.rb → util/logger.rb} +2 -0
- data/lib/polisher/{tag_mapper.rb → util/tag_mapper.rb} +1 -1
- data/lib/polisher/version.rb +1 -1
- data/spec/{upstream_spec.rb → adaptors/upstream_spec.rb} +1 -1
- data/spec/{version_checker_spec.rb → adaptors/version_checker_spec.rb} +1 -6
- data/spec/data/activesupport-4.1.4.gem +0 -0
- data/spec/data/rubygem-activesupport-with-doc.spec +247 -0
- data/spec/data/rubygem-activesupport-without-requires.spec +232 -0
- data/spec/data/rubygem-activesupport.spec +0 -122
- data/spec/fixtures/gem_json.rb +49 -0
- data/spec/fixtures/gem_spec.rb +13 -0
- data/spec/fixtures/gemfile.rb +10 -0
- data/spec/fixtures/local_gem.rb +62 -0
- data/spec/fixtures/rpm_spec.rb +91 -0
- data/spec/gem/attributes_spec.rb +17 -0
- data/spec/gem/diff_spec.rb +80 -0
- data/spec/gem/files_spec.rb +171 -0
- data/spec/gem/parser_spec.rb +44 -0
- data/spec/gem/retriever_spec.rb +124 -0
- data/spec/gem/state_spec.rb +79 -0
- data/spec/gem/versions_spec.rb +148 -0
- data/spec/gem_spec.rb +5 -347
- data/spec/gemfile/deps_spec.rb +20 -0
- data/spec/gemfile/parser_spec.rb +26 -0
- data/spec/gemfile_spec.rb +0 -34
- data/spec/git/pkg/attributes_spec.rb +128 -0
- data/spec/git/pkg/builder_spec.rb +63 -0
- data/spec/git/pkg/repo_spec.rb +146 -0
- data/spec/git/pkg/updater_spec.rb +86 -0
- data/spec/git/pkg/versions_spec.rb +42 -0
- data/spec/git/pkg_spec.rb +21 -0
- data/spec/git/project_spec.rb +21 -0
- data/spec/git/repo_spec.rb +160 -0
- data/spec/{vendor_spec.rb → mixins/vendored_deps_spec.rb} +2 -4
- data/spec/mixins/versioned_dependencies_spec.rb +48 -0
- data/spec/rpm/patch_spec.rb +48 -0
- data/spec/rpm/requirement/attributes_spec.rb +34 -0
- data/spec/rpm/requirement/comparison_spec.rb +286 -0
- data/spec/rpm/requirement/gem_spec.rb +49 -0
- data/spec/rpm/requirement/parser_spec.rb +31 -0
- data/spec/rpm/requirement_spec.rb +8 -334
- data/spec/rpm/spec/check_spec.rb +25 -0
- data/spec/rpm/spec/comparison_spec.rb +55 -0
- data/spec/rpm/spec/files_spec.rb +17 -0
- data/spec/rpm/spec/gem_files_spec.rb +112 -0
- data/spec/rpm/spec/gem_reference_spec.rb +99 -0
- data/spec/rpm/spec/gem_requirement_spec.rb +38 -0
- data/spec/rpm/spec/parser_spec.rb +64 -0
- data/spec/rpm/spec/requirements_spec.rb +10 -0
- data/spec/rpm/spec/subpackages_spec.rb +38 -0
- data/spec/rpm/spec/updater_spec.rb +486 -0
- data/spec/rpm/spec_spec.rb +27 -174
- data/spec/spec_helper.rb +7 -107
- data/spec/support/coveralls.rb +10 -0
- data/spec/support/fixtures.rb +8 -0
- data/spec/support/paths.rb +20 -0
- data/spec/support/rspec.rb +20 -0
- data/spec/support/vcr.rb +11 -0
- data/spec/{bodhi_spec.rb → targets/bodhi_spec.rb} +3 -1
- data/spec/{errata_spec.rb → targets/errata_spec.rb} +2 -2
- data/spec/{fedora_spec.rb → targets/fedora_spec.rb} +3 -3
- data/spec/targets/koji/builder_spec.rb +48 -0
- data/spec/targets/koji/diff_spec.rb +36 -0
- data/spec/targets/koji/rpc_spec.rb +28 -0
- data/spec/{koji_spec.rb → targets/koji/versions_spec.rb} +1 -59
- data/spec/targets/koji_spec.rb +11 -0
- data/spec/{yum_spec.rb → targets/yum_spec.rb} +1 -1
- data/spec/{component_spec.rb → util/component_spec.rb} +1 -1
- data/spec/{core_spec.rb → util/core_ext_spec.rb} +2 -3
- metadata +278 -88
- data/lib/polisher/bodhi.rb +0 -23
- data/lib/polisher/config.rb +0 -32
- data/lib/polisher/core.rb +0 -101
- data/lib/polisher/errata.rb +0 -75
- data/lib/polisher/fedora.rb +0 -46
- data/lib/polisher/git.rb +0 -8
- data/lib/polisher/koji.rb +0 -159
- data/lib/polisher/rhn.rb +0 -15
- data/lib/polisher/version_checker.rb +0 -177
- data/lib/polisher/yum.rb +0 -37
- data/spec/git_spec.rb +0 -445
@@ -0,0 +1,49 @@
|
|
1
|
+
#
|
2
|
+
# Licensed under the MIT license
|
3
|
+
# Copyright (C) 2014 Red Hat, Inc.
|
4
|
+
|
5
|
+
require 'polisher/rpm/spec'
|
6
|
+
require 'polisher/rpm/requirement'
|
7
|
+
|
8
|
+
module Polisher::RPM
|
9
|
+
describe Requirement do
|
10
|
+
describe "::from_gem_dep" do
|
11
|
+
it "returns new requirements corresponding to gem dependency" do
|
12
|
+
dep = ::Gem::Dependency.new 'rails', '~> 4.0.0'
|
13
|
+
expected = [described_class.new(:name => 'rubygem(rails)',
|
14
|
+
:condition => '=>',
|
15
|
+
:version => '4.0.0'),
|
16
|
+
described_class.new(:name => 'rubygem(rails)',
|
17
|
+
:condition => '<',
|
18
|
+
:version => '4.1')]
|
19
|
+
described_class.from_gem_dep(dep).should == expected
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#gem?" do
|
24
|
+
context "requirement matches gem dep matcher" do
|
25
|
+
it "returns true" do
|
26
|
+
described_class.parse("rubygem(rails)").gem?.should be_true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context "requirement does not match gem dep matcher" do
|
31
|
+
it "returns false" do
|
32
|
+
described_class.parse("something").gem?.should be_false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "#gem_name" do
|
38
|
+
it "returns gem name" do
|
39
|
+
described_class.parse("rubygem(rails)").gem_name.should == "rails"
|
40
|
+
end
|
41
|
+
|
42
|
+
context "requirement is not a gem" do
|
43
|
+
it "returns nil" do
|
44
|
+
described_class.parse("something").gem_name.should be_nil
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end # describe Requirement
|
49
|
+
end # module Polisher::RPM
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#
|
2
|
+
# Licensed under the MIT license
|
3
|
+
# Copyright (C) 2014 Red Hat, Inc.
|
4
|
+
|
5
|
+
require 'polisher/rpm/requirement'
|
6
|
+
|
7
|
+
module Polisher::RPM
|
8
|
+
describe Requirement do
|
9
|
+
describe "#parse" do
|
10
|
+
it "parses requirement string" do
|
11
|
+
req = described_class.parse "Requires: rubygem(foo)"
|
12
|
+
req.br.should be_false
|
13
|
+
req.name.should == "rubygem(foo)"
|
14
|
+
req.gem_name.should == "foo"
|
15
|
+
req.condition.should be_nil
|
16
|
+
req.version.should be_nil
|
17
|
+
|
18
|
+
req = described_class.parse "BuildRequires: rubygem(foo)"
|
19
|
+
req.br.should be_true
|
20
|
+
|
21
|
+
req = described_class.parse "rubygem(rake)"
|
22
|
+
req.br.should be_false
|
23
|
+
req.name.should == "rubygem(rake)"
|
24
|
+
|
25
|
+
req = described_class.parse "rubygem(rake) < 5"
|
26
|
+
req.condition.should == "<"
|
27
|
+
req.version.should == "5"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end # describe Requirement
|
31
|
+
end # module Polisher::RPM
|
@@ -3,344 +3,18 @@
|
|
3
3
|
# Licensed under the MIT license
|
4
4
|
# Copyright (C) 2014 Red Hat, Inc.
|
5
5
|
|
6
|
-
require 'spec_helper'
|
7
|
-
|
8
6
|
require 'polisher/rpm/requirement'
|
9
|
-
require 'polisher/gem'
|
10
7
|
|
11
8
|
module Polisher::RPM
|
12
9
|
describe Requirement do
|
13
|
-
describe "#
|
14
|
-
it "
|
15
|
-
req = described_class.new :name
|
16
|
-
|
17
|
-
|
18
|
-
req
|
19
|
-
|
20
|
-
req.
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "#specifier" do
|
25
|
-
it "returns specifier in string format" do
|
26
|
-
req = described_class.new :condition => '>=', :version => '10.0'
|
27
|
-
req.specifier.should == '>= 10.0'
|
28
|
-
end
|
29
|
-
|
30
|
-
context "version is nil" do
|
31
|
-
it "returns nil" do
|
32
|
-
req = described_class.new
|
33
|
-
req.specifier.should be_nil
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "#parse" do
|
39
|
-
it "parses requirement string" do
|
40
|
-
req = described_class.parse "Requires: rubygem(foo)"
|
41
|
-
req.br.should be_false
|
42
|
-
req.name.should == "rubygem(foo)"
|
43
|
-
req.gem_name.should == "foo"
|
44
|
-
req.condition.should be_nil
|
45
|
-
req.version.should be_nil
|
46
|
-
|
47
|
-
req = described_class.parse "BuildRequires: rubygem(foo)"
|
48
|
-
req.br.should be_true
|
49
|
-
|
50
|
-
req = described_class.parse "rubygem(rake)"
|
51
|
-
req.br.should be_false
|
52
|
-
req.name.should == "rubygem(rake)"
|
53
|
-
|
54
|
-
req = described_class.parse "rubygem(rake) < 5"
|
55
|
-
req.condition.should == "<"
|
56
|
-
req.version.should == "5"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe "#gcd" do
|
61
|
-
it "selects / returns max version less than local version" do
|
62
|
-
req = described_class.new :version => "5.0.0"
|
63
|
-
req.gcd(['1.0', '2.0', '5.0', '5.1', '6.1']).should == '2.0'
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
describe "#min_satisfying_version" do
|
68
|
-
context "no version req" do
|
69
|
-
it "returns 0" do
|
70
|
-
req = described_class.new
|
71
|
-
req.min_satisfying_version.should == "0.0"
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
context "= req" do
|
76
|
-
it "returns local version" do
|
77
|
-
req = described_class.new :condition => '=', :version => '5.0.0'
|
78
|
-
req.min_satisfying_version.should == '5.0.0'
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
context "> req" do
|
83
|
-
it "returns next version" do
|
84
|
-
req = described_class.new :condition => '>', :version => '5.0.0'
|
85
|
-
req.min_satisfying_version.should == '5.0.1'
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
context ">= req" do
|
90
|
-
it "returns local version" do
|
91
|
-
req = described_class.new :condition => '>=', :version => '5.0.0'
|
92
|
-
req.min_satisfying_version.should == '5.0.0'
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
context "< req" do
|
97
|
-
it "returns 0" do
|
98
|
-
req = described_class.new :condition => '<', :version => '5.0.0'
|
99
|
-
req.min_satisfying_version.should == "0.0"
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
context "<= req" do
|
104
|
-
it "returns 0" do
|
105
|
-
req = described_class.new :condition => '<=', :version => '5.0.0'
|
106
|
-
req.min_satisfying_version.should == "0.0"
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
describe "#max_version_satisfying" do
|
112
|
-
context "no version req" do
|
113
|
-
it "returns infinity" do
|
114
|
-
req = described_class.new
|
115
|
-
req.max_satisfying_version.should == Float::INFINITY
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
context "= req" do
|
120
|
-
it "returns version" do
|
121
|
-
req = described_class.new :condition => '=', :version => '1.2.3'
|
122
|
-
req.max_satisfying_version.should == '1.2.3'
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
context "> req" do
|
127
|
-
it "returns infinity" do
|
128
|
-
req = described_class.new :condition => '>', :version => '1.2.3'
|
129
|
-
req.max_satisfying_version.should == Float::INFINITY
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
context ">= req" do
|
134
|
-
it "returns infinity" do
|
135
|
-
req = described_class.new :condition => '>=', :version => '1.2.3'
|
136
|
-
req.max_satisfying_version.should == Float::INFINITY
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
context "< req" do
|
141
|
-
context "versions list not specified" do
|
142
|
-
it "raises argument error" do
|
143
|
-
req = described_class.new :condition => '<', :version => '1.2.3'
|
144
|
-
lambda {
|
145
|
-
req.max_satisfying_version
|
146
|
-
}.should raise_error(ArgumentError)
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
it "returns gcd of list" do
|
151
|
-
req = described_class.new :condition => '<', :version => '1.2.3'
|
152
|
-
req.should_receive(:gcd).and_return('3')
|
153
|
-
req.max_satisfying_version(['1', '2']).should == '3'
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
context "<= req" do
|
158
|
-
it "returns version" do
|
159
|
-
req = described_class.new :condition => '<=', :version => '1.2.3'
|
160
|
-
req.max_satisfying_version.should == '1.2.3'
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
describe "#min_failing_version" do
|
166
|
-
context "no version req" do
|
167
|
-
it "raises argument error" do
|
168
|
-
req = described_class.new
|
169
|
-
lambda{
|
170
|
-
req.min_failing_version
|
171
|
-
}.should raise_error(ArgumentError)
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
context "= req" do
|
176
|
-
it "returns next version" do
|
177
|
-
req = described_class.new :condition => '=', :version => '5.0.0'
|
178
|
-
req.min_failing_version.should == '5.0.1'
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
context "> req" do
|
183
|
-
it "returns 0" do
|
184
|
-
req = described_class.new :condition => '>', :version => '5.0.0'
|
185
|
-
req.min_failing_version.should == '0.0'
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
context ">= req" do
|
190
|
-
it "returns 0" do
|
191
|
-
req = described_class.new :condition => '>=', :version => '5.0.0'
|
192
|
-
req.min_failing_version.should == '0.0'
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
context "< req" do
|
197
|
-
it "returns version" do
|
198
|
-
req = described_class.new :condition => '<', :version => '5.0.0'
|
199
|
-
req.min_failing_version.should == '5.0.0'
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
context "<= req" do
|
204
|
-
it "returns next version" do
|
205
|
-
req = described_class.new :condition => '<=', :version => '5.0.0'
|
206
|
-
req.min_failing_version.should == '5.0.1'
|
207
|
-
end
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
describe "#max_failing_version" do
|
212
|
-
context "no version req" do
|
213
|
-
it "raises argument error" do
|
214
|
-
req = described_class.new
|
215
|
-
lambda {
|
216
|
-
req.max_failing_version
|
217
|
-
}.should raise_error(ArgumentError)
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
context "= req" do
|
222
|
-
context "versions are nil" do
|
223
|
-
it "raises ArgumentError" do
|
224
|
-
req = described_class.new :condition => '=', :version => '2.0'
|
225
|
-
lambda {
|
226
|
-
req.max_failing_version
|
227
|
-
}.should raise_error(ArgumentError)
|
228
|
-
end
|
229
|
-
end
|
230
|
-
|
231
|
-
it "returns gcd of list" do
|
232
|
-
req = described_class.new :condition => '=', :version => '2.0'
|
233
|
-
req.should_receive(:gcd).and_return('abc')
|
234
|
-
req.max_failing_version(['1.2']).should == 'abc'
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
context "> req" do
|
239
|
-
it "returns version" do
|
240
|
-
req = described_class.new :condition => '>', :version => '2.0'
|
241
|
-
req.max_failing_version.should == '2.0'
|
242
|
-
end
|
243
|
-
end
|
244
|
-
|
245
|
-
context ">= req" do
|
246
|
-
context "versions are nil" do
|
247
|
-
it "raises ArgumentError" do
|
248
|
-
req = described_class.new :condition => '>=', :version => '2.0'
|
249
|
-
lambda {
|
250
|
-
req.max_failing_version
|
251
|
-
}.should raise_error(ArgumentError)
|
252
|
-
end
|
253
|
-
end
|
254
|
-
|
255
|
-
it "returns gcd of list" do
|
256
|
-
req = described_class.new :condition => '>=', :version => '2.0'
|
257
|
-
req.should_receive(:gcd).and_return('abc')
|
258
|
-
req.max_failing_version(['1.2']).should == 'abc'
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
|
-
context "< req" do
|
263
|
-
it "raises argument error" do
|
264
|
-
req = described_class.new :condition => '<', :version => '2.0'
|
265
|
-
lambda {
|
266
|
-
req.max_failing_version
|
267
|
-
}.should raise_error(ArgumentError)
|
268
|
-
end
|
269
|
-
end
|
270
|
-
|
271
|
-
context "<= req" do
|
272
|
-
it "raises argument error" do
|
273
|
-
req = described_class.new :condition => '<', :version => '2.0'
|
274
|
-
lambda {
|
275
|
-
req.max_failing_version
|
276
|
-
}.should raise_error(ArgumentError)
|
277
|
-
end
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
describe "#==" do
|
282
|
-
context "requirements are equal" do
|
283
|
-
it "returns true" do
|
284
|
-
req1 = described_class.new
|
285
|
-
req2 = described_class.new
|
286
|
-
req1.should == req2
|
287
|
-
|
288
|
-
req1 = described_class.parse 'rubygem(rails)'
|
289
|
-
req2 = described_class.parse 'rubygem(rails)'
|
290
|
-
req1.should == req2
|
291
|
-
|
292
|
-
req1 = described_class.parse 'rubygem(rails) >= 1.0.0'
|
293
|
-
req2 = described_class.parse 'rubygem(rails) >= 1.0.0'
|
294
|
-
req1.should == req2
|
295
|
-
end
|
296
|
-
end
|
297
|
-
|
298
|
-
context "requirements are not equal" do
|
299
|
-
it "returns true" do
|
300
|
-
req1 = described_class.parse 'rubygem(rails)'
|
301
|
-
req2 = described_class.parse 'rubygem(rake)'
|
302
|
-
req1.should_not == req2
|
303
|
-
|
304
|
-
req1 = described_class.parse 'rubygem(rake) > 1'
|
305
|
-
req2 = described_class.parse 'rubygem(rake) > 2'
|
306
|
-
req1.should_not == req2
|
307
|
-
end
|
308
|
-
end
|
309
|
-
end
|
310
|
-
|
311
|
-
describe "#matches?" do
|
312
|
-
context "requirement is same as dep requirement" do
|
313
|
-
it "returns true"
|
314
|
-
end
|
315
|
-
|
316
|
-
context "requirement is not same as dep requirement" do
|
317
|
-
it "returns false"
|
318
|
-
end
|
319
|
-
end
|
320
|
-
|
321
|
-
describe "#gem?" do
|
322
|
-
context "requirement matches gem dep matcher" do
|
323
|
-
it "returns true" do
|
324
|
-
described_class.parse("rubygem(rails)").gem?.should be_true
|
325
|
-
end
|
326
|
-
end
|
327
|
-
|
328
|
-
context "requirement does not match gem dep matcher" do
|
329
|
-
it "returns false" do
|
330
|
-
described_class.parse("something").gem?.should be_false
|
331
|
-
end
|
332
|
-
end
|
333
|
-
end
|
334
|
-
|
335
|
-
describe "#gem_name" do
|
336
|
-
it "returns gem name" do
|
337
|
-
described_class.parse("rubygem(rails)").gem_name.should == "rails"
|
338
|
-
end
|
339
|
-
|
340
|
-
context "requirement is not a gem" do
|
341
|
-
it "returns nil" do
|
342
|
-
described_class.parse("something").gem_name.should be_nil
|
343
|
-
end
|
10
|
+
describe "#initialize" do
|
11
|
+
it "sets requirement attributes" do
|
12
|
+
req = described_class.new :name => 'polisher ',
|
13
|
+
:condition => '>',
|
14
|
+
:version => '5.0'
|
15
|
+
req.name.should == 'polisher'
|
16
|
+
req.condition.should == '>'
|
17
|
+
req.version.should == '5.0'
|
344
18
|
end
|
345
19
|
end
|
346
20
|
end # describe Requirement
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#
|
2
|
+
# Licensed under the MIT license
|
3
|
+
# Copyright (C) 2014 Red Hat, Inc.
|
4
|
+
|
5
|
+
require 'polisher/rpm/spec'
|
6
|
+
|
7
|
+
module Polisher::RPM
|
8
|
+
describe Spec do
|
9
|
+
describe "#has_check?" do
|
10
|
+
context "package spec has %check section" do
|
11
|
+
it "returns true" do
|
12
|
+
spec = described_class.new :has_check => true
|
13
|
+
spec.has_check?.should be_true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "package spec does not have a %check section" do
|
18
|
+
it "returns false" do
|
19
|
+
spec = described_class.new
|
20
|
+
spec.has_check?.should be_false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end # describe Spec
|
25
|
+
end # module Polisher::RPM
|