isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1098551 - /incubator/isis/trunk/addmissinglicenses.groovy
Date Mon, 02 May 2011 13:16:42 GMT
Author: danhaywood
Date: Mon May  2 13:16:42 2011
New Revision: 1098551

URL: http://svn.apache.org/viewvc?rev=1098551&view=rev
Log:
adding addmissinglicenses.groovy script

Added:
    incubator/isis/trunk/addmissinglicenses.groovy

Added: incubator/isis/trunk/addmissinglicenses.groovy
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/addmissinglicenses.groovy?rev=1098551&view=auto
==============================================================================
--- incubator/isis/trunk/addmissinglicenses.groovy (added)
+++ incubator/isis/trunk/addmissinglicenses.groovy Mon May  2 13:16:42 2011
@@ -0,0 +1,42 @@
+def license="""/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+"""
+
+def fileEndings = [".java"]
+//def fileEndings = [".xml", ".java", ".properties"]
+
+
+def currentDir = new File(".");
+
+currentDir.eachFileRecurse { file ->
+  def endsWithFileEnding = 
+    fileEndings.inject(false) { endsWith, fileEnding -> 
+      endsWith || file.name.endsWith(fileEnding) 
+    }
+  if (endsWithFileEnding) {
+    def fileText = file.text;
+
+    def matchingText = fileText.find(".*Licensed to the Apache Software Foundation.*")
+    if(matchingText == null) {
+      println file.canonicalPath
+      file.write(license)
+      file.append(fileText)
+    }    
+  }
+}



Mime
View raw message