maven-tools 0.29.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/MIT-LICENSE +20 -0
- data/README.md +1 -0
- data/lib/maven-tools.rb +1 -0
- data/lib/maven-tools.rb~ +1 -0
- data/lib/maven/jarfile.rb~ +77 -0
- data/lib/maven/maven_util.rb~ +56 -0
- data/lib/maven/model/dependencies.rb +230 -0
- data/lib/maven/model/dependencies.rb~ +247 -0
- data/lib/maven/model/model.rb +540 -0
- data/lib/maven/model/model.rb~ +528 -0
- data/lib/maven/model/model_utils.rb~ +832 -0
- data/lib/maven/model/utils.rb +343 -0
- data/lib/maven/model/utils.rb~ +322 -0
- data/lib/maven/tools/coordinate.rb +84 -0
- data/lib/maven/tools/coordinate.rb~ +81 -0
- data/lib/maven/tools/execute_in_phase.rb +9 -0
- data/lib/maven/tools/gem_project.rb +503 -0
- data/lib/maven/tools/gem_project.rb~ +498 -0
- data/lib/maven/tools/gemfile_lock.rb +70 -0
- data/lib/maven/tools/gemfile_lock.rb~ +67 -0
- data/lib/maven/tools/jarfile.rb +95 -0
- data/lib/maven/tools/jarfile.rb~ +79 -0
- data/lib/maven/tools/pom_generator.rb +63 -0
- data/lib/maven/tools/rails_project.rb +183 -0
- data/lib/maven/tools/version.rb +5 -0
- data/lib/maven/tools/versions.rb +15 -0
- data/lib/maven/tools/versions.rb~ +13 -0
- data/lib/maven_tools.rb +1 -0
- data/lib/maven_tools.rb~ +1 -0
- data/spec/coordinate_spec.rb +47 -0
- data/spec/jarfile_spec.rb +124 -0
- metadata +118 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Maven
|
|
2
|
+
module Tools
|
|
3
|
+
unless defined? VERSIONS
|
|
4
|
+
VERSIONS = {
|
|
5
|
+
:jetty_plugin => "7.6.4.v20120524",
|
|
6
|
+
:jruby_rack => "1.1.6",
|
|
7
|
+
:war_plugin => "2.2",
|
|
8
|
+
:jar_plugin => "2.4",
|
|
9
|
+
:jruby_plugins => "0.29.0",
|
|
10
|
+
:bundler_version => "1.1.4",
|
|
11
|
+
:jruby_version => defined?(JRUBY_VERSION) ? JRUBY_VERSION : "1.6.7.2"
|
|
12
|
+
}.freeze
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Maven
|
|
2
|
+
module Tools
|
|
3
|
+
VERSIONS = {
|
|
4
|
+
:jetty_plugin => "@jetty.version@",
|
|
5
|
+
:jruby_rack => "@jruby.rack.version@",
|
|
6
|
+
:war_plugin => "@war.version@",
|
|
7
|
+
:jar_plugin => "@jar.version@",
|
|
8
|
+
:jruby_plugins => "@project.version@",
|
|
9
|
+
:bundler_version => "@bundler.version@",
|
|
10
|
+
:jruby_version => defined?(JRUBY_VERSION) ? JRUBY_VERSION : "@jruby.version@"
|
|
11
|
+
}.freeze
|
|
12
|
+
end
|
|
13
|
+
end
|
data/lib/maven_tools.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'maven/tools/jarfile'
|
data/lib/maven_tools.rb~
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'maven_tools/jarfile'
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
require 'maven/tools/coordinate'
|
|
2
|
+
class A
|
|
3
|
+
include Maven::Tools::Coordinate
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
describe Maven::Tools::Coordinate do
|
|
7
|
+
|
|
8
|
+
subject { A.new }
|
|
9
|
+
|
|
10
|
+
it 'should convert ruby version to maven version ranges' do
|
|
11
|
+
subject.to_version.must_equal "[0,)"
|
|
12
|
+
subject.to_version('!2.3.4').must_equal "(2.3.4,)"
|
|
13
|
+
subject.to_version('=2.3.4').must_equal "[2.3.4,2.3.4.0.0.0.0.1)"
|
|
14
|
+
subject.to_version('~>1.8.2').must_equal "[1.8.2,1.8.99999]"
|
|
15
|
+
subject.to_version('~>1.8.2.beta').must_equal "[1.8.2.beta,1.8.99999]"
|
|
16
|
+
subject.to_version('~>1.8.2.beta123.12').must_equal "[1.8.2.beta123.12,1.8.99999]"
|
|
17
|
+
subject.to_version('~>1.8.2.1beta').must_equal "[1.8.2.1beta,1.8.99999]"
|
|
18
|
+
subject.to_version('~>1.8').must_equal "[1.8,1.99999]"
|
|
19
|
+
subject.to_version('>1.2').must_equal "(1.2,)"
|
|
20
|
+
subject.to_version('<1.2').must_equal "[0,1.2)"
|
|
21
|
+
subject.to_version('>=1.2').must_equal "[1.2,)"
|
|
22
|
+
subject.to_version('<=1.2').must_equal "[0,1.2]"
|
|
23
|
+
subject.to_version('>=1.2', '<2.0').must_equal "[1.2,2.0)"
|
|
24
|
+
subject.to_version('>=1.2', '<=2.0').must_equal "[1.2,2.0]"
|
|
25
|
+
subject.to_version('>1.2', '<2.0').must_equal "(1.2,2.0)"
|
|
26
|
+
subject.to_version('>1.2', '<=2.0').must_equal "(1.2,2.0]"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'should keep maven version and ranges as they are' do
|
|
30
|
+
subject.to_version('1.2.3').must_equal "1.2.3"
|
|
31
|
+
subject.to_version('(1,2)').must_equal "(1,2)"
|
|
32
|
+
subject.to_version('[1,2)').must_equal "[1,2)"
|
|
33
|
+
subject.to_version('(1,2]').must_equal "(1,2]"
|
|
34
|
+
subject.to_version('[1,2]').must_equal "[1,2]"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'should convert pom of jar deps to maven coordinate' do
|
|
38
|
+
subject.to_coordinate('something "a:b"').must_be_nil
|
|
39
|
+
subject.to_coordinate('#jar "a:b"').must_be_nil
|
|
40
|
+
subject.to_coordinate('jar "a:b" # bla').must_equal "a:b:jar:[0,)"
|
|
41
|
+
subject.to_coordinate("pom 'b:c', '!2.3.4'").must_equal "b:c:pom:(2.3.4,)"
|
|
42
|
+
subject.to_coordinate('jar "c:d", "2.3.4"').must_equal "c:d:jar:2.3.4"
|
|
43
|
+
subject.to_coordinate("jar 'd:e', '~>1.8.2'").must_equal "d:e:jar:[1.8.2,1.8.99999]"
|
|
44
|
+
subject.to_coordinate('pom "e:f", "[1.8,1.9.9)"').must_equal "e:f:pom:[1.8,1.9.9)"
|
|
45
|
+
subject.to_coordinate('pom "f:g", ">1.2", "<=2.0"').must_equal "f:g:pom:(1.2,2.0]"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
require 'maven/tools/jarfile'
|
|
2
|
+
|
|
3
|
+
class Container
|
|
4
|
+
|
|
5
|
+
attr_reader :artifacts, :repositories
|
|
6
|
+
|
|
7
|
+
def initialize
|
|
8
|
+
@artifacts = []
|
|
9
|
+
@repositories = []
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def add_artifact(a)
|
|
13
|
+
@artifacts << a
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def add_repository(name, url)
|
|
17
|
+
@repositories << name
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe Maven::Tools::Jarfile do
|
|
22
|
+
|
|
23
|
+
let(:workdir) { 'target' }
|
|
24
|
+
let(:jfile) { File.join(workdir, 'tmp-jarfile') }
|
|
25
|
+
let(:jfile_lock) { jfile + ".lock"}
|
|
26
|
+
let(:container) { Container.new }
|
|
27
|
+
subject { Maven::Tools::Jarfile.new(jfile) }
|
|
28
|
+
|
|
29
|
+
before do
|
|
30
|
+
FileUtils.mkdir_p workdir
|
|
31
|
+
Dir[File.join(workdir, "tmp*")].each { |f| FileUtils.rm_f f }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
after do
|
|
35
|
+
FileUtils.rm_rf(File.join(workdir, "tmp-*"))
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'generates lockfile' do
|
|
39
|
+
subject.generate_lockfile(%w( a b c d e f))
|
|
40
|
+
File.read(jfile_lock).must_equal <<-EOF
|
|
41
|
+
a
|
|
42
|
+
b
|
|
43
|
+
c
|
|
44
|
+
d
|
|
45
|
+
e
|
|
46
|
+
f
|
|
47
|
+
EOF
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'check locked coordinate' do
|
|
51
|
+
File.open(jfile_lock, 'w') do |f|
|
|
52
|
+
f.write <<-EOF
|
|
53
|
+
a:b:pom:3
|
|
54
|
+
a:c:jar:1
|
|
55
|
+
EOF
|
|
56
|
+
end
|
|
57
|
+
subject.locked.must_equal ["a:b:pom:3", "a:c:jar:1"]
|
|
58
|
+
subject.locked?("a:b:pom:321").must_equal true
|
|
59
|
+
subject.locked?("a:b:jar:321").must_equal true
|
|
60
|
+
subject.locked?("a:d:jar:432").must_equal false
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it 'populate repositories' do
|
|
64
|
+
File.open(jfile, 'w') do |f|
|
|
65
|
+
f.write <<-EOF
|
|
66
|
+
repository :first, "http://example.com/repo"
|
|
67
|
+
source 'second', "http://example.org/repo"
|
|
68
|
+
source "http://example.org/repo/3"
|
|
69
|
+
EOF
|
|
70
|
+
end
|
|
71
|
+
subject.populate_unlocked container
|
|
72
|
+
container.repositories.size.must_equal 3
|
|
73
|
+
container.artifacts.size.must_equal 0
|
|
74
|
+
container.repositories[0].must_equal "first"
|
|
75
|
+
container.repositories[1].must_equal "second"
|
|
76
|
+
container.repositories[2].must_equal "http://example.org/repo/3"
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
it 'populate artifacts without locked' do
|
|
80
|
+
File.open(jfile, 'w') do |f|
|
|
81
|
+
f.write <<-EOF
|
|
82
|
+
jar 'a:b', '123'
|
|
83
|
+
pom 'x:y', '987'
|
|
84
|
+
EOF
|
|
85
|
+
end
|
|
86
|
+
subject.populate_unlocked container
|
|
87
|
+
container.repositories.size.must_equal 0
|
|
88
|
+
container.artifacts.size.must_equal 2
|
|
89
|
+
container.artifacts[0].to_s.must_equal "a:b:jar:123"
|
|
90
|
+
container.artifacts[1].to_s.must_equal "x:y:pom:987"
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it 'populate artifacts with locked' do
|
|
94
|
+
File.open(jfile, 'w') do |f|
|
|
95
|
+
f.write <<-EOF
|
|
96
|
+
jar 'a:b', '123'
|
|
97
|
+
pom 'x:y', '987'
|
|
98
|
+
EOF
|
|
99
|
+
end
|
|
100
|
+
File.open(jfile_lock, 'w') do |f|
|
|
101
|
+
f.write <<-EOF
|
|
102
|
+
a:b:jar:432
|
|
103
|
+
EOF
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
subject.populate_unlocked container
|
|
107
|
+
container.repositories.size.must_equal 0
|
|
108
|
+
container.artifacts.size.must_equal 1
|
|
109
|
+
container.artifacts[0].to_s.must_equal "x:y:pom:987"
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
it 'populate locked artifacts' do
|
|
113
|
+
File.open(jfile_lock, 'w') do |f|
|
|
114
|
+
f.write <<-EOF
|
|
115
|
+
a:b:jar:432
|
|
116
|
+
EOF
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
subject.populate_locked container
|
|
120
|
+
container.repositories.size.must_equal 0
|
|
121
|
+
container.artifacts.size.must_equal 1
|
|
122
|
+
container.artifacts[0].to_s.must_equal "a:b:jar:432"
|
|
123
|
+
end
|
|
124
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: maven-tools
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
prerelease:
|
|
5
|
+
version: 0.29.0
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- Kristian Meier
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
|
|
13
|
+
date: 2012-06-08 00:00:00 Z
|
|
14
|
+
dependencies:
|
|
15
|
+
- !ruby/object:Gem::Dependency
|
|
16
|
+
name: rake
|
|
17
|
+
prerelease: false
|
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
19
|
+
none: false
|
|
20
|
+
requirements:
|
|
21
|
+
- - "="
|
|
22
|
+
- !ruby/object:Gem::Version
|
|
23
|
+
version: 0.9.2.2
|
|
24
|
+
type: :development
|
|
25
|
+
version_requirements: *id001
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: minitest
|
|
28
|
+
prerelease: false
|
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
30
|
+
none: false
|
|
31
|
+
requirements:
|
|
32
|
+
- - "="
|
|
33
|
+
- !ruby/object:Gem::Version
|
|
34
|
+
version: 2.10.0
|
|
35
|
+
type: :development
|
|
36
|
+
version_requirements: *id002
|
|
37
|
+
- !ruby/object:Gem::Dependency
|
|
38
|
+
name: rspec
|
|
39
|
+
prerelease: false
|
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
42
|
+
requirements:
|
|
43
|
+
- - "="
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: 2.7.0
|
|
46
|
+
type: :development
|
|
47
|
+
version_requirements: *id003
|
|
48
|
+
description: adds versions conversion from rubygems to maven and vice versa, ruby DSL for POM (Project Object Model from maven), pom generators, etc
|
|
49
|
+
email:
|
|
50
|
+
- m.kristian@web.de
|
|
51
|
+
executables: []
|
|
52
|
+
|
|
53
|
+
extensions: []
|
|
54
|
+
|
|
55
|
+
extra_rdoc_files: []
|
|
56
|
+
|
|
57
|
+
files:
|
|
58
|
+
- lib/maven_tools.rb
|
|
59
|
+
- lib/maven-tools.rb
|
|
60
|
+
- lib/maven-tools.rb~
|
|
61
|
+
- lib/maven_tools.rb~
|
|
62
|
+
- lib/maven/jarfile.rb~
|
|
63
|
+
- lib/maven/maven_util.rb~
|
|
64
|
+
- lib/maven/tools/coordinate.rb
|
|
65
|
+
- lib/maven/tools/execute_in_phase.rb
|
|
66
|
+
- lib/maven/tools/version.rb
|
|
67
|
+
- lib/maven/tools/jarfile.rb~
|
|
68
|
+
- lib/maven/tools/jarfile.rb
|
|
69
|
+
- lib/maven/tools/rails_project.rb
|
|
70
|
+
- lib/maven/tools/versions.rb~
|
|
71
|
+
- lib/maven/tools/gem_project.rb
|
|
72
|
+
- lib/maven/tools/gem_project.rb~
|
|
73
|
+
- lib/maven/tools/pom_generator.rb
|
|
74
|
+
- lib/maven/tools/gemfile_lock.rb~
|
|
75
|
+
- lib/maven/tools/gemfile_lock.rb
|
|
76
|
+
- lib/maven/tools/coordinate.rb~
|
|
77
|
+
- lib/maven/tools/versions.rb
|
|
78
|
+
- lib/maven/model/utils.rb
|
|
79
|
+
- lib/maven/model/dependencies.rb~
|
|
80
|
+
- lib/maven/model/model.rb
|
|
81
|
+
- lib/maven/model/dependencies.rb
|
|
82
|
+
- lib/maven/model/model_utils.rb~
|
|
83
|
+
- lib/maven/model/utils.rb~
|
|
84
|
+
- lib/maven/model/model.rb~
|
|
85
|
+
- spec/coordinate_spec.rb
|
|
86
|
+
- spec/jarfile_spec.rb
|
|
87
|
+
- MIT-LICENSE
|
|
88
|
+
- README.md
|
|
89
|
+
homepage: http://github.com/torquebox/maven-tools
|
|
90
|
+
licenses: []
|
|
91
|
+
|
|
92
|
+
post_install_message:
|
|
93
|
+
rdoc_options: []
|
|
94
|
+
|
|
95
|
+
require_paths:
|
|
96
|
+
- lib
|
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
|
+
none: false
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: "0"
|
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
|
+
none: false
|
|
105
|
+
requirements:
|
|
106
|
+
- - ">="
|
|
107
|
+
- !ruby/object:Gem::Version
|
|
108
|
+
version: "0"
|
|
109
|
+
requirements: []
|
|
110
|
+
|
|
111
|
+
rubyforge_project:
|
|
112
|
+
rubygems_version: 1.8.24
|
|
113
|
+
signing_key:
|
|
114
|
+
specification_version: 3
|
|
115
|
+
summary: helpers for maven related tasks
|
|
116
|
+
test_files:
|
|
117
|
+
- spec/coordinate_spec.rb
|
|
118
|
+
- spec/jarfile_spec.rb
|