Sha256: 658b53fce2570766987561fbcddac74f5df67f2f3bdf4fc6e387aa03a71c9093
Contents?: true
Size: 1.02 KB
Versions: 6
Compression:
Stored size: 1.02 KB
Contents
#!/usr/bin/env ruby require 'pathname' ARGV.map! { |x| Pathname.new(x) } ARGV.each do |path| next if path.to_s =~ /header\.rb/ header, body, she_bang = '', '', nil header_mode = true path.each_line do |line| header_mode = false unless line =~ /^\s*$/ or line =~ /^#[! ]/ if line =~ /^#!/ she_bang = line elsif header_mode header += line else body += line end end header =~ /^# Authors?::?\s+(.*)$/ author = $1 raise "No author for #{path}" if author.nil? header =~ /^# Copyright::?\s+Copyright\s+\([cC]\)\s+([\d-, ]*\d)/ years = '2004, 2005' # $1 raise "No years for #{path}" if years.nil? raise "Invalid year format in #{path}" if years =~ /-/ path.open('w') do |f| f.print she_bang unless she_bang.nil? str = <<-end # Author:: #{author} # Copyright:: Copyright (c) #{years} Uttk team. All rights reserved. # License:: LGPL # $Id$ end str.gsub!(/^\s*#/, '#') f.puts str 2.times { f.puts } f.print body end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
uttk-0.3.1.2 | misc/header.rb |
uttk-0.3.5.0 | misc/header.rb |
uttk-0.3.6.1 | misc/header.rb |
uttk-0.4.5.0 | misc/header.rb |
uttk-0.4.6.1 | misc/header.rb |
uttk-0.4.6.2 | misc/header.rb |