Sha256: 4a1c60eec1a164e0d26f18c343059e6a3ecf36011d374cc803ba70217e0aec2a
Contents?: true
Size: 1.3 KB
Versions: 11
Compression:
Stored size: 1.3 KB
Contents
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com> # Distributed under the terms of the MIT license. # See the LICENSE file that accompanied this software for the full MIT License text # require "pathname" task :legal do license = Pathname("LICENSE") license.open("w+") do |f| f.puts PROJECT_COPYRIGHT end unless license.file? and license.read == PROJECT_COPYRIGHT doc = Pathname("doc/LEGAL") doc.open("w+") do |f| f.puts "LICENSE" end unless doc.file? end desc "add copyright summary to all .rb files in the distribution" task :copyright => [:legal] do doc = Pathname("doc/LEGAL") ignore = doc.readlines. select { |line| line.strip!; Pathname(line).file? }. map { |file| Pathname(file).expand_path } puts "adding copyright summary to files that don't have it currently" puts PROJECT_COPYRIGHT_SUMMARY puts (Pathname.glob('{controller,model,app,lib,test,spec}/**/*{.rb}') + Pathname.glob("tasks/*.rake") + Pathname.glob("Rakefile")).each do |file| next if ignore.include? file.expand_path lines = file.readlines.map{ |l| l.chomp } unless lines.first(PROJECT_COPYRIGHT_SUMMARY.size) == PROJECT_COPYRIGHT_SUMMARY oldlines = file.readlines file.open("w+") { |f| f.puts PROJECT_COPYRIGHT_SUMMARY + oldlines } end end end
Version data entries
11 entries across 8 versions & 5 rubygems