Method: Licit::Licenser#fix_headers

Defined in:
lib/licit/licenser.rb

#fix_headersObject



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/licit/licenser.rb', line 49

def fix_headers
  each_source_file do |source_file|
    if not check_file_header(source_file)
      source_lines = File.readlines source_file



      File.open source_file, 'w' do |f|
        while should_skip? source_lines.first
          f.write source_lines.shift
        end
        header.each_line do |header_line|
          f.puts "# #{header_line}".strip
        end
        f.write "\n"
        source_lines.each do |line|
          f.write line
        end
      end
    end
  end
end