ivy4r 0.12.7 → 0.12.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +14 -0
- data/.rspec +2 -0
- data/CHANGELOG +5 -0
- data/Rakefile +2 -8
- data/autotest/discover.rb +1 -0
- data/ivy4r.gemspec +4 -3
- data/lib/buildr/ivy_extension.rb +1 -1
- data/lib/ivy4r/version.rb +1 -1
- data/spec/ivy/target_spec.rb +86 -0
- data/spec/ivy/targets_spec.rb +27 -0
- data/spec/ivy4r_spec.rb +50 -0
- data/spec/spec_helper.rb +10 -0
- data/{test-functional → spec_files}/buildlist/p1/buildfile +0 -0
- data/{test-functional → spec_files}/buildlist/p1/ivy.xml +0 -0
- data/{test-functional → spec_files}/buildlist/sub/p2/buildfile +0 -0
- data/{test-functional → spec_files}/buildlist/sub/p2/ivy.xml +0 -0
- data/{test-functional → spec_files}/buildlist/sub/p3/buildfile +0 -0
- data/{test-functional → spec_files}/buildlist/sub/p3/ivy.xml +0 -0
- data/{test-functional/ivy/ivytest.xml → spec_files/ivy.xml} +0 -0
- data/{test-functional/ivy → spec_files}/ivysettings.xml +0 -0
- data/spec_functional/ivy4r_spec.rb +131 -0
- metadata +47 -26
- data/test-functional/ivy/test_target.rb +0 -99
- data/test-functional/ivy/test_targets.rb +0 -34
- data/test-functional/test_ivy4r.rb +0 -196
data/.autotest
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
Bundler.require(:default, :development)
|
3
|
+
|
4
|
+
# see https://github.com/rspec/rspec/wiki/autotest
|
5
|
+
|
6
|
+
Autotest.add_hook(:initialize) {|at|
|
7
|
+
at.add_exception %r{^\.git} # ignore Version Control System
|
8
|
+
at.add_exception %r{^./tmp} # ignore temp files, lest autotest will run again, and again...
|
9
|
+
at.clear_mappings # take out the default (test/test*rb)
|
10
|
+
at.add_mapping(%r{^lib/.*\.rb$}) {|f, _|
|
11
|
+
Dir['spec*/**/*.rb']
|
12
|
+
}
|
13
|
+
nil
|
14
|
+
}
|
data/.rspec
ADDED
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
=== 0.12.8 / 2011-01-14
|
2
|
+
* Converted all tests to RSpec2 specs and grouped them according to functional and normal spec
|
3
|
+
* Started adding more specs to get a descent test coverage
|
4
|
+
* Fixed regression error on Ivy status for buildr, now the proc is used if given
|
5
|
+
|
1
6
|
=== 0.12.7 / 2011-01-06
|
2
7
|
* Fixed error in manifest: module was organisation name.
|
3
8
|
* info task uses the same ivy config as the other ivy tasks
|
data/Rakefile
CHANGED
@@ -2,6 +2,7 @@ require "rubygems"
|
|
2
2
|
require "bundler"
|
3
3
|
require "rake"
|
4
4
|
require "rake/testtask"
|
5
|
+
Bundler.require(:default, :development)
|
5
6
|
|
6
7
|
$:.unshift File.join(File.dirname(__FILE__),'lib')
|
7
8
|
require "ivy4r/version"
|
@@ -11,14 +12,7 @@ require "rspec/core/rake_task"
|
|
11
12
|
RSpec::Core::RakeTask.new :spec
|
12
13
|
#task :default => :spec
|
13
14
|
|
14
|
-
|
15
|
-
Rake::TestTask.new :test_functional do |t|
|
16
|
-
Bundler.require :development
|
17
|
-
t.test_files = FileList['test-functional/**/test*.rb']
|
18
|
-
t.verbose = true
|
19
|
-
end
|
20
|
-
|
21
|
-
task :build => :test_functional do
|
15
|
+
task :build do
|
22
16
|
system "gem build ivy4r.gemspec"
|
23
17
|
end
|
24
18
|
|
@@ -0,0 +1 @@
|
|
1
|
+
Autotest.add_discovery { "rspec2" }
|
data/ivy4r.gemspec
CHANGED
@@ -23,7 +23,8 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_dependency 'Antwrap', '>= 0.7.0'
|
24
24
|
s.add_dependency 'ivy4r-jars', '>= 1.2.0'
|
25
25
|
|
26
|
-
s.add_development_dependency '
|
27
|
-
s.add_development_dependency '
|
28
|
-
s.add_development_dependency '
|
26
|
+
s.add_development_dependency 'autotest', '>=4.4.6'
|
27
|
+
s.add_development_dependency 'ZenTest', '>=4.4.2'
|
28
|
+
s.add_development_dependency 'rspec', '>= 2.4.0'
|
29
|
+
s.add_development_dependency 'rr', '>=1.0.2'
|
29
30
|
end
|
data/lib/buildr/ivy_extension.rb
CHANGED
@@ -268,7 +268,7 @@ module Buildr
|
|
268
268
|
if @status_calc
|
269
269
|
@status ||= @status_calc.call(self)
|
270
270
|
else
|
271
|
-
@status
|
271
|
+
@status
|
272
272
|
end
|
273
273
|
elsif status.empty? && block.nil?
|
274
274
|
raise "status value invalid #{status.join(', ')}" unless status.size == 1
|
data/lib/ivy4r/version.rb
CHANGED
@@ -0,0 +1,86 @@
|
|
1
|
+
describe "Ivy::Target" do
|
2
|
+
|
3
|
+
before(:each) do
|
4
|
+
Ivy::Target.send(:public, :call_nested) # make tested method public
|
5
|
+
@ant = Object.new
|
6
|
+
@target = Ivy::Target.new(@ant)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "#call_nested(single data) should make correct calls" do
|
10
|
+
nested = {
|
11
|
+
:fileset => {
|
12
|
+
:includes => 'bla',
|
13
|
+
:excludes => 'blub',
|
14
|
+
:dir => 'anything'
|
15
|
+
}
|
16
|
+
}
|
17
|
+
mock(@ant).fileset(nested[:fileset])
|
18
|
+
|
19
|
+
@target.call_nested(nested)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "#call_nested(multi data) should make correct calls" do
|
23
|
+
nested = {
|
24
|
+
:fileset => {
|
25
|
+
:includes => 'bla',
|
26
|
+
:excludes => 'blub',
|
27
|
+
:dir => 'anything'
|
28
|
+
},
|
29
|
+
:other => {
|
30
|
+
:param => 'myparam'
|
31
|
+
}
|
32
|
+
}
|
33
|
+
mock(@ant).fileset nested[:fileset]
|
34
|
+
mock(@ant).other nested[:other]
|
35
|
+
|
36
|
+
@target.call_nested(nested)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "#call_nested(single data list) should make correct calls" do
|
40
|
+
nested = {
|
41
|
+
:fileset => [
|
42
|
+
{
|
43
|
+
:includes => 'bla',
|
44
|
+
:excludes => 'blub',
|
45
|
+
:dir => 'anything'
|
46
|
+
},
|
47
|
+
{
|
48
|
+
:includes => 'otherbla',
|
49
|
+
:excludes => 'otherblub',
|
50
|
+
:dir => 'otheranything'
|
51
|
+
}
|
52
|
+
]
|
53
|
+
}
|
54
|
+
mock(@ant).fileset nested[:fileset][0]
|
55
|
+
mock(@ant).fileset nested[:fileset][1]
|
56
|
+
|
57
|
+
@target.call_nested(nested)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "#call_nested(recursive data) should make correct calls" do
|
61
|
+
nested = {
|
62
|
+
:taskdef =>
|
63
|
+
{
|
64
|
+
:name => 'bla',
|
65
|
+
:nested => {
|
66
|
+
:fileset => {
|
67
|
+
:includes => 'bla',
|
68
|
+
:excludes => 'blub',
|
69
|
+
:dir => 'anything'}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
# define the method that yields if a block is given, to test the nested stuff
|
75
|
+
def @ant.taskdef(p)
|
76
|
+
raise "Invalid params to many" unless p.size == 1
|
77
|
+
raise "Wrong parameter value" unless 'bla' == p[:name]
|
78
|
+
raise "missing block for method" unless block_given?
|
79
|
+
yield
|
80
|
+
end
|
81
|
+
mock(@ant).fileset nested[:taskdef][:nested][:fileset]
|
82
|
+
|
83
|
+
@target.call_nested(nested)
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
describe "Ivy::Targets" do
|
2
|
+
|
3
|
+
before(:each) do
|
4
|
+
ivy4r = Ivy4r.new
|
5
|
+
@ivy_test_xml = File.join(File.dirname(__FILE__), '..', '..', 'spec_files', 'ivy.xml')
|
6
|
+
@info = Ivy::Info.new(ivy4r.ant)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "#execute with empty parameters missing mandatory error" do
|
10
|
+
lambda{ @info.execute({}) }.should raise_error(ArgumentError)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "#execute validate with unknown parameters error" do
|
14
|
+
lambda{ @info.execute(:unknown_parameter => 'unknown') }.should raise_error(ArgumentError)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "#execute simple file correct return values" do
|
18
|
+
result = @info.execute(:file => @ivy_test_xml)
|
19
|
+
|
20
|
+
result.should_not be nil
|
21
|
+
%w[ivy.organisation ivy.revision ivy.module].each do |var|
|
22
|
+
result.keys.should include(var)
|
23
|
+
end
|
24
|
+
result['ivy.organisation'].should eq('blau')
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/spec/ivy4r_spec.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
describe "::Ivy4r" do
|
2
|
+
|
3
|
+
before(:each) do
|
4
|
+
@ivy4r = Ivy4r.new
|
5
|
+
@ivy_xml = File.join(File.dirname(__FILE__), '..', 'spec_files', 'ivy.xml')
|
6
|
+
@ivy_settings_xml = File.join(File.dirname(__FILE__), '..', 'spec_files', 'ivysettings.xml')
|
7
|
+
end
|
8
|
+
|
9
|
+
it "#ant returns default AntWrapper" do
|
10
|
+
@ivy4r.ant.should_not be nil
|
11
|
+
@ivy4r.ant.should be_kind_of(::Antwrap::AntProject)
|
12
|
+
@ivy4r.ant.basedir.should eq(Dir.pwd)
|
13
|
+
@ivy4r.ant.declarative.should be true
|
14
|
+
end
|
15
|
+
|
16
|
+
it "#ant returns always same instance" do
|
17
|
+
@ivy4r.ant.should be @ivy4r.ant
|
18
|
+
end
|
19
|
+
|
20
|
+
it "#ant returns provided instance if set previously" do
|
21
|
+
provided = "bla"
|
22
|
+
@ivy4r.ant = provided
|
23
|
+
@ivy4r.instance_eval("@init_done = true")
|
24
|
+
@ivy4r.ant.should be provided
|
25
|
+
end
|
26
|
+
|
27
|
+
it "#cleancache returns nil" do
|
28
|
+
@ivy4r.cleancache.should be nil
|
29
|
+
end
|
30
|
+
|
31
|
+
it "#info returns data from used ivy.xml" do
|
32
|
+
result = @ivy4r.info :file => @ivy_xml
|
33
|
+
|
34
|
+
result.should_not be nil
|
35
|
+
result['ivy.organisation'].should eq('blau')
|
36
|
+
result['ivy.module'].should eq('testmodule')
|
37
|
+
result['ivy.revision'].should eq('2.20.0')
|
38
|
+
end
|
39
|
+
|
40
|
+
it "#settings returns nil" do
|
41
|
+
@ivy4r.settings(:file => @ivy_settings_xml).should be nil
|
42
|
+
end
|
43
|
+
|
44
|
+
it "#configure returns custom properties" do
|
45
|
+
result = @ivy4r.configure(:file => @ivy_settings_xml)
|
46
|
+
|
47
|
+
result.should_not be nil
|
48
|
+
result['myparam.ivy.instance'].should eq('myvalue')
|
49
|
+
end
|
50
|
+
end
|
data/spec/spec_helper.rb
ADDED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,131 @@
|
|
1
|
+
describe "Test Functional ::Ivy4r" do
|
2
|
+
|
3
|
+
before(:each) do
|
4
|
+
@ivy4r = Ivy4r.new
|
5
|
+
spec_files = File.join(File.dirname(__FILE__), '..', 'spec_files')
|
6
|
+
@ivy_xml = File.join(spec_files, 'ivy.xml')
|
7
|
+
@ivy_settings_xml = File.join(spec_files, 'ivysettings.xml')
|
8
|
+
@buildlist_dir = File.join(spec_files, 'buildlist')
|
9
|
+
end
|
10
|
+
|
11
|
+
it "#buildnumber returns next version" do
|
12
|
+
result = @ivy4r.buildnumber :organisation => 'oro', :module => 'oro'
|
13
|
+
|
14
|
+
result.should_not be nil
|
15
|
+
result['ivy.revision'].should eq('2.0.8')
|
16
|
+
result['ivy.new.revision'].should eq('2.0.9')
|
17
|
+
result['ivy.build.number'].should eq('8')
|
18
|
+
result['ivy.new.build.number'].should eq('9')
|
19
|
+
end
|
20
|
+
|
21
|
+
it "#resolve returns resolve values as map" do
|
22
|
+
result = @ivy4r.resolve :file => @ivy_xml
|
23
|
+
|
24
|
+
result.should_not be nil
|
25
|
+
result['ivy.organisation'].should eq('blau')
|
26
|
+
result['ivy.resolved.configurations'].size.should eq(4)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "#cachpath contains correct jars from previous resolve" do
|
30
|
+
@ivy4r.resolve :organisation => "oro", :module => "oro", :revision => "2.0.8", :keep => true, :inline => true
|
31
|
+
result = @ivy4r.cachepath :pathid => 'mytestpathid'
|
32
|
+
|
33
|
+
result.any? {|a| a =~ /.*oro.*\.jar/ && a =~ /.*2\.0\.8*/ }.should be true
|
34
|
+
end
|
35
|
+
|
36
|
+
it "#cachpath with inline resolve contains correct jars" do
|
37
|
+
result = @ivy4r.cachepath :organisation => "oro", :module => "oro", :revision => "2.0.8", :inline => true, :pathid => 'mytestpathid'
|
38
|
+
|
39
|
+
result.any? {|a| a =~ /.*oro.*\.jar/ && a =~ /.*2\.0\.8*/ }.should be true
|
40
|
+
end
|
41
|
+
|
42
|
+
it "#findrevision finds correct version" do
|
43
|
+
result = @ivy4r.findrevision :organisation => "oro", :module => "oro", :revision => "2.0.8"
|
44
|
+
|
45
|
+
result.should eq('2.0.8')
|
46
|
+
end
|
47
|
+
|
48
|
+
it "#findrevision returns nil for unknown revision on existing module" do
|
49
|
+
result = @ivy4r.findrevision :organisation => "oro", :module => "oro", :revision => "1unknown1"
|
50
|
+
|
51
|
+
result.should be nil
|
52
|
+
end
|
53
|
+
|
54
|
+
it "#artifactproperty dependencies are contained in result" do
|
55
|
+
@ivy4r.resolve :file => @ivy_xml
|
56
|
+
result = @ivy4r.artifactproperty :name => '[organisation]-[module]', :value => '[revision]'
|
57
|
+
|
58
|
+
result.any? {|k,v| k == 'oro-oro' && v == '2.0.8' }.should be true
|
59
|
+
end
|
60
|
+
|
61
|
+
it "#artifactreport creates xml report file" do
|
62
|
+
begin
|
63
|
+
target = File.join(Dir.pwd, "temp_test#{Time.new.strftime('%Y%m%d%H%M%S')}")
|
64
|
+
FileUtils.mkdir(target)
|
65
|
+
@ivy4r.resolve :file => @ivy_xml
|
66
|
+
result = @ivy4r.artifactreport :tofile => File.join(target, 'test.xml')
|
67
|
+
|
68
|
+
result.should_not be nil
|
69
|
+
result.should match(/.*<module organisation="oro".*/)
|
70
|
+
ensure
|
71
|
+
FileUtils.rm_rf target
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
it "#retrieve creates directory with artifacts" do
|
76
|
+
begin
|
77
|
+
target = File.join(Dir.pwd, "temp_test#{Time.new.strftime('%Y%m%d%H%M%S')}")
|
78
|
+
FileUtils.mkdir(target)
|
79
|
+
@ivy4r.resolve :file => @ivy_xml
|
80
|
+
@ivy4r.retrieve :pattern => "#{target}/[organisation]/[module].[ext]"
|
81
|
+
|
82
|
+
Dir.glob(File.join(target, '**/oro.jar')).size.should be > 0
|
83
|
+
ensure
|
84
|
+
FileUtils.rm_rf target
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
it "#report creates reports" do
|
89
|
+
begin
|
90
|
+
target = File.join(Dir.pwd, "temp_test#{Time.new.strftime('%Y%m%d%H%M%S')}")
|
91
|
+
FileUtils.mkdir(target)
|
92
|
+
@ivy4r.resolve :file => @ivy_xml
|
93
|
+
@ivy4r.report :todir => target
|
94
|
+
|
95
|
+
Dir.glob(File.join(target, '**/*')).size.should be > 0
|
96
|
+
ensure
|
97
|
+
FileUtils.rm_rf target
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
it "#buildlist returns list in correct order for linear build" do
|
102
|
+
target = @buildlist_dir
|
103
|
+
result = @ivy4r.buildlist :reference => 'testpath', :nested => {
|
104
|
+
:fileset => [
|
105
|
+
{:dir => File.join(target, "sub"), :includes => '**/buildfile'},
|
106
|
+
{:dir => File.join(target, "p1"), :includes => 'buildfile'}
|
107
|
+
]
|
108
|
+
}
|
109
|
+
|
110
|
+
result.size.should be 3
|
111
|
+
result.map! { |file| File.expand_path(file) }
|
112
|
+
File.expand_path(File.join(target, "p1", "buildfile")).should eq(result[0])
|
113
|
+
File.expand_path(File.join(target, "sub", "p2", "buildfile")).should eq(result[1])
|
114
|
+
File.expand_path(File.join(target, "sub", "p3", "buildfile")).should eq(result[2])
|
115
|
+
end
|
116
|
+
|
117
|
+
it "#makepom creates a pom for ivy.xml" do
|
118
|
+
begin
|
119
|
+
target = File.join(File.dirname(__FILE__), "testpom.xml")
|
120
|
+
result = @ivy4r.makepom :ivyfile => @ivy_xml, :pomfile => target, :nested => {
|
121
|
+
:mapping => {:conf => 'default', :scope => 'runtime' }
|
122
|
+
}
|
123
|
+
|
124
|
+
IO.read(target).should eq(result)
|
125
|
+
ensure
|
126
|
+
FileUtils.rm target
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 12
|
8
|
-
-
|
9
|
-
version: 0.12.
|
8
|
+
- 8
|
9
|
+
version: 0.12.8
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Klaas Reineke
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-14 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -60,45 +60,61 @@ dependencies:
|
|
60
60
|
prerelease: false
|
61
61
|
type: :runtime
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: autotest
|
64
64
|
version_requirements: &id004 !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
segments:
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-
|
72
|
-
version:
|
69
|
+
- 4
|
70
|
+
- 4
|
71
|
+
- 6
|
72
|
+
version: 4.4.6
|
73
73
|
requirement: *id004
|
74
74
|
prerelease: false
|
75
75
|
type: :development
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
|
-
name:
|
77
|
+
name: ZenTest
|
78
78
|
version_requirements: &id005 !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
segments:
|
83
|
-
-
|
84
|
-
-
|
85
|
-
-
|
86
|
-
version:
|
83
|
+
- 4
|
84
|
+
- 4
|
85
|
+
- 2
|
86
|
+
version: 4.4.2
|
87
87
|
requirement: *id005
|
88
88
|
prerelease: false
|
89
89
|
type: :development
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
|
-
name:
|
91
|
+
name: rspec
|
92
92
|
version_requirements: &id006 !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
segments:
|
97
|
+
- 2
|
98
|
+
- 4
|
97
99
|
- 0
|
98
|
-
version:
|
100
|
+
version: 2.4.0
|
99
101
|
requirement: *id006
|
100
102
|
prerelease: false
|
101
103
|
type: :development
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: rr
|
106
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
segments:
|
111
|
+
- 1
|
112
|
+
- 0
|
113
|
+
- 2
|
114
|
+
version: 1.0.2
|
115
|
+
requirement: *id007
|
116
|
+
prerelease: false
|
117
|
+
type: :development
|
102
118
|
description: Ivy4r is a Ruby interface for Apache Ivy dependency management library. Offers support for using Ivy with Buildr and Rake.
|
103
119
|
email:
|
104
120
|
- klaas.reineke@googlemail.com
|
@@ -109,12 +125,15 @@ extensions: []
|
|
109
125
|
extra_rdoc_files: []
|
110
126
|
|
111
127
|
files:
|
128
|
+
- .autotest
|
112
129
|
- .gitignore
|
113
130
|
- .project
|
131
|
+
- .rspec
|
114
132
|
- CHANGELOG
|
115
133
|
- Gemfile
|
116
134
|
- README.txt
|
117
135
|
- Rakefile
|
136
|
+
- autotest/discover.rb
|
118
137
|
- ivy4r.gemspec
|
119
138
|
- lib/buildr/ivy_extension.rb
|
120
139
|
- lib/ivy/artifactproperty.rb
|
@@ -141,17 +160,19 @@ files:
|
|
141
160
|
- lib/ivy4r/version.rb
|
142
161
|
- lib/ivy4r_java_extensions.rb
|
143
162
|
- lib/rake/ivy_extension.rb
|
144
|
-
-
|
145
|
-
-
|
146
|
-
-
|
147
|
-
-
|
148
|
-
-
|
149
|
-
-
|
150
|
-
-
|
151
|
-
-
|
152
|
-
-
|
153
|
-
-
|
154
|
-
-
|
163
|
+
- spec/ivy/target_spec.rb
|
164
|
+
- spec/ivy/targets_spec.rb
|
165
|
+
- spec/ivy4r_spec.rb
|
166
|
+
- spec/spec_helper.rb
|
167
|
+
- spec_files/buildlist/p1/buildfile
|
168
|
+
- spec_files/buildlist/p1/ivy.xml
|
169
|
+
- spec_files/buildlist/sub/p2/buildfile
|
170
|
+
- spec_files/buildlist/sub/p2/ivy.xml
|
171
|
+
- spec_files/buildlist/sub/p3/buildfile
|
172
|
+
- spec_files/buildlist/sub/p3/ivy.xml
|
173
|
+
- spec_files/ivy.xml
|
174
|
+
- spec_files/ivysettings.xml
|
175
|
+
- spec_functional/ivy4r_spec.rb
|
155
176
|
has_rdoc: true
|
156
177
|
homepage: http://github.com/klaas1979/ivy4r
|
157
178
|
licenses: []
|
@@ -1,99 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__),'..','..','lib')
|
2
|
-
|
3
|
-
JRuby.objectspace = true if RUBY_PLATFORM == 'java'
|
4
|
-
|
5
|
-
require 'test/unit'
|
6
|
-
require 'rr'
|
7
|
-
require 'ivy/target'
|
8
|
-
|
9
|
-
class Test::Unit::TestCase
|
10
|
-
include RR::Adapters::TestUnit
|
11
|
-
end
|
12
|
-
|
13
|
-
module Ivy
|
14
|
-
class TargetTest < Test::Unit::TestCase
|
15
|
-
|
16
|
-
def setup
|
17
|
-
Ivy::Target.send(:public, :call_nested) # make tested method public
|
18
|
-
@ant = Object.new
|
19
|
-
@target = Ivy::Target.new(@ant)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_call_nested_simple
|
23
|
-
nested = {
|
24
|
-
:fileset => {
|
25
|
-
:includes => 'bla',
|
26
|
-
:excludes => 'blub',
|
27
|
-
:dir => 'anything'
|
28
|
-
}
|
29
|
-
}
|
30
|
-
mock(@ant).fileset(nested[:fileset])
|
31
|
-
|
32
|
-
@target.call_nested(nested)
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_call_nested_multiply
|
36
|
-
nested = {
|
37
|
-
:fileset => {
|
38
|
-
:includes => 'bla',
|
39
|
-
:excludes => 'blub',
|
40
|
-
:dir => 'anything'
|
41
|
-
},
|
42
|
-
:other => {
|
43
|
-
:param => 'myparam'
|
44
|
-
}
|
45
|
-
}
|
46
|
-
mock(@ant).fileset nested[:fileset]
|
47
|
-
mock(@ant).other nested[:other]
|
48
|
-
|
49
|
-
@target.call_nested(nested)
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_call_nested_list_with_same_method
|
53
|
-
nested = {
|
54
|
-
:fileset => [
|
55
|
-
{
|
56
|
-
:includes => 'bla',
|
57
|
-
:excludes => 'blub',
|
58
|
-
:dir => 'anything'
|
59
|
-
},
|
60
|
-
{
|
61
|
-
:includes => 'otherbla',
|
62
|
-
:excludes => 'otherblub',
|
63
|
-
:dir => 'otheranything'
|
64
|
-
}
|
65
|
-
]
|
66
|
-
}
|
67
|
-
mock(@ant).fileset nested[:fileset][0]
|
68
|
-
mock(@ant).fileset nested[:fileset][1]
|
69
|
-
|
70
|
-
@target.call_nested(nested)
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_call_recursive_nested
|
74
|
-
nested = {
|
75
|
-
:taskdef =>
|
76
|
-
{
|
77
|
-
:name => 'bla',
|
78
|
-
:nested => {
|
79
|
-
:fileset => {
|
80
|
-
:includes => 'bla',
|
81
|
-
:excludes => 'blub',
|
82
|
-
:dir => 'anything'}
|
83
|
-
}
|
84
|
-
}
|
85
|
-
}
|
86
|
-
|
87
|
-
# define the method that yields if a block is given, to test the nested stuff
|
88
|
-
def @ant.taskdef(p)
|
89
|
-
raise "Invalid params to many" unless p.size == 1
|
90
|
-
raise "Wrong parameter value" unless 'bla' == p[:name]
|
91
|
-
raise "missing block for method" unless block_given?
|
92
|
-
yield
|
93
|
-
end
|
94
|
-
mock(@ant).fileset nested[:taskdef][:nested][:fileset]
|
95
|
-
|
96
|
-
@target.call_nested(nested)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__),'..','..','lib')
|
2
|
-
|
3
|
-
require 'test/unit'
|
4
|
-
require 'ivy/targets'
|
5
|
-
require 'ivy4r'
|
6
|
-
|
7
|
-
module Ivy
|
8
|
-
class TargetsTest < Test::Unit::TestCase
|
9
|
-
|
10
|
-
def setup
|
11
|
-
ivy4r = Ivy4r.new
|
12
|
-
@ivy_test_xml = File.join(File.dirname(__FILE__), 'ivytest.xml')
|
13
|
-
@info = Ivy::Info.new(ivy4r.ant)
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_execute_empty_parameters_missing_mandatory_exception
|
17
|
-
assert_raise(ArgumentError) { @info.execute({}) }
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_execute_validate_with_unkown_parameter_exception
|
21
|
-
assert_raise(ArgumentError) { @info.execute(:unknown_parameter => 'unknown') }
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_execute_simple_file_correct_return_values
|
25
|
-
result = @info.execute(:file => @ivy_test_xml)
|
26
|
-
|
27
|
-
assert_not_nil result
|
28
|
-
%w[ivy.organisation ivy.revision ivy.module].each do |var|
|
29
|
-
assert_equal true, result.keys.member?(var), "Contains key '#{var}', has '#{result.keys.join(', ')}'"
|
30
|
-
end
|
31
|
-
assert_equal 'blau', result['ivy.organisation']
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,196 +0,0 @@
|
|
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
|