Author: rdonkin
Date: Mon Aug  6 20:42:04 2012
New Revision: 1369997

URL: http://svn.apache.org/viewvc?rev=1369997&view=rev
Log:
Add support for primary copyright notice, for licenses such as MIT

Added:
    
creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/minimal/verify.groovy
      - copied, changed from r1369625, 
creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/minimal/verify.bsh
Removed:
    creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/minimal/verify.bsh
Modified:
    
creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/Descriptor.java
    
creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/minimal/descriptor.xml
    
creadur/whisker/trunk/apache-whisker-velocity/src/main/resources/org/apache/creadur/whisker/template/velocity/license.vm

Modified: 
creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/Descriptor.java
URL: 
http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/Descriptor.java?rev=1369997&r1=1369996&r2=1369997&view=diff
==============================================================================
--- 
creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/Descriptor.java
 (original)
+++ 
creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/Descriptor.java
 Mon Aug  6 20:42:04 2012
@@ -129,6 +129,15 @@ public class Descriptor {
     }
 
     /**
+     * Is there a primary copyright notice?
+     * @return true if a primary copyright notice
+     * has been set, false otherwise
+     */
+    public boolean isPrimaryCopyrightNotice() {
+        return primaryCopyrightNotice != null;
+    }
+    
+    /**
      * Gets the principle NOTICE for the main work.
      * 
      * @return the primaryNotice

Modified: 
creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/minimal/descriptor.xml
URL: 
http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/minimal/descriptor.xml?rev=1369997&r1=1369996&r2=1369997&view=diff
==============================================================================
--- 
creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/minimal/descriptor.xml 
(original)
+++ 
creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/minimal/descriptor.xml 
Mon Aug  6 20:42:04 2012
@@ -50,7 +50,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DE
             name='An Example Software Vendor' 
             url='http://example.org'/>
     </organisations>
-    <primary-license id='osi:mit'/>
+    <primary-license id='osi:mit'>
+        <copyright-notice>Copyright (c) 2525 Someone</copyright-notice>
+    </primary-license>
     <primary-notice/>
     <primary-organisation id='example.org'/>
     <within dir='.'>

Copied: 
creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/minimal/verify.groovy 
(from r1369625, 
creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/minimal/verify.bsh)
URL: 
http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/minimal/verify.groovy?p2=creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/minimal/verify.groovy&p1=creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/minimal/verify.bsh&r1=1369625&r2=1369997&rev=1369997&view=diff
==============================================================================
--- creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/minimal/verify.bsh 
(original)
+++ 
creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/minimal/verify.groovy 
Mon Aug  6 20:42:04 2012
@@ -17,16 +17,24 @@
  * under the License. 
  */
 
-import java.io.*;
+File license = new File(basedir, "target/LICENSE");
+File notice = new File(basedir, "target/NOTICE");
 
-try {
-    File license = new File(basedir, "target/LICENSE");
-    File notice = new File(basedir, "target/NOTICE");
-    
-    return license.exists() && !notice.exists();    
+assert license.exists()
+assert !notice.exists()
+
+
+def copyright = false
 
-} catch (Throwable t) {
-    t.printStackTrace();
-    return false;
+def reader = new BufferedReader(new InputStreamReader(new 
FileInputStream(license), "UTF-8"))  
+def line = reader.readLine()
+while (line != null) {
+    if (line.contains("Copyright (c) 2525 Someone")) {
+        copyright = true
+    }
+    line = reader.readLine()
 }
+assert copyright
+
+    
 return true;
\ No newline at end of file

Modified: 
creadur/whisker/trunk/apache-whisker-velocity/src/main/resources/org/apache/creadur/whisker/template/velocity/license.vm
URL: 
http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-velocity/src/main/resources/org/apache/creadur/whisker/template/velocity/license.vm?rev=1369997&r1=1369996&r2=1369997&view=diff
==============================================================================
--- 
creadur/whisker/trunk/apache-whisker-velocity/src/main/resources/org/apache/creadur/whisker/template/velocity/license.vm
 (original)
+++ 
creadur/whisker/trunk/apache-whisker-velocity/src/main/resources/org/apache/creadur/whisker/template/velocity/license.vm
 Mon Aug  6 20:42:04 2012
@@ -18,6 +18,10 @@
 ##  under the License.    
 ## 
 
#################################################################################
+#if ( $work.isPrimaryCopyrightNotice() )
+$work.getPrimaryCopyrightNotice()
+
+#end 
 $work.PrimaryLicense.Text
 
 #if ( ! $work.isPrimaryOnly() )


Reply via email to