You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2010/11/11 11:23:05 UTC

svn commit: r1033869 - in /buildr/trunk: CHANGELOG doc/packaging.textile lib/buildr/java/packaging.rb spec/java/packaging_spec.rb

Author: donaldp
Date: Thu Nov 11 10:23:04 2010
New Revision: 1033869

URL: http://svn.apache.org/viewvc?rev=1033869&view=rev
Log:
 BUILDR-545 - Add the ability to specify the description element in in application.xml contained within an ear.

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/doc/packaging.textile
    buildr/trunk/lib/buildr/java/packaging.rb
    buildr/trunk/spec/java/packaging_spec.rb

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1033869&r1=1033868&r2=1033869&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Thu Nov 11 10:23:04 2010
@@ -10,6 +10,8 @@
           with classifier
 * Fixed:  BUILDR-522 Send notifications when continuous compilation
           succeeds/fails.
+* Change: BUILDR-545 Add the ability to specify the description element in in
+          application.xml contained within an ear.
 
 1.4.3 (2010-10-15)
 * Added:  BUILDR-514 New 'run' local task. http://buildr.apache.org/more_stuff.html#run

Modified: buildr/trunk/doc/packaging.textile
URL: http://svn.apache.org/viewvc/buildr/trunk/doc/packaging.textile?rev=1033869&r1=1033868&r2=1033869&view=diff
==============================================================================
--- buildr/trunk/doc/packaging.textile (original)
+++ buildr/trunk/doc/packaging.textile Thu Nov 11 10:23:04 2010
@@ -314,12 +314,15 @@ EAR packages include an @application.xml
 
 * *display-name* -- The application's display name defaults to the project's identifier.  You can change that by setting the @display_name@ attribute.
 
+* *description* -- The application's description defaults to the project's comment.  You can change that by setting the @description@ attribute.
+
 * *context-root* -- WAR components specify a context root, based on the package identifier, for example, "cool-web-1.0.war" will have the context root "cool-web".  To specify a different context root, add the WAR package with the @context_root@ option.
 
 Again, by example:
 
 {% highlight ruby %}
 package(:ear).display_name = 'MyCoolWebService'
+package(:ear).description = 'MyCoolWebService: Making coolness kool again'
 package(:ear).add project('coolWebService').package(:war), :context_root=>'coolness'
 {% endhighlight %}
 

Modified: buildr/trunk/lib/buildr/java/packaging.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/packaging.rb?rev=1033869&r1=1033868&r2=1033869&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/packaging.rb (original)
+++ buildr/trunk/lib/buildr/java/packaging.rb Thu Nov 11 10:23:04 2010
@@ -391,6 +391,8 @@ module Buildr
 
         # The display-name entry for application.xml
         attr_accessor :display_name
+        # The description entry for application.xml
+        attr_accessor :description
         # Map from component type to path inside the EAR.
         attr_accessor :dirs
 
@@ -529,6 +531,8 @@ module Buildr
           "http://java.sun.com/j2ee/dtds/application_1_2.dtd"
           xml.application do
             xml.tag! 'display-name', display_name
+            desc = self.description || @project.comment 
+            xml.tag! 'description', desc if desc
             @components.each do |comp|
               basename = comp[:artifact].to_s.pathmap('%f')
               uri = comp[:path].empty? ? basename : File.join(comp[:path], basename)

Modified: buildr/trunk/spec/java/packaging_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/packaging_spec.rb?rev=1033869&r1=1033868&r2=1033869&view=diff
==============================================================================
--- buildr/trunk/spec/java/packaging_spec.rb (original)
+++ buildr/trunk/spec/java/packaging_spec.rb Thu Nov 11 10:23:04 2010
@@ -778,6 +778,28 @@ describe Packaging, 'ear' do
     inspect_application_xml { |xml| xml.get_text('/application/display-name').should == 'bar' }
   end
 
+  it 'should set description in application.xml to project comment if not specified' do
+    desc "MyDescription"
+    define 'foo', :version=>'1.0' do
+      package(:ear)
+    end
+    inspect_application_xml { |xml| xml.get_text('/application/description').should == 'MyDescription' }
+  end
+
+  it 'should not set description in application.xml if not specified and no project comment' do
+    define 'foo', :version=>'1.0' do
+      package(:ear)
+    end
+    inspect_application_xml { |xml| xml.get_text('/application/description').should be_nil }
+  end
+
+  it 'should set description in application.xml if specified' do
+    define 'foo', :version=>'1.0' do
+      package(:ear).description = "MyDescription"
+    end
+    inspect_application_xml { |xml| xml.get_text('/application/description').should == 'MyDescription' }
+  end
+
   it 'should map WARs to /war directory' do
     define 'foo', :version=>'1.0' do
       package(:ear) << package(:war)