lib/buildr/hibernate.rb in buildr-1.1.3 vs lib/buildr/hibernate.rb in buildr-1.2.0

- old
+ new

@@ -1,9 +1,11 @@ require "java/java" require "java/ant" module Buildr + + # Provides Hibernate Doclet and schema export tasks. Require explicitly using <code>require "buildr/hibernate"</code>. module Hibernate REQUIRES = Buildr.struct( :collections => "commons-collections:commons-collections:jar:3.1", :logging => "commons-logging:commons-logging:jar:1.0.3", @@ -27,16 +29,16 @@ # # For example: # doclet :sources=>compile.sources, :target=>compile.target, :excludedtags=>"@version,@author,@todo" def doclet(options) options[:sources].each { |src| file(src).invoke } - ant("hibernatedoclet") do |doclet| - doclet.taskdef :name=>"hibernatedoclet", :classname=>"xdoclet.modules.hibernate.HibernateDocletTask", :classpath=>requires - doclet.hibernatedoclet :destdir=>options[:target].to_s, :excludedtags=>options[:excludedtags], :force=>"true" do - hibernate :version=>"3.0" + ant "hibernatedoclet" do |ant| + ant.taskdef :name=>"hibernatedoclet", :classname=>"xdoclet.modules.hibernate.HibernateDocletTask", :classpath=>requires + ant.hibernatedoclet :destdir=>options[:target].to_s, :excludedtags=>options[:excludedtags], :force=>"true" do + ant.hibernate :version=>"3.0" options[:sources].map(&:to_s).each do |source| - fileset :dir=>source.to_s, :includes=>"**/*.java" + ant.fileset :dir=>source.to_s, :includes=>"**/*.java" end end end end @@ -47,10 +49,10 @@ # Buildr::Hibernate.schemaexport(:properties=>properties.to_s, :quiet=>"yes", :text=>"yes", :delimiter=>";", # :drop=>"no", :create=>"yes", :output=>target) do # fileset :dir=>source.to_s, :includes=>"**/*.hbm.xml" # end def schemaexport(options = nil, &block) - ant("schemaexport") do |ant| + ant "schemaexport" do |ant| ant.taskdef :name=>"schemaexport", :classname=>"org.hibernate.tool.hbm2ddl.SchemaExportTask", :classpath=>requires ant.schemaexport options, &block if options end end