jicarilla-suf/scripts change-modification-notice.rb,NONE,1.1

Leo Simons <[email protected]> Sun, 11 Apr 2004 20:53:30 +0000
Newsgroups gmane.comp.java.jicarilla.cvs
Message-ID <[email protected]>
Update of /cvsroot/jicarilla/jicarilla-suf/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24353/scripts

Added Files:
	change-modification-notice.rb 
Log Message:
AL requires we add a notice if we change files. So lets add a notice.

--- NEW FILE: change-modification-notice.rb ---
def processFile( sourceFile )
    puts "processing " + sourceFile
    
    source = File.open( sourceFile, 'r' )
    text = source.read
    
    if text =~ /\(c\) 2004 Leo Simons/ then
      return
    end
    
    source.close
    
    text.gsub!( /\*\/\n+package /, "*
 * ====================================================================
 *
 * This file has been modified from the original file as it was
 * distributed by The Apache Software Foundation. These modifications
 * are
 * 
 * copyright (c) 2004 Leo Simons
 *
 * These modifications are licensed 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.
 */
package " )

    dest = File.open( sourceFile, 'w' )
    dest.write text
    dest.close
end

def processAll( files )
    count = 0
    files.each { |path|
      projectFile = path.gsub( /\n/, "" )
      projectFile.gsub!( /\.\//, "" )
      
      processFile( projectFile )
      count = count + 1
    }
    return count
end

 # runs the processor
 def main()
     files = `find . -type f -name '*.java'`
     count = processAll( files )
 
     puts "transformed #{count} files.\n"
 end
 
 main()
 


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click