tetra 0.40.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -1
- data/Gemfile +2 -0
- data/Gemfile.lock +48 -0
- data/MOTIVATION.md +9 -3
- data/README.md +5 -5
- data/SPECIAL_CASES.md +1 -3
- data/integration-tests/{commons.sh → build-commons.sh} +26 -6
- data/integration-tests/build-obs.sh +21 -0
- data/lib/template/kit_item.spec +53 -0
- data/lib/template/package.spec +4 -2
- data/lib/tetra.rb +5 -3
- data/lib/tetra/archiver.rb +23 -87
- data/lib/tetra/commands/generate_all.rb +13 -16
- data/lib/tetra/commands/generate_kit_archive.rb +4 -4
- data/lib/tetra/commands/generate_kit_spec.rb +4 -2
- data/lib/tetra/commands/generate_package_archive.rb +1 -1
- data/lib/tetra/commands/generate_package_spec.rb +2 -2
- data/lib/tetra/git.rb +19 -10
- data/lib/tetra/glue_kit_item.rb +42 -0
- data/lib/tetra/jar_kit_item.rb +45 -0
- data/lib/tetra/kit.rb +73 -0
- data/lib/tetra/maven_kit_item.rb +64 -0
- data/lib/tetra/package.rb +82 -0
- data/lib/tetra/project.rb +26 -22
- data/lib/tetra/spec_generator.rb +38 -42
- data/lib/tetra/version.rb +1 -1
- data/spec/lib/archiver_spec.rb +30 -86
- data/spec/lib/git_spec.rb +8 -8
- data/spec/lib/glue_kit_item_spec.rb +31 -0
- data/spec/lib/kit_spec.rb +67 -0
- data/spec/lib/maven_kit_item_spec.rb +74 -0
- data/spec/lib/package_spec.rb +78 -0
- data/spec/lib/project_spec.rb +1 -1
- data/spec/lib/spec_generator_spec.rb +59 -87
- metadata +15 -8
- data/lib/template/kit.spec +0 -64
- data/lib/tetra/kit_spec_adapter.rb +0 -28
- data/lib/tetra/package_spec_adapter.rb +0 -59
- data/lib/tetra/template_manager.rb +0 -33
- data/spec/lib/template_manager_spec.rb +0 -54
@@ -0,0 +1,78 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
describe Tetra::Package do
|
6
|
+
before(:each) do
|
7
|
+
@project_path = File.join("spec", "data", "test-project")
|
8
|
+
Dir.mkdir(@project_path)
|
9
|
+
|
10
|
+
Tetra::Project.init(@project_path)
|
11
|
+
@project = Tetra::Project.new(@project_path)
|
12
|
+
|
13
|
+
@project.dry_run
|
14
|
+
Dir.chdir(@project_path) do
|
15
|
+
FileUtils.touch(File.join("kit", "jars", "test.jar"))
|
16
|
+
end
|
17
|
+
@project.finish(false)
|
18
|
+
|
19
|
+
@project.from_directory do
|
20
|
+
FileUtils.mkdir_p File.join("src", "test", "out")
|
21
|
+
(1..5).each do |i|
|
22
|
+
`touch src/test/test#{i}.java`
|
23
|
+
end
|
24
|
+
@project.dry_run
|
25
|
+
|
26
|
+
(1..5).each do |i|
|
27
|
+
`touch src/test/test#{i}.class`
|
28
|
+
end
|
29
|
+
|
30
|
+
(1..5).each do |i|
|
31
|
+
`touch src/test/out/test#{i}.jar`
|
32
|
+
end
|
33
|
+
|
34
|
+
@project.finish(false)
|
35
|
+
end
|
36
|
+
|
37
|
+
FileUtils.copy(File.join("spec", "data", "nailgun", "pom.xml"), @project_path)
|
38
|
+
|
39
|
+
@package = Tetra::Package.new(@project, "test", File.join(@project_path, "pom.xml"), "*.jar")
|
40
|
+
end
|
41
|
+
|
42
|
+
after(:each) do
|
43
|
+
FileUtils.rm_rf(@project_path)
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "#to_spec" do
|
47
|
+
it "generates the first version" do
|
48
|
+
@package.to_spec
|
49
|
+
|
50
|
+
@project.from_directory do
|
51
|
+
spec_lines = File.readlines(File.join("output", "test", "test.spec"))
|
52
|
+
expect(spec_lines).to include("Name: test\n")
|
53
|
+
expect(spec_lines).to include("License: The Apache Software License, Version 2.0\n")
|
54
|
+
expect(spec_lines).to include("Summary: Nailgun is a client, protocol, and server for running Java\n")
|
55
|
+
expect(spec_lines).to include("Url: http://martiansoftware.com/nailgun\n")
|
56
|
+
expect(spec_lines).to include("BuildRequires: tetra-jar(test.jar) == \
|
57
|
+
da39a3ee5e6b4b0d3255bfef95601890afd80709\n")
|
58
|
+
expect(spec_lines).to include("BuildRequires: tetra-glue == test-project-2\n")
|
59
|
+
expect(spec_lines).to include("Provides: mvn(com.martiansoftware:nailgun-all) == 0.9.1\n")
|
60
|
+
expect(spec_lines).to include("cp -a out/test3.jar %{buildroot}%{_javadir}/test3.jar\n")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "#to_archive" do
|
66
|
+
it "generates an archive" do
|
67
|
+
@project.from_directory("src") do
|
68
|
+
FileUtils.touch(File.join("test", "src_test"))
|
69
|
+
end
|
70
|
+
@project.finish(false)
|
71
|
+
|
72
|
+
@package.to_archive
|
73
|
+
@project.from_directory do
|
74
|
+
expect(`tar -Jtf output/test/test.tar.xz`.split).to include("src_test")
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
data/spec/lib/project_spec.rb
CHANGED
@@ -116,7 +116,7 @@ describe Tetra::Project do
|
|
116
116
|
@project.from_directory do
|
117
117
|
`touch kit/test`
|
118
118
|
|
119
|
-
@project.take_snapshot
|
119
|
+
@project.take_snapshot("test", :revertable)
|
120
120
|
|
121
121
|
expect(`git rev-list --all`.split("\n").length).to eq 2
|
122
122
|
expect(@project.latest_tag(:revertable)).to eq "revertable_1"
|
@@ -3,127 +3,99 @@
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
5
|
describe Tetra::SpecGenerator do
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
include Tetra::Mockers
|
7
|
+
|
8
|
+
# mock
|
9
|
+
class SpecGeneratorTestClass
|
10
|
+
attr_accessor :world_property
|
9
11
|
|
10
|
-
Tetra::
|
11
|
-
|
12
|
+
include Tetra::SpecGenerator
|
13
|
+
attr_reader :project
|
14
|
+
attr_reader :package_name
|
15
|
+
attr_reader :spec_dir
|
16
|
+
attr_reader :template_spec_name
|
12
17
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
18
|
+
def initialize(project)
|
19
|
+
@world_property = "World!"
|
20
|
+
|
21
|
+
@project = project
|
22
|
+
@package_name = "test-package"
|
23
|
+
@spec_dir = "kit"
|
24
|
+
@template_spec_name = "test.spec"
|
17
25
|
end
|
18
|
-
|
26
|
+
end
|
19
27
|
|
20
|
-
|
28
|
+
before(:each) do
|
29
|
+
create_mock_project
|
30
|
+
|
31
|
+
@template_path = File.join(instance.template_path, "test.spec")
|
32
|
+
File.open(@template_path, "w") { |io| io.puts "Hello <%= world_property %>\nintentionally blank line\n" }
|
33
|
+
|
34
|
+
@destination_path = File.join("output", instance.package_name, "#{instance.package_name}.spec")
|
21
35
|
end
|
22
36
|
|
37
|
+
let(:instance) { SpecGeneratorTestClass.new(@project) }
|
38
|
+
|
23
39
|
after(:each) do
|
24
|
-
|
40
|
+
delete_mock_project
|
41
|
+
FileUtils.rm_rf(@template_path)
|
25
42
|
end
|
26
43
|
|
27
|
-
describe "#
|
28
|
-
it "generates
|
29
|
-
expect(
|
44
|
+
describe "#to_spec" do
|
45
|
+
it "generates a first version" do
|
46
|
+
expect(instance.to_spec).to be_truthy
|
30
47
|
|
31
48
|
@project.from_directory do
|
32
|
-
spec_lines = File.readlines(
|
33
|
-
expect(spec_lines).to include("
|
34
|
-
expect(spec_lines).to include("Version: 1\n")
|
35
|
-
expect(spec_lines).to include("Source0: test-project-kit.tar.xz\n")
|
49
|
+
spec_lines = File.readlines(@destination_path)
|
50
|
+
expect(spec_lines).to include("Hello World!\n")
|
36
51
|
end
|
37
52
|
end
|
53
|
+
|
38
54
|
it "generates a second version" do
|
39
|
-
expect(
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
File.open(File.join("output", "test-project-kit", "test-project-kit.spec"), "a") do |io|
|
46
|
-
io.write("nonconflicting line")
|
55
|
+
expect(instance.to_spec).to be_truthy
|
56
|
+
|
57
|
+
@project.from_directory do
|
58
|
+
File.open(@destination_path, "a") do |io|
|
59
|
+
io.write("nonconflicting line\n")
|
47
60
|
end
|
48
61
|
end
|
49
|
-
@project.finish(false)
|
50
62
|
|
51
|
-
|
63
|
+
instance.world_property = "Mario!"
|
64
|
+
|
65
|
+
expect(instance.to_spec).to be_truthy
|
52
66
|
|
53
67
|
@project.from_directory do
|
54
|
-
spec_lines = File.readlines(
|
55
|
-
expect(spec_lines).
|
56
|
-
expect(spec_lines).to include("
|
57
|
-
expect(spec_lines).to include("Source0: test-project-kit.tar.xz\n")
|
68
|
+
spec_lines = File.readlines(@destination_path)
|
69
|
+
expect(spec_lines).not_to include("Hello World!\n")
|
70
|
+
expect(spec_lines).to include("Hello Mario!\n")
|
58
71
|
expect(spec_lines).to include("nonconflicting line\n")
|
59
72
|
end
|
60
73
|
end
|
61
|
-
it "generates a conflicting version" do
|
62
|
-
expect(@spec_generator.generate_kit_spec).to be_truthy
|
63
|
-
@project.dry_run
|
64
|
-
Dir.chdir(@project_path) do
|
65
|
-
test_file = File.join("kit", "test")
|
66
|
-
File.open(test_file, "w") { |io| io.puts "changed kit content test file" }
|
67
74
|
|
68
|
-
|
69
|
-
|
75
|
+
it "generates a conflicting version" do
|
76
|
+
expect(instance.to_spec).to be_truthy
|
70
77
|
|
71
|
-
|
78
|
+
@project.from_directory do
|
79
|
+
spec_contents = File.read(@destination_path)
|
80
|
+
spec_contents.gsub!(/Hello World/, "CONFLICTING!")
|
72
81
|
|
73
|
-
File.open(
|
82
|
+
File.open(@destination_path, "w+") do |io|
|
74
83
|
io.write(spec_contents)
|
75
84
|
end
|
76
85
|
end
|
77
|
-
@project.finish(false)
|
78
86
|
|
79
|
-
|
87
|
+
instance.world_property = "Mario!"
|
88
|
+
|
89
|
+
expect(instance.to_spec).to be_truthy
|
80
90
|
|
81
91
|
@project.from_directory do
|
82
|
-
spec_lines = File.readlines(
|
83
|
-
expect(spec_lines).to include("Name: test-project-kit\n")
|
84
|
-
expect(spec_lines).to include("Source0: test-project-kit.tar.xz\n")
|
92
|
+
spec_lines = File.readlines(@destination_path)
|
85
93
|
expect(spec_lines).to include("<<<<<<< newly generated\n")
|
86
|
-
expect(spec_lines).to include("
|
94
|
+
expect(spec_lines).to include("Hello Mario!\n")
|
87
95
|
expect(spec_lines).to include("=======\n")
|
88
|
-
expect(spec_lines).to include("CONFLICTING
|
96
|
+
expect(spec_lines).to include("CONFLICTING!!\n")
|
89
97
|
expect(spec_lines).to include(">>>>>>> user edited\n")
|
90
|
-
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
describe "#generate_package_spec" do
|
95
|
-
it "generates the first version" do
|
96
|
-
|
97
|
-
@project.from_directory do
|
98
|
-
FileUtils.mkdir_p File.join("src", "test", "out")
|
99
|
-
(1..5).each do |i|
|
100
|
-
`touch src/test/test#{i}.java`
|
101
|
-
end
|
102
|
-
@project.dry_run
|
103
|
-
|
104
|
-
(1..5).each do |i|
|
105
|
-
`touch src/test/test#{i}.class`
|
106
|
-
end
|
107
|
-
|
108
|
-
(1..5).each do |i|
|
109
|
-
`touch src/test/out/test#{i}.jar`
|
110
|
-
end
|
111
|
-
|
112
|
-
@project.finish(false)
|
113
|
-
end
|
114
|
-
|
115
|
-
FileUtils.copy(File.join("spec", "data", "nailgun", "pom.xml"), @project_path)
|
116
|
-
@spec_generator.generate_package_spec "test", File.join(@project_path, "pom.xml"), "*.jar"
|
117
|
-
|
118
|
-
@project.from_directory do
|
119
|
-
spec_lines = File.readlines(File.join("output", "test", "test.spec"))
|
120
|
-
expect(spec_lines).to include("Name: test\n")
|
121
|
-
expect(spec_lines).to include("License: The Apache Software License, Version 2.0\n")
|
122
|
-
expect(spec_lines).to include("Summary: Nailgun is a client, protocol, and server for running Java\n")
|
123
|
-
expect(spec_lines).to include("Url: http://martiansoftware.com/nailgun\n")
|
124
|
-
expect(spec_lines).to include("BuildRequires: #{@project.name}-kit >= 2\n")
|
125
|
-
expect(spec_lines).to include("Provides: mvn(com.martiansoftware:nailgun-all) == 0.9.1\n")
|
126
|
-
expect(spec_lines).to include("cp -a out/test3.jar %{buildroot}%{_javadir}/test3.jar\n")
|
98
|
+
expect(spec_lines).to include("intentionally blank line\n")
|
127
99
|
end
|
128
100
|
end
|
129
101
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tetra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.41.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-10-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -151,18 +151,20 @@ files:
|
|
151
151
|
- .gitignore
|
152
152
|
- .rubocop.yml
|
153
153
|
- Gemfile
|
154
|
+
- Gemfile.lock
|
154
155
|
- LICENSE
|
155
156
|
- MOTIVATION.md
|
156
157
|
- README.md
|
157
158
|
- Rakefile
|
158
159
|
- SPECIAL_CASES.md
|
159
160
|
- bin/tetra
|
160
|
-
- integration-tests/commons.sh
|
161
|
+
- integration-tests/build-commons.sh
|
162
|
+
- integration-tests/build-obs.sh
|
161
163
|
- lib/template/gitignore
|
162
|
-
- lib/template/kit.spec
|
163
164
|
- lib/template/kit/CONTENTS
|
164
165
|
- lib/template/kit/jars/CONTENTS
|
165
166
|
- lib/template/kit/m2/settings.xml
|
167
|
+
- lib/template/kit_item.spec
|
166
168
|
- lib/template/output/CONTENTS
|
167
169
|
- lib/template/package.spec
|
168
170
|
- lib/template/src/CONTENTS
|
@@ -187,21 +189,23 @@ files:
|
|
187
189
|
- lib/tetra/commands/move_jars_to_kit.rb
|
188
190
|
- lib/tetra/commands/mvn.rb
|
189
191
|
- lib/tetra/git.rb
|
192
|
+
- lib/tetra/glue_kit_item.rb
|
193
|
+
- lib/tetra/jar_kit_item.rb
|
194
|
+
- lib/tetra/kit.rb
|
190
195
|
- lib/tetra/kit_checker.rb
|
191
196
|
- lib/tetra/kit_runner.rb
|
192
|
-
- lib/tetra/kit_spec_adapter.rb
|
193
197
|
- lib/tetra/logger.rb
|
194
198
|
- lib/tetra/main.rb
|
199
|
+
- lib/tetra/maven_kit_item.rb
|
195
200
|
- lib/tetra/maven_runner.rb
|
196
201
|
- lib/tetra/maven_website.rb
|
197
|
-
- lib/tetra/
|
202
|
+
- lib/tetra/package.rb
|
198
203
|
- lib/tetra/pom.rb
|
199
204
|
- lib/tetra/pom_getter.rb
|
200
205
|
- lib/tetra/project.rb
|
201
206
|
- lib/tetra/script_generator.rb
|
202
207
|
- lib/tetra/source_getter.rb
|
203
208
|
- lib/tetra/spec_generator.rb
|
204
|
-
- lib/tetra/template_manager.rb
|
205
209
|
- lib/tetra/version.rb
|
206
210
|
- lib/tetra/version_matcher.rb
|
207
211
|
- spec/data/ant-super-simple-code/build.xml
|
@@ -223,16 +227,19 @@ files:
|
|
223
227
|
- spec/lib/ant_runner_spec.rb
|
224
228
|
- spec/lib/archiver_spec.rb
|
225
229
|
- spec/lib/git_spec.rb
|
230
|
+
- spec/lib/glue_kit_item_spec.rb
|
226
231
|
- spec/lib/kit_checker_spec.rb
|
232
|
+
- spec/lib/kit_spec.rb
|
233
|
+
- spec/lib/maven_kit_item_spec.rb
|
227
234
|
- spec/lib/maven_runner_spec.rb
|
228
235
|
- spec/lib/maven_website_spec.rb
|
236
|
+
- spec/lib/package_spec.rb
|
229
237
|
- spec/lib/pom_getter_spec.rb
|
230
238
|
- spec/lib/pom_spec.rb
|
231
239
|
- spec/lib/project_spec.rb
|
232
240
|
- spec/lib/script_generator_spec.rb
|
233
241
|
- spec/lib/source_getter_spec.rb
|
234
242
|
- spec/lib/spec_generator_spec.rb
|
235
|
-
- spec/lib/template_manager_spec.rb
|
236
243
|
- spec/lib/version_matcher_spec.rb
|
237
244
|
- spec/spec_helper.rb
|
238
245
|
- spec/support/kit_runner_examples.rb
|
data/lib/template/kit.spec
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# spec file for tetra kit for project "<%= name %>"
|
3
|
-
#
|
4
|
-
# Copyright (c) <%= Time.now.year %> <%= Etc.getlogin %>
|
5
|
-
#
|
6
|
-
# All modifications and additions to the file contributed by third parties
|
7
|
-
# remain the property of their copyright owners, unless otherwise agreed
|
8
|
-
# upon. The license for this file, and modifications and additions to the
|
9
|
-
# file, is the same license as for the pristine package itself (unless the
|
10
|
-
# license for the pristine package is not an Open Source License, in which
|
11
|
-
# case the license is the MIT License). An "Open Source License" is a
|
12
|
-
# license that conforms to the Open Source Definition (Version 1.9)
|
13
|
-
# published by the Open Source Initiative.
|
14
|
-
|
15
|
-
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
16
|
-
#
|
17
|
-
|
18
|
-
Name: <%= name %>-kit
|
19
|
-
Version: <%= version %>
|
20
|
-
Release: 1
|
21
|
-
License: Apache-2.0
|
22
|
-
Summary: Build-time dependencies for tetra project <%= name %>
|
23
|
-
Url: https://github.com/SilvioMoioli/tetra
|
24
|
-
Group: Development/Libraries/Java
|
25
|
-
<% archives.each_with_index do |archive, i| %>
|
26
|
-
Source<%= i %>: <%= archive %>
|
27
|
-
<% end %>
|
28
|
-
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
29
|
-
BuildArch: noarch
|
30
|
-
BuildRequires: xz
|
31
|
-
BuildRequires: fdupes
|
32
|
-
Provides: tetra(kit)
|
33
|
-
# no two kits should ever be installed at any given time
|
34
|
-
Conflicts: otherproviders(tetra(kit))
|
35
|
-
|
36
|
-
%description
|
37
|
-
This package has been automatically created by tetra in order to
|
38
|
-
satisfy build time dependencies of some Java packages. It should
|
39
|
-
not be used except for rebuilding those packages and it should never
|
40
|
-
be installed on end users' systems.
|
41
|
-
|
42
|
-
%prep
|
43
|
-
<% (0..(archives.length-1)).each do |i| %>
|
44
|
-
<% if i > 0 %>
|
45
|
-
%setup -q -c -T -D -b <%= i %>
|
46
|
-
<% else %>
|
47
|
-
%setup -q -c -T -b <%= i %>
|
48
|
-
<% end %>
|
49
|
-
<% end %>
|
50
|
-
|
51
|
-
%build
|
52
|
-
# nothing to do, tetra kits are precompiled by design
|
53
|
-
|
54
|
-
%install
|
55
|
-
export NO_BRP_CHECK_BYTECODE_VERSION=true
|
56
|
-
install -d -m 0755 %{buildroot}%{_datadir}/tetra/%{name}/
|
57
|
-
cp -a * %{buildroot}%{_datadir}/tetra/%{name}/
|
58
|
-
%fdupes -s %{buildroot}%{_datadir}/tetra/%{name}/
|
59
|
-
|
60
|
-
%files
|
61
|
-
%defattr(-,root,root)
|
62
|
-
%{_datadir}/tetra/
|
63
|
-
|
64
|
-
%changelog
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module Tetra
|
4
|
-
# encapsulates details of a kit needed by the spec file
|
5
|
-
# retrieving them from other objects
|
6
|
-
class KitSpecAdapter
|
7
|
-
attr_reader :name
|
8
|
-
attr_reader :version
|
9
|
-
attr_reader :archives
|
10
|
-
|
11
|
-
def initialize(project)
|
12
|
-
@name = project.name
|
13
|
-
@version = project.version
|
14
|
-
|
15
|
-
@archives =
|
16
|
-
project.from_directory do
|
17
|
-
["#{name}-kit.tar.xz"] +
|
18
|
-
Dir.entries("output/#{name}-kit")
|
19
|
-
.select { |f| f =~ /_[0-9]+.tar.xz$/ }
|
20
|
-
.sort
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def public_binding
|
25
|
-
binding
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|