lib/buildr/ivy_extension.rb in ivy4r-0.7.0 vs lib/buildr/ivy_extension.rb in ivy4r-0.7.1

- old
+ new

@@ -113,13 +113,13 @@ end end end # Resolves the configured file once. - def resolve + def __resolve__ if @base_ivy - @base_ivy.resolve + @base_ivy.__resolve__ else unless @resolved @resolved = ant.resolve :file => file @project.send(:info, "Calling '#{post_resolve_tasks.size}' post_resolve tasks for '#{@project.name}'") post_resolve_tasks.each { |p| p.call(self) } @@ -144,13 +144,13 @@ def report ant.report :todir => report_dir end # Publishs the project as defined in ivy file if it has not been published already - def publish + def __publish__ if @base_ivy - @base_ivy.publish + @base_ivy.__publish__ else unless @published options = {:status => status, :pubrevision => revision, :artifactspattern => "#{publish_from}/[artifact].[ext]"} options = publish_options * options ant.publish options @@ -278,10 +278,14 @@ @local_repository = local_repository[0] self end end + # :call-seq: + # ivy.publish(package(:jar) => 'new_name_without_version_number.jar') + # #deprecated! ivy.name(package(:jar) => 'new_name_without_version_number.jar') + # # Maps a package to a different name for publishing. This name is used instead of the default name # for publishing use a hash with the +package+ as key and the newly mapped name as value. I.e. # <tt>ivy.name(package(:jar) => 'new_name_without_version_number.jar')</tt> # Note that this method is additive, a second call adds the names to the first. def name(*name_mappings) @@ -291,10 +295,11 @@ raise "name_mappings value invalid #{name_mappings.join(', ')}" unless name_mappings.size == 1 @name_mappings = @name_mappings ? @name_mappings + name_mappings[0] : name_mappings[0].dup self end end + alias_method :publish, :name # Sets the directory to publish artifacts from. def publish_from(*publish_dir) if publish_dir.empty? if own_file? @@ -393,16 +398,16 @@ end end private def target(targets) - t = targets.to_s.split('_').find { |t| TARGETS.member? t.to_sym } + t = targets.to_s.split('_').find { |target| TARGETS.member? target.to_sym } t ? t.to_sym : nil end def type(types) - t = types.to_s.split('_').find { |t| TYPES.member? t.to_sym } + t = types.to_s.split('_').find { |type| TYPES.member? type.to_sym } t ? t.to_sym : nil end def valid_config_call?(method_name) valid_calls = [] @@ -463,11 +468,11 @@ project.task :compiledeps => resolve_target do includes = project.ivy.compile_include excludes = project.ivy.compile_exclude confs = [project.ivy.compile_conf].flatten if deps = project.ivy.filter(confs, :include => includes, :exclude => excludes) - project.compile.with deps + project.compile.with [project.compile.dependencies, deps].flatten info "Ivy adding compile dependencies '#{confs.join(', ')}' to project '#{project.name}'" end end project.task :compile => "#{project.name}:compiledeps" @@ -475,11 +480,11 @@ project.task :testdeps => resolve_target do includes = project.ivy.test_include excludes = project.ivy.test_exclude confs = [project.ivy.test_conf, project.ivy.compile_conf].flatten.uniq if deps = project.ivy.filter(confs, :include => includes, :exclude => excludes) - project.test.with deps + project.test.with [project.test.dependencies, deps].flatten info "Ivy adding test dependencies '#{confs.join(', ')}' to project '#{project.name}'" end end project.task "test:compile" => "#{project.name}:testdeps" @@ -516,11 +521,11 @@ task = project.task name => project.ivy.file_project.task('ivy:resolve') do includes = project.ivy.package_include excludes = project.ivy.package_exclude confs = project.ivy.package_conf if deps = project.ivy.filter(confs, :include => includes, :exclude => excludes) - pkg.with :libs => deps + pkg.with :libs => [pkg.libs, deps].flatten info "Adding production libs from conf '#{confs.join(', ')}' to package '#{pkg.name}' in project '#{project.name}'" end end project.task :build => task end @@ -593,18 +598,18 @@ task :configure do project.ivy.configure end task :resolve => "#{project.name}:ivy:configure" do - project.ivy.resolve + project.ivy.__resolve__ end task :report => "#{project.name}:ivy:resolve" do project.ivy.report end task :publish => "#{project.name}:ivy:resolve" do - project.ivy.publish + project.ivy.__publish__ end end end end end