Sweet, I really like the way you choose which language to use and for what purpose :D.
On Mon, May 2, 2011 at 4:16 PM, <[email protected]> wrote: > 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) > + } > + } > +} > > > -- Thanks - Mohammad Nour Author of (WebSphere Application Server Community Edition 2.0 User Guide) http://www.redbooks.ibm.com/abstracts/sg247585.html - LinkedIn: http://www.linkedin.com/in/mnour - Blog: http://tadabborat.blogspot.com ---- "Life is like riding a bicycle. To keep your balance you must keep moving" - Albert Einstein "Writing clean code is what you must do in order to call yourself a professional. There is no reasonable excuse for doing anything less than your best." - Clean Code: A Handbook of Agile Software Craftsmanship "Stay hungry, stay foolish." - Steve Jobs
