lib/java/ant.rb in buildr-0.21.0 vs lib/java/ant.rb in buildr-0.22.0

- old
+ new

@@ -1,78 +1,77 @@ require "core/project" require "java/java" module Buildr - module Java - module Ant + module Ant - # Libraries used by #ant. - REQUIRES = [ "ant:ant:jar:1.6.5", "ant:ant-launcher:jar:1.6.5", "xerces:xercesImpl:jar:2.6.2" ] + # Libraries used by #ant. + REQUIRES = [ "ant:ant:jar:1.6.5", "ant:ant-launcher:jar:1.6.5", "xerces:xercesImpl:jar:2.6.2" ] - # Make sure Ant and friends show on the classpath. Antwrap must only be loaded after RJB. + # Make sure Ant and friends show on the classpath. Antwrap must only be loaded after RJB. + Java.rjb.onload do Java.rjb.classpath += REQUIRES Java.rjb.onload { require "antwrap" } + end - class << self + class << self - # :call-seq: - # declarative(name, options?) => AntProject - # declarative(name, options?) { |AntProject| ... } => AntProject - # - # Returns a declarative AntProject with the specified name. Ant tasks created in this project - # are not executed until you tell them to. - # - # See #ant for more information about options and the block. - def declarative(name, options = nil, &block) - options ||= {} - options = (options || {}).merge(:name=>name, :base_dir=>Dir.pwd, :declarative=>false) - Java.rjb { AntProject.new(options).tap { |project| yield project if block_given? } } - end - - # :call-seq: - # executable(name, options?) => AntProject - # executable(name, options?) { |AntProject| ... } => AntProject - # - # Returns an executable AntProject with the specified name. Ant tasks created in this project - # are executed immediately. - # - # See #ant for more information about options and the block. - def executable(name, options = nil, &block) - options ||= {} - options = (options || {}).merge(:name=>name, :base_dir=>Dir.pwd, :declarative=>true) - Java.rjb { AntProject.new(options).tap { |project| yield project if block_given? } } - end + # :call-seq: + # declarative(name, options?) => AntProject + # declarative(name, options?) { |AntProject| ... } => AntProject + # + # Returns a declarative AntProject with the specified name. Ant tasks created in this project + # are not executed until you tell them to. + # + # See #ant for more information about options and the block. + def declarative(name, options = nil, &block) + options ||= {} + options = (options || {}).merge(:name=>name, :base_dir=>Dir.pwd, :declarative=>false) + Java.rjb { AntProject.new(options).tap { |project| yield project if block_given? } } end # :call-seq: - # ant(name, options?) => AntProject - # ant(name, options?) { |AntProject| ... } => AntProject + # executable(name, options?) => AntProject + # executable(name, options?) { |AntProject| ... } => AntProject # - # Returns a new AntProject with the specified name. Ant tasks created in this project are - # executed immediately. + # Returns an executable AntProject with the specified name. Ant tasks created in this project + # are executed immediately. # - # The options hash is passed to the Ant project definition, along with the current directory. - # When used in a Buildr project, the Ant project will have the same base directory. - # If you pass a block, yields to the block with the Ant project. - # - # For example: - # ant("hibernatedoclet") do |doclet| - # doclet.taskdef :name=>"hibernatedoclet", - # :classname=>"xdoclet.modules.hibernate.HibernateDocletTask", :classpath=>DOCLET - # doclet.hibernatedoclet :destdir=>dest_dir, :force=>"true" do - # hibernate :version=>"3.0" - # fileset :dir=>source, :includes=>"**/*.java" - # end - # end - def ant(name, options=nil, &block) - Java::Ant.executable(name, options, &block) + # See #ant for more information about options and the block. + def executable(name, options = nil, &block) + options ||= {} + options = (options || {}).merge(:name=>name, :base_dir=>Dir.pwd, :declarative=>true) + Java.rjb { AntProject.new(options).tap { |project| yield project if block_given? } } end + end + # :call-seq: + # ant(name, options?) => AntProject + # ant(name, options?) { |AntProject| ... } => AntProject + # + # Returns a new AntProject with the specified name. Ant tasks created in this project are + # executed immediately. + # + # The options hash is passed to the Ant project definition, along with the current directory. + # When used in a Buildr project, the Ant project will have the same base directory. + # If you pass a block, yields to the block with the Ant project. + # + # For example: + # ant("hibernatedoclet") do |doclet| + # doclet.taskdef :name=>"hibernatedoclet", + # :classname=>"xdoclet.modules.hibernate.HibernateDocletTask", :classpath=>DOCLET + # doclet.hibernatedoclet :destdir=>dest_dir, :force=>"true" do + # hibernate :version=>"3.0" + # fileset :dir=>source, :includes=>"**/*.java" + # end + # end + def ant(name, options=nil, &block) + Ant.executable(name, options, &block) end end class Project - include Java::Ant + include Ant end end