klaas1979-ivy4r 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,5 @@
1
+ === 0.1.0 / 2009-06-17
2
+
3
+ * initial release
4
+ * support for nearly all basic IVY Ant targets
5
+ * basic validation of parameters
data/Manifest.txt ADDED
@@ -0,0 +1,35 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ lib/ivy/artifactproperty.rb
6
+ lib/ivy/artifactreport.rb
7
+ lib/ivy/buildlist.rb
8
+ lib/ivy/buildnumber.rb
9
+ lib/ivy/cachepath.rb
10
+ lib/ivy/cleancache.rb
11
+ lib/ivy/configure.rb
12
+ lib/ivy/findrevision.rb
13
+ lib/ivy/info.rb
14
+ lib/ivy/listmodules.rb
15
+ lib/ivy/makepom.rb
16
+ lib/ivy/publish.rb
17
+ lib/ivy/report.rb
18
+ lib/ivy/resolve.rb
19
+ lib/ivy/retrieve.rb
20
+ lib/ivy/settings.rb
21
+ lib/ivy/target.rb
22
+ lib/ivy/targets.rb
23
+ lib/ivy4r.rb
24
+ test/buildlist/p1/buildfile
25
+ test/buildlist/p1/ivy.xml
26
+ test/buildlist/sub/p2/buildfile
27
+ test/buildlist/sub/p2/ivy.xml
28
+ test/buildlist/sub/p3/buildfile
29
+ test/buildlist/sub/p3/ivy.xml
30
+ test/ivy/ivysettings.xml
31
+ test/ivy/ivytest.xml
32
+ test/ivy/test_target.rb
33
+ test/ivy/test_targets.rb
34
+ test/test_ivy4r.rb
35
+
data/README.txt ADDED
@@ -0,0 +1,91 @@
1
+ = ivy4r
2
+
3
+ * http://github.com/klaas1979/ivy4r/tree/master
4
+
5
+ == DESCRIPTION:
6
+
7
+ Apache Ivy dependency manager wrapper for ruby (see http://ant.apache.org/ivy/index.html for more information).Use Ivy via a ruby wrapper without the need to use Apache Ant.
8
+ The wrapper uses Antwrap (see http://antwrap.rubyforge.org/) to interface with Ivy.
9
+
10
+ == FEATURES/PROBLEMS:
11
+
12
+ Supports most standard Ivy Ant targets via Antwrap.
13
+
14
+ === Supported Ivy targets:
15
+ * info
16
+ * settings
17
+ * configure
18
+ * cleancache
19
+ * buildnumber
20
+ * findrevision
21
+ * cachepath
22
+ * artifactreport
23
+ * resolve
24
+ * makepom
25
+ * retrieve
26
+ * publish
27
+ * artifactproperty
28
+ * report
29
+ * buildlist
30
+ * deliver
31
+ * install
32
+ * repreport
33
+
34
+ === Currently not working Ivy targets:
35
+ * listmodules
36
+
37
+ === Ivy targets that need to be implemented:
38
+ * deliver
39
+ * install
40
+ * repreport
41
+
42
+ === Unsupported Ivy Targets (they make no sense for the wrapper):
43
+ * cachefileset
44
+ * var
45
+
46
+ == SYNOPSIS:
47
+
48
+ To init a new Ivy4r instance set the ANT_HOME and the Ivy lib dir
49
+ <tt>
50
+ ivy4r = Ivy4r.new
51
+ ivy4r.ant_home = 'PATH TO YOUR ANTHME'
52
+ ivy4r.lib_dir = 'PATH TO IVY LIB DIR'
53
+ </tt>
54
+ as an alternative to setting the ANT_HOME you can set an +Antwrap+ instance directly:
55
+ <tt>
56
+ ivy4r.ant = Buildr.ant('ivy')
57
+ </tt>
58
+
59
+ == REQUIREMENTS:
60
+
61
+ * Installed Apache Ant, to call Ivy via Antwrap.
62
+ * Ivy and dependencies in a single directory. Dependencies depends on used features, see the ivy homepage for more information.
63
+
64
+ == INSTALL:
65
+
66
+ * sudo gem install ivy4r
67
+
68
+ == LICENSE:
69
+
70
+ (The MIT License)
71
+
72
+ Copyright (c) 2009 blau Mobilfunk GmbH
73
+
74
+ Permission is hereby granted, free of charge, to any person obtaining
75
+ a copy of this software and associated documentation files (the
76
+ 'Software'), to deal in the Software without restriction, including
77
+ without limitation the rights to use, copy, modify, merge, publish,
78
+ distribute, sublicense, and/or sell copies of the Software, and to
79
+ permit persons to whom the Software is furnished to do so, subject to
80
+ the following conditions:
81
+
82
+ The above copyright notice and this permission notice shall be
83
+ included in all copies or substantial portions of the Software.
84
+
85
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
88
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
89
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
90
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
91
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,24 @@
1
+ # -*- ruby -*-
2
+ $:.unshift File.join(File.dirname(__FILE__), 'lib')
3
+
4
+ require 'rubygems'
5
+ require 'hoe'
6
+ require 'ivy4r'
7
+
8
+ hoe = Hoe.spec 'ivy4r' do |p|
9
+ # self.rubyforge_name = 'ivy4rx' # if different than 'ivy4r'
10
+ p.developer('Klaas Prause', 'klaas.prause@googlemail.com')
11
+ p.extra_deps = [['Antwrap', '>=0.7.0']]
12
+ File.open(File.join(File.dirname(__FILE__), 'VERSION'), 'w') do |file|
13
+ file.puts Ivy4r::VERSION
14
+ end
15
+ end
16
+
17
+ begin
18
+ require 'jeweler'
19
+ Jeweler::Tasks.new(hoe.spec)
20
+ rescue LoadError
21
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
22
+ end
23
+
24
+ # vim: syntax=ruby
data/bin/ivy4r ADDED
File without changes
@@ -0,0 +1,34 @@
1
+ require 'ivy/target'
2
+
3
+ module Ivy
4
+ class Artifactproperty < Ivy::Target
5
+ def parameter
6
+ [
7
+ Parameter.new(:name, true),
8
+ Parameter.new(:value, true),
9
+ Parameter.new(:conf, false),
10
+ Parameter.new(:haltonfailure, false),
11
+ Parameter.new(:validate, false),
12
+ Parameter.new(:overwrite, false),
13
+ Parameter.new(:settingsRef, false),
14
+ ]
15
+ end
16
+
17
+ protected
18
+ def before_hook
19
+ @cached_property_names = ant_properties.map {|key, value| key }
20
+ end
21
+
22
+ def after_hook
23
+ @cached_property_names = nil
24
+ end
25
+
26
+ def execute_ivy
27
+ call_nested :ivy_artifactproperty => params
28
+ end
29
+
30
+ def create_return_values
31
+ ant_properties.reject { |key, value| @cached_property_names.member? key }
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,24 @@
1
+ require 'ivy/target'
2
+
3
+ module Ivy
4
+ class Artifactreport < Ivy::Target
5
+ def parameter
6
+ [
7
+ Parameter.new(:tofile, true),
8
+ Parameter.new(:pattern, false),
9
+ Parameter.new(:conf, false),
10
+ Parameter.new(:haltonfailure, false),
11
+ Parameter.new(:settingsRef, false)
12
+ ]
13
+ end
14
+
15
+ protected
16
+ def execute_ivy
17
+ call_nested :ivy_artifactreport => params
18
+ end
19
+
20
+ def create_return_values
21
+ IO.read(params[:tofile])
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,37 @@
1
+ require 'ivy/target'
2
+
3
+ module Ivy
4
+ class Buildlist < Ivy::Target
5
+ def parameter
6
+ [
7
+ Parameter.new(:reference, false),
8
+ Parameter.new(:nested, true),
9
+ Parameter.new(:ivyfilepath, false),
10
+ Parameter.new(:root, false),
11
+ Parameter.new(:excluderoot, false),
12
+ Parameter.new(:leaf, false),
13
+ Parameter.new(:onlydirectdep, false),
14
+ Parameter.new(:delimiter, false),
15
+ Parameter.new(:excludeleaf, false),
16
+ Parameter.new(:haltonerror, false),
17
+ Parameter.new(:skipbuildwithoutivy, false),
18
+ Parameter.new(:onMissingDescriptor, false),
19
+ Parameter.new(:reverse, false),
20
+ Parameter.new(:restartFrom, false),
21
+ Parameter.new(:settingsRef, false)
22
+ ]
23
+ end
24
+
25
+ protected
26
+ def execute_ivy
27
+ params[:reference] = "path-#{rand.to_s}" unless params[:reference]
28
+ call_nested :ivy_buildlist => params
29
+ end
30
+
31
+ def create_return_values
32
+ path = ant_references.find { |current| params[:reference] == current[0] }[1]
33
+ raise "Could not get path for params #{params.inspect}" unless path && path.respond_to?(:list)
34
+ path.list.map {|a| a.to_s }
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,34 @@
1
+ require 'ivy/target'
2
+
3
+ module Ivy
4
+ class Buildnumber < Ivy::Target
5
+ def parameter
6
+ [
7
+ Parameter.new(:organisation, true),
8
+ Parameter.new(:module, true),
9
+ Parameter.new(:branch, false),
10
+ Parameter.new(:revision, false),
11
+ Parameter.new(:default, false),
12
+ Parameter.new(:defaultBuildNumber, false),
13
+ Parameter.new(:revSep, false),
14
+ Parameter.new(:prefix, false),
15
+ Parameter.new(:settingsRef, false),
16
+ Parameter.new(:resolver, false)
17
+ ]
18
+ end
19
+
20
+ def result_property_values
21
+ [
22
+ ResultValue.new("ivy.revision", nil),
23
+ ResultValue.new("ivy.new.revision", nil),
24
+ ResultValue.new("ivy.build.number", nil),
25
+ ResultValue.new("ivy.new.build.number", nil)
26
+ ]
27
+ end
28
+
29
+ protected
30
+ def execute_ivy
31
+ call_nested :ivy_buildnumber => params
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,30 @@
1
+ require 'ivy/target'
2
+
3
+ module Ivy
4
+ class Cachepath < Ivy::Target
5
+ def parameter
6
+ [
7
+ Parameter.new(:pathid, true),
8
+ Parameter.new(:conf, false),
9
+ Parameter.new(:inline, false),
10
+ Parameter.new(:organisation, false),
11
+ Parameter.new(:module, false),
12
+ Parameter.new(:revision, false),
13
+ Parameter.new(:branch, false),
14
+ Parameter.new(:type, false),
15
+ Parameter.new(:settingsRef, false),
16
+ ]
17
+ end
18
+
19
+ def create_return_values
20
+ path = ant_references.find { |current| current[0] == params[:pathid] }[1]
21
+ raise "Could not get path for confs: #{params.inspect}" unless path && path.respond_to?(:list)
22
+ path.list.map {|a| a.to_s }
23
+ end
24
+
25
+ protected
26
+ def execute_ivy
27
+ call_nested :ivy_cachepath => params
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,20 @@
1
+ require 'ivy/target'
2
+
3
+ module Ivy
4
+ class Cleancache < Ivy::Target
5
+ def parameter
6
+ [
7
+ Parameter.new(:settingsRef, false)
8
+ ]
9
+ end
10
+
11
+ protected
12
+ def execute_ivy
13
+ call_nested :ivy_cleancache => params
14
+ end
15
+
16
+ def create_return_values
17
+ nil
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,29 @@
1
+ require 'ivy/target'
2
+
3
+ module Ivy
4
+ class Configure < Ivy::Target
5
+ def parameter
6
+ [
7
+ Parameter.new(:id, false),
8
+ Parameter.new(:file, false),
9
+ Parameter.new(:url, false),
10
+ Parameter.new(:host, false),
11
+ Parameter.new(:realm,false),
12
+ Parameter.new(:username, false),
13
+ Parameter.new(:passwd, false)
14
+ ]
15
+ end
16
+
17
+ def result_property_values
18
+ property = params[:id] || 'ivy.instance'
19
+ [
20
+ ResultValue.new(/.*\.#{property}/, nil)
21
+ ]
22
+ end
23
+
24
+ protected
25
+ def execute_ivy
26
+ call_nested :ivy_configure => params
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,34 @@
1
+ require 'ivy/target'
2
+
3
+ module Ivy
4
+ class Findrevision < Ivy::Target
5
+ def parameter
6
+ [
7
+ Parameter.new(:organisation, true),
8
+ Parameter.new(:module, true),
9
+ Parameter.new(:branch, false),
10
+ Parameter.new(:revision, true),
11
+ Parameter.new(:property, false),
12
+ Parameter.new(:settingsRef, false)
13
+ ]
14
+ end
15
+
16
+ def result_property_values
17
+ property = params[:property] || 'ivy.revision'
18
+ [
19
+ ResultValue.new("#{property}", nil)
20
+ ]
21
+ end
22
+
23
+ protected
24
+ def execute_ivy
25
+ call_nested :ivy_findrevision => params
26
+ end
27
+
28
+ def create_return_values
29
+ values = result_properties.values
30
+ raise "Could not retrieve revision for '#{params.inspect}'" if values.size > 1
31
+ values.size == 1 ? values[0] : nil
32
+ end
33
+ end
34
+ end
data/lib/ivy/info.rb ADDED
@@ -0,0 +1,36 @@
1
+ require 'ivy/target'
2
+
3
+ module Ivy
4
+ class Info < Ivy::Target
5
+ def parameter
6
+ [
7
+ Parameter.new(:file, true),
8
+ Parameter.new(:organisation, false),
9
+ Parameter.new(:module, false),
10
+ Parameter.new(:branch, false),
11
+ Parameter.new(:revision, false),
12
+ Parameter.new(:property, false),
13
+ Parameter.new(:settingsRef, false)
14
+ ]
15
+ end
16
+
17
+ def result_property_values
18
+ property = params[:property] || 'ivy'
19
+ [
20
+ ResultValue.new("#{property}.organisation", nil),
21
+ ResultValue.new("#{property}.module", nil),
22
+ ResultValue.new("#{property}.branch", nil),
23
+ ResultValue.new("#{property}.revision", nil),
24
+ ResultValue.new("#{property}.status", nil),
25
+ ResultValue.new(/#{property}.extra\..*/, nil),
26
+ ResultValue.new("#{property}.configurations", Ivy::COMMA_SPLITTER),
27
+ ResultValue.new("#{property}.public.configurations", Ivy::COMMA_SPLITTER)
28
+ ]
29
+ end
30
+
31
+ protected
32
+ def execute_ivy
33
+ call_nested :ivy_info => params
34
+ end
35
+ end
36
+ end