ivy4r 0.3.0 → 0.5.1

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.
@@ -1,3 +1,21 @@
1
+ === 0.5.1 / 2009-06-24
2
+
3
+ * small improvements in rakefile (execute test for some targets)
4
+ * publish to rubyforge "hamburg.rb"
5
+
6
+ === 0.5.0 / 2009-06-23
7
+
8
+ * use ivy4r-jars to get needed jars from to separate the ruby source from the dependencies
9
+ and make the gem smaller.
10
+
11
+ === 0.4.0 / 2009-06-23
12
+
13
+ * added rake/ivy_extension similar to buildr/ivy_extension to help use ivy4r in rake
14
+
15
+ === 0.3.0 / 2009-06-20
16
+
17
+ * added ant*.jar to gem so that user does not need to have a local ant installation
18
+
1
19
  === 0.2.0 / 2009-06-18
2
20
 
3
21
  * added the Buildr ivy_extension to include ivy in buildr for dependency managment
@@ -3,9 +3,6 @@ Manifest.txt
3
3
  README.txt
4
4
  Rakefile
5
5
  bin/ivy4r
6
- jars/lib/ant-1.7.1.jar
7
- jars/lib/ant-launcher-1.7.1.jar
8
- jars/lib/ant-trax-1.7.1.jar
9
6
  lib/buildr/ivy_extension.rb
10
7
  lib/ivy/artifactproperty.rb
11
8
  lib/ivy/artifactreport.rb
@@ -26,6 +23,7 @@ lib/ivy/settings.rb
26
23
  lib/ivy/target.rb
27
24
  lib/ivy/targets.rb
28
25
  lib/ivy4r.rb
26
+ lib/rake/ivy_extension.rb
29
27
  test/buildlist/p1/buildfile
30
28
  test/buildlist/p1/ivy.xml
31
29
  test/buildlist/sub/p2/buildfile
data/README.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  = ivy4r
2
2
 
3
3
  * http://github.com/klaas1979/ivy4r/tree/master
4
- * http://ivy4r.rubyforge.org/
4
+ * http://hamburgrb.rubyforge.org/
5
5
 
6
6
  == DESCRIPTION:
7
7
 
data/Rakefile CHANGED
@@ -4,12 +4,13 @@ $:.unshift File.join(File.dirname(__FILE__), 'lib')
4
4
  require 'rubygems'
5
5
  require 'hoe'
6
6
  require 'ivy4r'
7
-
7
+
8
8
  hoe = Hoe.spec 'ivy4r' do |p|
9
- # self.rubyforge_name = 'ivy4rx' # if different than 'ivy4r'
9
+ self.rubyforge_name = 'hamburgrb'
10
10
  p.developer('Klaas Prause', 'klaas.prause@googlemail.com')
11
- p.remote_rdoc_dir = '' # Release to root only one project
12
- p.extra_deps = [['Antwrap', '>=0.7.0']]
11
+ p.remote_rdoc_dir = 'ivy4r'
12
+ p.extra_deps << ['Antwrap', '>=0.7.0']
13
+ p.extra_deps << ['ivy4r-jars', '>=1.0.0']
13
14
  File.open(File.join(File.dirname(__FILE__), 'VERSION'), 'w') do |file|
14
15
  file.puts Ivy4r::VERSION
15
16
  end
@@ -22,21 +23,9 @@ rescue LoadError
22
23
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
23
24
  end
24
25
 
25
- # vim: syntax=ruby
26
+ task :gemspec => :test
26
27
 
27
- ENV['IVY_EXT_DIR'] ||= '../Ivy'
28
+ desc "Tests, releases and publishs docs to rubyforge"
29
+ task :release_and_publish => [:test, :release, :publish_docs]
28
30
 
29
- task 'ivy:publish' do#=> ['test', 'test:plugins', 'war:clean', 'war'] do
30
- raise 'ANT_HOME missing in environment!' unless ENV['ANT_HOME']
31
- require 'ivy4r'
32
- ivy = Ivy4r.new
33
- #ivy.ant_home = ENV['ANT_HOME']
34
- ext_dir = File.expand_path(ENV['IVY_EXT_DIR'])
35
- ivy.project_dir = ext_dir
36
- home = File.join(ext_dir, 'ivy-home')
37
- ivy.lib_dir = File.join(home, 'jars')
38
- ivy.property['ivy.home'] = home
39
- ivy.property['ivy.status'] = 'release'
40
- ivy.settings :file => File.join(ext_dir, 'ant-scripts', 'ivysettings.xml')
41
- ivy.resolve :file => File.join(File.dirname(__FILE__), 'ivy.xml') #options = {:status => status, :pubrevision => revision, :artifactspattern => "#{publish_from}/[artifact].[ext]"}
42
- end
31
+ # vim: syntax=ruby
@@ -55,7 +55,7 @@ module Buildr
55
55
  unless @ant
56
56
  if own_file?
57
57
  @ant = ::Ivy4r.new(@project.ant('ivy'))
58
- @ant.lib_dir = lib_dir
58
+ @ant.lib_dir = lib_dir if lib_dir
59
59
  @ant.project_dir = @extension_dir
60
60
  else
61
61
  @ant = @project.parent.ivy.ant
@@ -148,7 +148,7 @@ module Buildr
148
148
  end
149
149
 
150
150
  def lib_dir
151
- @lib_dir ||= Ivy.setting('lib.dir') || "#{home}/jars"
151
+ @lib_dir ||= Ivy.setting('lib.dir')
152
152
  end
153
153
 
154
154
  def settings
@@ -1,3 +1,4 @@
1
+ require 'ivy4r_jars'
1
2
  require 'antwrap'
2
3
  require 'ivy/targets'
3
4
 
@@ -34,7 +35,7 @@ is
34
35
  }
35
36
  =end
36
37
  class Ivy4r
37
- VERSION = '0.3.0'
38
+ VERSION = '0.5.1'
38
39
 
39
40
  # Set the ant home directory to load ant classes from if no custom __antwrap__ is provided
40
41
  # and the default provided ant version 1.7.1 should not be used.
@@ -44,14 +45,20 @@ class Ivy4r
44
45
  # Defines the directory to load ivy libs and its dependencies from
45
46
  attr_accessor :lib_dir
46
47
 
48
+ # Optional ant variable <tt>ivy.project.dir</tt> to add to ant environment before loading ivy
49
+ # defaults to the __lib_dir__
47
50
  attr_accessor :project_dir
48
51
 
49
52
  # To provide a custom __antwrap__ to use instead of default one
50
53
  attr_writer :ant
51
54
 
52
- def initialize(*opts)
53
- @ant = opts[0] if opts.size == 1
54
- raise "To many parameters to create Ivy4r use none, or 1 to set ANT!" if opts.size > 1
55
+ # Initalizes ivy4r with optional ant wrapper object. Sets ant home dir and ivy lib dir
56
+ # to default values from __Ivy4rJars__ gem.
57
+ def initialize(ant = nil)
58
+ @ant_home = ::Ivy4rJars.ant_home_dir
59
+ @lib_dir = ::Ivy4rJars.lib_dir
60
+ @project_dir = @lib_dir
61
+ @ant = ant
55
62
  end
56
63
 
57
64
  # Calls the __cleancache__ ivy target with given parameters.
@@ -149,7 +156,7 @@ class Ivy4r
149
156
  # Returns the __antwrap__ instance to use for all internal calls creates a default
150
157
  # instance if no instance has been set before.
151
158
  def ant
152
- @ant ||= ::Antwrap::AntProject.new(:ant_home => ant_home || File.expand_path(File.join(File.dirname(__FILE__), '..', 'jars')),
159
+ @ant ||= ::Antwrap::AntProject.new(:ant_home => ant_home,
153
160
  :name => "ivy-ant", :basedir => Dir.pwd, :declarative => true)
154
161
  init(@ant) if should_init?
155
162
  @ant
@@ -0,0 +1,257 @@
1
+ require 'ivy4r'
2
+
3
+ class Rake::Application
4
+ attr_accessor :ivy
5
+ end
6
+
7
+ module Rake
8
+ module Ivy
9
+ class IvyConfig
10
+
11
+ # The directory to load ivy jars and its dependencies from, leave __nil__ to use default
12
+ attr_accessor :lib_dir
13
+
14
+ # The extension directory containing ivy settings, the local repository and cache
15
+ attr_accessor :extension_dir
16
+
17
+ # Returns the resolve result
18
+ attr_reader :resolved
19
+
20
+ # Store the current rake application and initialize ivy ant wrapper
21
+ def initialize(application)
22
+ @application = application
23
+ @extension_dir = File.join("#{@application.original_dir}", "#{ENV['IVY_EXT_DIR']}")
24
+ end
25
+
26
+ # Returns the correct ant instance to use.
27
+ def ant
28
+ unless @ant
29
+ @ant = ::Ivy4r.new
30
+ @ant.lib_dir = lib_dir if lib_dir
31
+ @ant.project_dir = @extension_dir
32
+ end
33
+ @ant
34
+ end
35
+
36
+ # Returns the artifacts for given configurations as array
37
+ def deps(*confs)
38
+ configure
39
+ pathid = "ivy.deps." + confs.join('.')
40
+ ant.cachepath :conf => confs.join(','), :pathid => pathid
41
+ end
42
+
43
+ # Returns ivy info for configured ivy file.
44
+ def info
45
+ ant.settings :id => 'ivy.info.settingsref'
46
+ ant.info :file => file, :settingsRef => 'ivy.info.settingsref'
47
+ end
48
+
49
+ # Configures the ivy instance with additional properties and loading the settings file if it was provided
50
+ def configure
51
+ unless @configured
52
+ ant.property['ivy.status'] = status
53
+ ant.property['ivy.home'] = home
54
+ properties.each {|key, value| ant.property[key.to_s] = value }
55
+ @configured = ant.settings :file => settings if settings
56
+ end
57
+ end
58
+
59
+ # Resolves the configured file once.
60
+ def resolve
61
+ unless @resolved
62
+ @resolved = ant.resolve :file => file
63
+ end
64
+ end
65
+
66
+ # Creates the standard ivy dependency report
67
+ def report
68
+ ant.report :todir => report_dir
69
+ end
70
+
71
+ # Publishs the project as defined in ivy file if it has not been published already
72
+ def publish
73
+ unless @published
74
+ options = {:artifactspattern => "#{publish_from}/[artifact].[ext]"}
75
+ options[:pubrevision] = revision if revision
76
+ options[:status] = status if status
77
+ options = publish_options * options
78
+ ant.publish options
79
+ @published = true
80
+ end
81
+ end
82
+
83
+ def home
84
+ @ivy_home_dir ||= "#{@extension_dir}/ivy-home"
85
+ end
86
+
87
+ def settings
88
+ @settings ||= "#{@extension_dir}/ant-scripts/ivysettings.xml"
89
+ end
90
+
91
+ def file
92
+ @ivy_file ||= 'ivy.xml'
93
+ end
94
+
95
+ # Sets the revision to use for the project, this is useful for development revisions that
96
+ # have an appended timestamp or any other dynamic revisioning.
97
+ #
98
+ # To set a different revision this method can be used in different ways.
99
+ # 1. project.ivy.revision(revision) to set the revision directly
100
+ # 2. project.ivy.revision { |ivy| [calculate revision] } use the block for dynamic
101
+ # calculation of the revision. You can access ivy4r via <tt>ivy.ant.[method]</tt>
102
+ def revision(*revision, &block)
103
+ raise "Invalid call with parameters and block!" if revision.size > 0 && block
104
+ if revision.empty? && block.nil?
105
+ if @revision_calc
106
+ @revision ||= @revision_calc.call(self)
107
+ else
108
+ @revision
109
+ end
110
+ elsif block.nil?
111
+ raise "revision value invalid #{revision.join(', ')}" unless revision.size == 1
112
+ @revision = revision[0]
113
+ self
114
+ else
115
+ @revision_calc = block
116
+ self
117
+ end
118
+ end
119
+
120
+ # Sets the status to use for the project, this is useful for custom status handling
121
+ # like integration, alpha, gold.
122
+ #
123
+ # To set a different status this method can be used in different ways.
124
+ # 1. project.ivy.status(status) to set the status directly
125
+ # 2. project.ivy.status { |ivy| [calculate status] } use the block for dynamic
126
+ # calculation of the status. You can access ivy4r via <tt>ivy.ant.[method]</tt>
127
+ def status(*status, &block)
128
+ raise "Invalid call with parameters and block!" if status.size > 0 && block
129
+ if status.empty? && block.nil?
130
+ if @status_calc
131
+ @status ||= @status_calc.call(self)
132
+ else
133
+ @status
134
+ end
135
+ elsif status.empty? && block.nil?
136
+ raise "status value invalid #{status.join(', ')}" unless status.size == 1
137
+ @status = status[0]
138
+ self
139
+ else
140
+ @status_calc = block
141
+ self
142
+ end
143
+ end
144
+
145
+ # Sets the publish options to use for the project. The options are merged with the default
146
+ # options including value set via #publish_from and overwrite all of them.
147
+ #
148
+ # To set the options this method can be used in different ways.
149
+ # 1. project.ivy.publish_options(options) to set the options directly
150
+ # 2. project.ivy.publish_options { |ivy| [calculate options] } use the block for dynamic
151
+ # calculation of options. You can access ivy4r via <tt>ivy.ant.[method]</tt>
152
+ def publish_options(*options, &block)
153
+ raise "Invalid call with parameters and block!" if options.size > 0 && block
154
+ if options.empty? && block.nil?
155
+ if @publish_options_calc
156
+ @publish_options ||= @publish_options_calc.call(self)
157
+ else
158
+ @publish_options ||= {}
159
+ end
160
+ else
161
+ if options.size > 0 && block.nil?
162
+ raise "publish options value invalid #{options.join(', ')}" unless options.size == 1
163
+ @publish_options = options[0]
164
+ self
165
+ else
166
+ @publish_options_calc = block
167
+ self
168
+ end
169
+ end
170
+ end
171
+
172
+ # Sets the additional properties for the ivy process use a Hash with the properties to set.
173
+ def properties(*properties)
174
+ if properties.empty?
175
+ @properties ||= {}
176
+ else
177
+ raise "properties value invalid #{properties.join(', ')}" unless properties.size == 1
178
+ @properties = properties[0]
179
+ self
180
+ end
181
+ end
182
+
183
+ # Sets the local repository for ivy files
184
+ def local_repository(*local_repository)
185
+ if local_repository.empty?
186
+ @local_repository ||= "#{home}/repository"
187
+ else
188
+ raise "local_repository value invalid #{local_repository.join(', ')}" unless local_repository.size == 1
189
+ @local_repository = local_repository[0]
190
+ self
191
+ end
192
+ end
193
+
194
+ # Sets the directory to publish artifacts from.
195
+ def publish_from(*publish_dir)
196
+ if publish_dir.empty?
197
+ @publish_from ||= @application.original_dir
198
+ else
199
+ raise "publish_from value invalid #{publish_dir.join(', ')}" unless publish_dir.size == 1
200
+ @publish_from = publish_dir[0]
201
+ self
202
+ end
203
+ end
204
+
205
+ # Sets the directory to create dependency reports in.
206
+ def report_dir(*report_dir)
207
+ if report_dir.empty?
208
+ @report_dir ||= @application.original_dir
209
+ else
210
+ raise "publish_from value invalid #{report_dir.join(', ')}" unless report_dir.size == 1
211
+ @report_dir = report_dir[0]
212
+ self
213
+ end
214
+ end
215
+ end
216
+
217
+
218
+ class Tasks < ::Rake::TaskLib
219
+ def initialize(ivy = nil, &block)
220
+ @ivy = ivy || Rake::Ivy::IvyConfig.new(Rake.application)
221
+ yield @ivy if block_given?
222
+ Rake.application.ivy = @ivy
223
+
224
+ define
225
+ end
226
+
227
+ private
228
+ def define
229
+ namespace 'ivy' do
230
+ task :configure do
231
+ Rake.application.ivy.configure
232
+ end
233
+
234
+ desc 'Resolves the ivy dependencies'
235
+ task :resolve => "ivy:configure" do
236
+ Rake.application.ivy.resolve
237
+ end
238
+
239
+ desc 'Publish the artifacts to ivy repository'
240
+ task :publish => "ivy:resolve" do
241
+ Rake.application.ivy.publish
242
+ end
243
+
244
+ desc 'Creates a dependency report for the project'
245
+ task :report => "ivy:resolve" do
246
+ Rake.application.ivy.report
247
+ end
248
+
249
+ desc 'Clean the local Ivy cache and the local ivy repository'
250
+ task :clean do
251
+ Rake.application.ivy.ant.clean
252
+ end
253
+ end
254
+ end
255
+ end
256
+ end
257
+ end
@@ -9,8 +9,6 @@ module Ivy
9
9
 
10
10
  def setup
11
11
  ivy4r = Ivy4r.new
12
- ivy4r.ant_home = File.join(File.dirname(__FILE__), '..', '..', 'jars')
13
- ivy4r.lib_dir = ivy4r.ant_home
14
12
  @ivy_test_xml = File.join(File.dirname(__FILE__), 'ivytest.xml')
15
13
  @info = Ivy::Info.new(ivy4r.ant)
16
14
  end
@@ -11,8 +11,6 @@ module Ivy
11
11
 
12
12
  def setup
13
13
  @ivy4r = Ivy4r.new
14
- @ivy4r.ant_home = File.join(File.dirname(__FILE__), '..', 'jars')
15
- @ivy4r.lib_dir = @ivy4r.ant_home
16
14
  @ivy_test_xml = File.join(File.dirname(__FILE__), 'ivy', 'ivytest.xml')
17
15
  end
18
16
 
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.3.0
4
+ version: 0.5.1
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: 2009-06-19 00:00:00 +02:00
12
+ date: 2009-06-24 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,6 +22,16 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 0.7.0
24
24
  version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: ivy4r-jars
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.0
34
+ version:
25
35
  - !ruby/object:Gem::Dependency
26
36
  name: hoe
27
37
  type: :development
@@ -49,9 +59,6 @@ files:
49
59
  - README.txt
50
60
  - Rakefile
51
61
  - bin/ivy4r
52
- - jars/lib/ant-1.7.1.jar
53
- - jars/lib/ant-launcher-1.7.1.jar
54
- - jars/lib/ant-trax-1.7.1.jar
55
62
  - lib/buildr/ivy_extension.rb
56
63
  - lib/ivy/artifactproperty.rb
57
64
  - lib/ivy/artifactreport.rb
@@ -72,6 +79,7 @@ files:
72
79
  - lib/ivy/target.rb
73
80
  - lib/ivy/targets.rb
74
81
  - lib/ivy4r.rb
82
+ - lib/rake/ivy_extension.rb
75
83
  - test/buildlist/p1/buildfile
76
84
  - test/buildlist/p1/ivy.xml
77
85
  - test/buildlist/sub/p2/buildfile
@@ -105,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
113
  version:
106
114
  requirements: []
107
115
 
108
- rubyforge_project: ivy4r
116
+ rubyforge_project: hamburgrb
109
117
  rubygems_version: 1.3.1
110
118
  signing_key:
111
119
  specification_version: 2
Binary file
Binary file