ivy4r 0.9.12 → 0.9.13
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/History.txt +177 -172
- data/Rakefile +39 -34
- data/bin/ivy4r +3 -3
- data/lib/buildr/ivy_extension.rb +6 -2
- data/lib/ivy/target.rb +131 -128
- data/lib/ivy4r.rb +234 -234
- data/test/test_ivy4r.rb +196 -194
- metadata +2 -2
data/test/test_ivy4r.rb
CHANGED
@@ -1,194 +1,196 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__),'..','..','lib')
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'test/unit'
|
5
|
-
require 'ivy4r'
|
6
|
-
require 'antwrap'
|
7
|
-
require 'fileutils'
|
8
|
-
|
9
|
-
module Ivy
|
10
|
-
class Ivy4rTest < Test::Unit::TestCase
|
11
|
-
|
12
|
-
def setup
|
13
|
-
@ivy4r = Ivy4r.new
|
14
|
-
@ivy_test_xml = File.join(File.dirname(__FILE__), 'ivy', 'ivytest.xml')
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_ant_returns_default_wrapper
|
18
|
-
assert_not_nil @ivy4r.ant
|
19
|
-
assert_kind_of ::Antwrap::AntProject, @ivy4r.ant
|
20
|
-
assert_equal Dir.pwd, @ivy4r.ant.basedir
|
21
|
-
assert_equal true, @ivy4r.ant.declarative
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_ant_returns_always_same_instance
|
25
|
-
first = @ivy4r.ant
|
26
|
-
second = @ivy4r.ant
|
27
|
-
assert_same first, second
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_ant_returns_set_instance_if_provided
|
31
|
-
provided = "bla"
|
32
|
-
@ivy4r.ant = provided
|
33
|
-
@ivy4r.instance_eval("@init_done = true")
|
34
|
-
assert_equal provided, @ivy4r.ant
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_cleancache_returns_nil
|
38
|
-
result = @ivy4r.cleancache
|
39
|
-
|
40
|
-
assert_nil result
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_info_returns_values_for_file
|
44
|
-
result = @ivy4r.info :file => @ivy_test_xml
|
45
|
-
|
46
|
-
assert_not_nil result
|
47
|
-
assert_equal 'blau', result['ivy.organisation']
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_buildnumber_returns_infos
|
51
|
-
result = @ivy4r.buildnumber :organisation => 'oro', :module => 'oro'
|
52
|
-
|
53
|
-
assert_not_nil result
|
54
|
-
assert_equal '2.0.8', result['ivy.revision']
|
55
|
-
assert_equal '2.0.9', result['ivy.new.revision']
|
56
|
-
assert_equal '8', result['ivy.build.number']
|
57
|
-
assert_equal '9', result['ivy.new.build.number']
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_settings_returns_nil
|
61
|
-
result = @ivy4r.settings :file => File.join(File.dirname(__FILE__), 'ivy', 'ivysettings.xml')
|
62
|
-
|
63
|
-
assert_nil result
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_configure_returns_custom_properties
|
67
|
-
result = @ivy4r.configure :file => File.join(File.dirname(__FILE__), 'ivy', 'ivysettings.xml')
|
68
|
-
|
69
|
-
assert_not_nil result
|
70
|
-
assert_equal 'myvalue', result['myparam.ivy.instance']
|
71
|
-
end
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
assert_equal
|
173
|
-
|
174
|
-
assert_equal File.expand_path(File.join(target, "
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
#
|
191
|
-
#
|
192
|
-
#
|
193
|
-
|
194
|
-
end
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__),'..','..','lib')
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'test/unit'
|
5
|
+
require 'ivy4r'
|
6
|
+
require 'antwrap'
|
7
|
+
require 'fileutils'
|
8
|
+
|
9
|
+
module Ivy
|
10
|
+
class Ivy4rTest < Test::Unit::TestCase
|
11
|
+
|
12
|
+
def setup
|
13
|
+
@ivy4r = Ivy4r.new
|
14
|
+
@ivy_test_xml = File.join(File.dirname(__FILE__), 'ivy', 'ivytest.xml')
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_ant_returns_default_wrapper
|
18
|
+
assert_not_nil @ivy4r.ant
|
19
|
+
assert_kind_of ::Antwrap::AntProject, @ivy4r.ant
|
20
|
+
assert_equal Dir.pwd, @ivy4r.ant.basedir
|
21
|
+
assert_equal true, @ivy4r.ant.declarative
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_ant_returns_always_same_instance
|
25
|
+
first = @ivy4r.ant
|
26
|
+
second = @ivy4r.ant
|
27
|
+
assert_same first, second
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_ant_returns_set_instance_if_provided
|
31
|
+
provided = "bla"
|
32
|
+
@ivy4r.ant = provided
|
33
|
+
@ivy4r.instance_eval("@init_done = true")
|
34
|
+
assert_equal provided, @ivy4r.ant
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_cleancache_returns_nil
|
38
|
+
result = @ivy4r.cleancache
|
39
|
+
|
40
|
+
assert_nil result
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_info_returns_values_for_file
|
44
|
+
result = @ivy4r.info :file => @ivy_test_xml
|
45
|
+
|
46
|
+
assert_not_nil result
|
47
|
+
assert_equal 'blau', result['ivy.organisation']
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_buildnumber_returns_infos
|
51
|
+
result = @ivy4r.buildnumber :organisation => 'oro', :module => 'oro'
|
52
|
+
|
53
|
+
assert_not_nil result
|
54
|
+
assert_equal '2.0.8', result['ivy.revision']
|
55
|
+
assert_equal '2.0.9', result['ivy.new.revision']
|
56
|
+
assert_equal '8', result['ivy.build.number']
|
57
|
+
assert_equal '9', result['ivy.new.build.number']
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_settings_returns_nil
|
61
|
+
result = @ivy4r.settings :file => File.join(File.dirname(__FILE__), 'ivy', 'ivysettings.xml')
|
62
|
+
|
63
|
+
assert_nil result
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_configure_returns_custom_properties
|
67
|
+
result = @ivy4r.configure :file => File.join(File.dirname(__FILE__), 'ivy', 'ivysettings.xml')
|
68
|
+
|
69
|
+
assert_not_nil result
|
70
|
+
assert_equal 'myvalue', result['myparam.ivy.instance']
|
71
|
+
end
|
72
|
+
|
73
|
+
=begin
|
74
|
+
def test_property_setting_getting_to_from_ant
|
75
|
+
# use a java hashmap for testing!!
|
76
|
+
@ivy4r.instance_eval("def ant_properties;@ant_properties||=java.util.HashMap.new;end")
|
77
|
+
name, value = 'name', 'value'
|
78
|
+
@ivy4r.property[name] = value
|
79
|
+
|
80
|
+
assert_equal value, @ivy4r.property[name]
|
81
|
+
end
|
82
|
+
|
83
|
+
=end
|
84
|
+
def test_resolve_values_for_file
|
85
|
+
result = @ivy4r.resolve :file => @ivy_test_xml
|
86
|
+
|
87
|
+
assert_not_nil result
|
88
|
+
assert_equal 'blau', result['ivy.organisation']
|
89
|
+
assert_equal 4, result['ivy.resolved.configurations'].size, "has: #{result['ivy.resolved.configurations'].join(', ')}"
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_cachepath_using_previous_resolve_contains_jar
|
93
|
+
@ivy4r.resolve :organisation => "oro", :module => "oro", :revision => "2.0.8", :keep => true, :inline => true
|
94
|
+
result = @ivy4r.cachepath :pathid => 'mytestpathid'
|
95
|
+
|
96
|
+
assert_not_nil result
|
97
|
+
assert result.any? {|a| a =~ /.*oro.*\.jar/ && a =~ /.*2\.0\.8*/ }
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_cachepath_with_resolve_contains_jars
|
101
|
+
result = @ivy4r.cachepath :organisation => "oro", :module => "oro", :revision => "2.0.8", :inline => true, :pathid => 'mytestpathid'
|
102
|
+
|
103
|
+
assert_not_nil result
|
104
|
+
assert result.any? {|a| a =~ /.*oro.*\.jar/ && a =~ /.*2\.0\.8*/ }
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_findrevision_found_correct_version
|
108
|
+
result = @ivy4r.findrevision :organisation => "oro", :module => "oro", :revision => "2.0.8"
|
109
|
+
|
110
|
+
assert_equal '2.0.8', result
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_findrevision_not_found_nil
|
114
|
+
result = @ivy4r.findrevision :organisation => "oro", :module => "oro", :revision => "1unknown1"
|
115
|
+
|
116
|
+
assert_nil result
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_artifactproperty_deps_contained
|
120
|
+
@ivy4r.resolve :file => @ivy_test_xml
|
121
|
+
result = @ivy4r.artifactproperty :name => '[organisation]-[module]', :value => '[revision]'
|
122
|
+
|
123
|
+
assert_not_nil result
|
124
|
+
assert result.any? {|k,v| k == 'oro-oro' && v == '2.0.8' }
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_artifactreport_xml_returned
|
128
|
+
target = File.join(Dir.pwd, "temp_test#{Time.new.strftime('%Y%m%d%H%M%S')}")
|
129
|
+
FileUtils.mkdir(target)
|
130
|
+
@ivy4r.resolve :file => @ivy_test_xml
|
131
|
+
result = @ivy4r.artifactreport :tofile => File.join(target, 'test.xml')
|
132
|
+
|
133
|
+
assert_not_nil result
|
134
|
+
assert result =~ /.*<module organisation="oro".*/
|
135
|
+
ensure
|
136
|
+
FileUtils.rm_rf target
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_retrieve_created_dir_with_artifacts
|
140
|
+
target = File.join(Dir.pwd, "temp_test#{Time.new.strftime('%Y%m%d%H%M%S')}")
|
141
|
+
FileUtils.mkdir(target)
|
142
|
+
@ivy4r.resolve :file => @ivy_test_xml
|
143
|
+
result = @ivy4r.retrieve :pattern => "#{target}/[organisation]/[module].[ext]"
|
144
|
+
|
145
|
+
assert_nil result
|
146
|
+
assert Dir.glob(File.join(target, '**/oro.jar')).size > 0, "Contains the artifacts"
|
147
|
+
ensure
|
148
|
+
FileUtils.rm_rf target
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_report_created_reports
|
152
|
+
target = File.join(Dir.pwd, "temp_test#{Time.new.strftime('%Y%m%d%H%M%S')}")
|
153
|
+
FileUtils.mkdir(target)
|
154
|
+
@ivy4r.resolve :file => @ivy_test_xml
|
155
|
+
result = @ivy4r.report :todir => target
|
156
|
+
|
157
|
+
assert_nil result
|
158
|
+
assert Dir.glob(File.join(target, '**/*')).size > 0, "Contains the reports"
|
159
|
+
ensure
|
160
|
+
FileUtils.rm_rf target
|
161
|
+
end
|
162
|
+
|
163
|
+
def test_buildlist_correct_list
|
164
|
+
target = File.join(File.dirname(__FILE__), "buildlist")
|
165
|
+
result = @ivy4r.buildlist :reference => 'testpath', :nested => {
|
166
|
+
:fileset => [
|
167
|
+
{:dir => File.join(target, "sub"), :includes => '**/buildfile'},
|
168
|
+
{:dir => File.join(target, "p1"), :includes => 'buildfile'}
|
169
|
+
]
|
170
|
+
}
|
171
|
+
|
172
|
+
assert_equal 3, result.size
|
173
|
+
result.map! { |file| File.expand_path(file) }
|
174
|
+
assert_equal File.expand_path(File.join(target, "p1", "buildfile")), result[0]
|
175
|
+
assert_equal File.expand_path(File.join(target, "sub", "p2", "buildfile")), result[1]
|
176
|
+
assert_equal File.expand_path(File.join(target, "sub", "p3", "buildfile")), result[2]
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_makepom_returns_content
|
180
|
+
target = File.join(File.dirname(__FILE__), "testpom.xml")
|
181
|
+
result = @ivy4r.makepom :ivyfile => @ivy_test_xml, :pomfile => target, :nested => {
|
182
|
+
:mapping => {:conf => 'default', :scope => 'runtime' }
|
183
|
+
}
|
184
|
+
|
185
|
+
assert_equal IO.read(target), result
|
186
|
+
ensure
|
187
|
+
FileUtils.rm target
|
188
|
+
end
|
189
|
+
|
190
|
+
#def test_listmodules_lists_ivy_stuff
|
191
|
+
# result = @antwrap.listmodules :organisation => '*apache*', :module => '*ivy*', :revision => '2.*',
|
192
|
+
# :matcher => 'glob', :property => 'rums-[organisation][module]', :value => 'found'
|
193
|
+
# assert result.find {|k,v| k =~ /rums-/ && v == 'found'}, "found: #{result.inspect}"
|
194
|
+
#end
|
195
|
+
end
|
196
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ivy4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Klaas Prause
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-03-08 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|