6 Dir["src/**/*.java"].each { |file|
\r
7 lines = open(file) { |f| f.readlines }
\r
8 next if lines[1].include?("Copyright")
\r
10 out = Tempfile.new("tempfile")
\r
11 puts "apply license to #{file}"
\r
13 /*--------------------------------------------------------------------------
\r
14 * Copyright 2007 Taro L. Saito
\r
16 * Licensed under the Apache License, Version 2.0 (the "License");
\r
17 * you may not use this file except in compliance with the License.
\r
18 * You may obtain a copy of the License at
\r
20 * http://www.apache.org/licenses/LICENSE-2.0
\r
22 * Unless required by applicable law or agreed to in writing, software
\r
23 * distributed under the License is distributed on an "AS IS" BASIS,
\r
24 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
25 * See the License for the specific language governing permissions and
\r
26 * limitations under the License.
\r
27 *--------------------------------------------------------------------------*/
\r
29 out.puts NKF.nkf('-Lw', license)
\r
30 lines.each { |l| out.print(NKF.nkf('-Lw', l)) }
\r
33 FileUtils.mv(out.path, file)
\r