ivy4r 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,11 @@
1
+ === 0.9.2 / 2009-11-16
2
+
3
+ * Added new method to generate an ivy file from a resolved module descriptor, via the java
4
+ method ModuleDescriptor.toIvyFile(java.io.File). This is only working in jruby, because
5
+ the method is not called via Antwrap!
6
+ * Added support for buildr configuration to call 'to_ivy_file' to generate ivy file from resolved
7
+ module descriptor, i.e. using 'ivy.to_ivy_file :file => 'output.file', :overwrite => true'
8
+
1
9
  === 0.9.1 / 2009-11-16
2
10
 
3
11
  * Fixed bug that 'type' was not working for EAR
data/Manifest.txt CHANGED
@@ -22,6 +22,7 @@ lib/ivy/retrieve.rb
22
22
  lib/ivy/settings.rb
23
23
  lib/ivy/target.rb
24
24
  lib/ivy/targets.rb
25
+ lib/ivy/to_ivy_file.rb
25
26
  lib/ivy4r.rb
26
27
  lib/rake/ivy_extension.rb
27
28
  test/buildlist/p1/buildfile
@@ -334,6 +334,17 @@ module Buildr
334
334
  end
335
335
  end
336
336
 
337
+ # Sets the properties for creation of an ivy file from resolved descriptor as an post_resolve task.
338
+ def to_ivy_file(args)
339
+ raise "The output file ':file' must be specified for 'to_ivy_file'" unless args.member? :file
340
+ raise "Only :file and :overwrite are allowed arguments for 'to_ivy_file'" if (args.keys - [:file, :overwrite]).size > 0
341
+ post_resolve do
342
+ FileUtils.mkdir_p File.dirname(args[:file])
343
+ ivy4r.to_ivy_file args
344
+ @project.send(:info, "Created ivy file: '#{args[:file]}'")
345
+ end
346
+ end
347
+
337
348
  # Adds given block as post resolve action that is executed directly after #resolve has been called.
338
349
  # Yields this ivy config object into block.
339
350
  # <tt>project.ivy.post_resolve { |ivy| p "all deps:" + ivy.deps('all').join(", ") }</tt>
data/lib/ivy/targets.rb CHANGED
@@ -15,6 +15,7 @@ require 'ivy/retrieve'
15
15
  require 'ivy/publish'
16
16
  require 'ivy/report'
17
17
  require 'ivy/buildlist'
18
+ require 'ivy/to_ivy_file'
18
19
 
19
20
  =begin
20
21
  finished
@@ -0,0 +1,31 @@
1
+ require 'ivy/target'
2
+
3
+ module Ivy
4
+ class ToIvyFile < Ivy::Target
5
+ def parameter
6
+ [
7
+ Parameter.new(:file, true),
8
+ Parameter.new(:overwrite, false)
9
+ ]
10
+ end
11
+
12
+ protected
13
+ def execute_ivy
14
+ descriptor = ant_references.find {|tuple| tuple[0] == 'ivy.resolved.descriptor'}
15
+ raise 'to_ivy_file is a post resolve task but no resolved descriptor was found!' if descriptor.nil?
16
+ descriptor = descriptor[1]
17
+
18
+ file = params[:file]
19
+ overwrite = params[:overwrite] && params[:overwrite].to_s == 'true'
20
+ unless !File.exists?(file) || overwrite
21
+ raise "Output file '#{file}' exists and ':overwrite' is false or unset: #{params[:overwrite]}"
22
+ end
23
+
24
+ descriptor.toIvyFile(java.io.File.new(file))
25
+ end
26
+
27
+ def create_return_values
28
+ nil
29
+ end
30
+ end
31
+ end
data/lib/ivy4r.rb CHANGED
@@ -35,7 +35,7 @@ is
35
35
  }
36
36
  =end
37
37
  class Ivy4r
38
- VERSION = '0.9.1'
38
+ VERSION = '0.9.2'
39
39
 
40
40
  # Set the ant home directory to load ant classes from if no custom __antwrap__ is provided
41
41
  # and the default provided ant version 1.7.1 should not be used.
@@ -151,6 +151,12 @@ class Ivy4r
151
151
  Ivy::Report.new(ant).execute(*params)
152
152
  end
153
153
 
154
+ # Creates ivy file for last resolved descriptor using the underlying java facilities
155
+ # (ModuleDescriptor.toIvyFile(java.io.File)).
156
+ def to_ivy_file(*params)
157
+ Ivy::ToIvyFile.new(ant).execute(*params)
158
+ end
159
+
154
160
  # Used to get or set ant properties.
155
161
  # [set] <tt>property['name'] = value</tt> sets the ant property with name to given value no overwrite
156
162
  # [get] <tt>property[matcher]</tt> gets property that is equal via case equality operator (<tt>===</tt>)
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.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Klaas Prause
@@ -94,6 +94,7 @@ files:
94
94
  - lib/ivy/settings.rb
95
95
  - lib/ivy/target.rb
96
96
  - lib/ivy/targets.rb
97
+ - lib/ivy/to_ivy_file.rb
97
98
  - lib/ivy4r.rb
98
99
  - lib/rake/ivy_extension.rb
99
100
  - test/buildlist/p1/buildfile