tetra 0.44.0 → 0.45.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/SPECIAL_CASES.md CHANGED
@@ -35,12 +35,6 @@ You can also use:
35
35
 
36
36
  To get a list of jars that have one or more `.class` file which does not have a corresponding `.java` file in `kit/` (or zip files in `kit/`).
37
37
 
38
- ## Replacing kit packages
39
-
40
- After you built a package, you might want to use it instead of some binary packages to build other ones.
41
-
42
- `tetra` automatically creates some of the needed instructions inside of the spec file, you need to uncomment them and edit them manually to be fully functional.
43
-
44
38
  ## Ant builds
45
39
 
46
40
  `tetra` is currently optimized for Maven as it is the most common build tool, but it can work with any other. In particular, support for Ant has already been implemented and `tetra ant` works like `tetra mvn`.
@@ -37,9 +37,6 @@ Requires: java
37
37
  Requires: mvn(<%= dependency_id[0] %>:<%= dependency_id[1] %>) <% if dependency_id[3] != nil %>==<%= dependency_id[3] %><% end %>
38
38
  <% end %>
39
39
 
40
- # to use this package in other tetra builds, uncomment the following
41
- #Provides: tetra-mvn(<%= group_id %>:<%= artifact_id %>) == <%= version %>
42
-
43
40
  %description
44
41
  <%=
45
42
  description
@@ -61,14 +58,6 @@ mkdir -p %{buildroot}%{_javadir}
61
58
  cp -a <%= output %> %{buildroot}%{_javadir}/<%= File.basename(output) %>
62
59
  <% end %>
63
60
 
64
- # to use this package in other tetra builds, uncomment and edit appropriately
65
- #%define _kitdir %{_datadir}/tetra/m2/<%= group_id.gsub(".", "/") %>/<%= artifact_id %>/<%= version %>
66
- #mkdir -p %_kitdir
67
- <% outputs.each do |output| %>
68
- #ln -s %{buildroot}%{_javadir}/<%= File.basename(output) %> %_kitdir
69
- <% end %>
70
- #ln -s <pomfile> %_kitdir
71
-
72
61
  %files
73
62
  %defattr(-,root,root)
74
63
  <% outputs.each do |output| %>
@@ -19,9 +19,10 @@ module Tetra
19
19
  def initialize(project, path)
20
20
  _, name = Pathname.new(path).split
21
21
  hash = Digest::SHA1.file(path).hexdigest
22
+ short_hash = hash.slice(0, 5)
22
23
 
23
24
  @project = project
24
- @package_name = "kit-item-#{name.to_s.gsub(".", "-")}"
25
+ @package_name = "kit-item-#{name.to_s.gsub(".", "-")}-#{short_hash}"
25
26
  @conflicts = false
26
27
  @source_dir = File.join("kit", "jars")
27
28
  @source_paths = [path]
@@ -21,13 +21,15 @@ module Tetra
21
21
  rest, version = path_split(path)
22
22
  group_directory, artifact_id = path_split(rest)
23
23
  group_id = path_to_group(group_directory)
24
+ hash = Digest::SHA1.hexdigest(source_paths.to_s)
25
+ short_hash = hash.slice(0, 5)
24
26
 
25
27
  @project = project
26
- @package_name = "kit-item-#{group_id.gsub(".", "-")}-#{artifact_id}-#{version}"
28
+ @package_name = "kit-item-#{artifact_id}-#{short_hash}"
27
29
  @conflicts = false
28
30
 
29
- @provides_symbol = "tetra-mvn(#{group_id}:#{artifact_id})"
30
- @provides_version = version
31
+ @provides_symbol = "tetra-mvn(#{group_id}:#{artifact_id}:#{version})"
32
+ @provides_version = hash
31
33
  @install_dir = "m2"
32
34
 
33
35
  @source_dir = File.join("kit", "m2")
data/lib/tetra/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  # base module for tetra
4
4
  module Tetra
5
- VERSION = "0.44.0"
5
+ VERSION = "0.45.0"
6
6
  end
@@ -19,18 +19,20 @@ describe Tetra::MavenKitItem do
19
19
  let(:dir) { File.join(group_id.gsub(".", File::SEPARATOR), artifact_id, version) }
20
20
  let(:pom) { File.join(dir, "#{artifact_id}-#{version}.pom") }
21
21
  let(:jar) { File.join(dir, "#{artifact_id}.jar") }
22
- let(:package_name) { "kit-item-#{group_id.gsub(".", "-")}-#{artifact_id}-#{version}" }
22
+ let(:hash) { Digest::SHA1.hexdigest([pom, jar].to_s) }
23
+ let(:short_hash) { hash.slice(0, 5) }
24
+ let(:package_name) { "kit-item-#{artifact_id}-#{short_hash}" }
23
25
  let(:maven_kit_item) { Tetra::MavenKitItem.new(@project, pom, [pom, jar]) }
24
26
 
25
27
  describe "#provides_symbol" do
26
28
  it "returns the sepec Provides: symbol" do
27
- expect(maven_kit_item.provides_symbol).to eq("tetra-mvn(com.company.project:artifact)")
29
+ expect(maven_kit_item.provides_symbol).to eq("tetra-mvn(com.company.project:artifact:1.0)")
28
30
  end
29
31
  end
30
32
 
31
33
  describe "#provides_version" do
32
34
  it "returns the spec Provides: version" do
33
- expect(maven_kit_item.provides_version).to eq("1.0")
35
+ expect(maven_kit_item.provides_version).to eq(hash)
34
36
  end
35
37
  end
36
38
 
@@ -42,9 +44,9 @@ describe Tetra::MavenKitItem do
42
44
  spec_lines = File.readlines(File.join("packages", "kit", package_name, "#{package_name}.spec"))
43
45
 
44
46
  expect(spec_lines).to include("# spec file for a build-time dependency of project \"test-project\"\n")
45
- expect(spec_lines).to include("Name: kit-item-com-company-project-artifact-1.0\n")
47
+ expect(spec_lines).to include("Name: #{package_name}\n")
46
48
  expect(spec_lines).to include("Summary: Build-time dependency of project \"test-project\"\n")
47
- expect(spec_lines).to include("Provides: tetra-mvn(#{group_id}:#{artifact_id}) == #{version}\n")
49
+ expect(spec_lines).to include("Provides: tetra-mvn(#{group_id}:#{artifact_id}:#{version}) == #{hash}\n")
48
50
 
49
51
  expect(spec_lines).to include("install -d -m 0755 %{buildroot}%{_datadir}/tetra/m2\n")
50
52
  expect(spec_lines).to include("cp -a * %{buildroot}%{_datadir}/tetra/m2\n")
@@ -61,7 +63,7 @@ describe Tetra::MavenKitItem do
61
63
  FileUtils.touch(jar)
62
64
  end
63
65
 
64
- expected_filename = File::SEPARATOR + "kit-item-com-company-project-artifact-1.0.tar.xz"
66
+ expected_filename = File::SEPARATOR + "#{package_name}.tar.xz"
65
67
  expect(maven_kit_item.to_archive).to end_with(expected_filename)
66
68
 
67
69
  @project.from_directory do
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.44.0
4
+ version: 0.45.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-10-16 00:00:00.000000000 Z
12
+ date: 2014-10-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake