From e5f516c5877a2bd27cf7c101567a19bb18c7b969 Mon Sep 17 00:00:00 2001 From: Philipp Tessenow Date: Tue, 3 Sep 2013 17:40:54 +0200 Subject: [PATCH] have copyrights in some special files --- .gitignore | 11 +++++++++++ .rspec | 11 +++++++++++ .travis.yml | 11 +++++++++++ Gemfile | 11 +++++++++++ Guardfile | 11 +++++++++++ Rakefile | 12 +++++++++++- config.ru | 11 +++++++++++ lib/tasks/copyright.rake | 17 ++++++++++++++--- 8 files changed, 91 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 2b7c53e22a5..cf611cf11f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,14 @@ +#-- copyright +# OpenProject is a project management system. +# +# Copyright (C) 2012-2013 the OpenProject Team +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# See doc/COPYRIGHT.rdoc for more details. +#++ + # See http://help.github.com/ignore-files/ for more about ignoring files. # # If you find yourself ignoring temporary files generated by your text editor diff --git a/.rspec b/.rspec index 4e1e0d2f722..d4c57f436e1 100644 --- a/.rspec +++ b/.rspec @@ -1 +1,12 @@ +#-- copyright +# OpenProject is a project management system. +# +# Copyright (C) 2012-2013 the OpenProject Team +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# See doc/COPYRIGHT.rdoc for more details. +#++ + --color diff --git a/.travis.yml b/.travis.yml index faafe43fb4f..8ac3913510a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,14 @@ +#-- copyright +# OpenProject is a project management system. +# +# Copyright (C) 2012-2013 the OpenProject Team +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# See doc/COPYRIGHT.rdoc for more details. +#++ + language: ruby rvm: - 1.9.3 diff --git a/Gemfile b/Gemfile index ed1b7000dad..97871e69dad 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,14 @@ +#-- copyright +# OpenProject is a project management system. +# +# Copyright (C) 2012-2013 the OpenProject Team +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# See doc/COPYRIGHT.rdoc for more details. +#++ + source 'https://rubygems.org' gem "rails", "~> 3.2.14" diff --git a/Guardfile b/Guardfile index 1768a47b683..47ab1be311d 100644 --- a/Guardfile +++ b/Guardfile @@ -1,3 +1,14 @@ +#-- copyright +# OpenProject is a project management system. +# +# Copyright (C) 2012-2013 the OpenProject Team +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# See doc/COPYRIGHT.rdoc for more details. +#++ + # :spork guard must come first # guard :spork, :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do # watch('config/application.rb') diff --git a/Rakefile b/Rakefile index 7aaf77da13e..096480939e0 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,14 @@ -#!/usr/bin/env rake +#-- copyright +# OpenProject is a project management system. +# +# Copyright (C) 2012-2013 the OpenProject Team +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# See doc/COPYRIGHT.rdoc for more details. +#++ + # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. diff --git a/config.ru b/config.ru index 8a9cdcc4d72..9100fa7ff79 100644 --- a/config.ru +++ b/config.ru @@ -1,3 +1,14 @@ +#-- copyright +# OpenProject is a project management system. +# +# Copyright (C) 2012-2013 the OpenProject Team +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# See doc/COPYRIGHT.rdoc for more details. +#++ + # This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) diff --git a/lib/tasks/copyright.rake b/lib/tasks/copyright.rake index d0e0cce574c..008e68d44b7 100644 --- a/lib/tasks/copyright.rake +++ b/lib/tasks/copyright.rake @@ -62,10 +62,11 @@ namespace :copyright do def rewrite_copyright(ending, exclude, format, path, options = {}) regexp = options[:regex] || copyright_regexp(format) copyright = options[:copyright] || short_copyright(format) - path = '.' if path.nil? + file_list = options[:file_list] || Dir[File.absolute_path(path) + "/**/*.#{ending}"] + raise "Path not found" unless Dir.exists?(path) - Dir[File.absolute_path(path) + "/**/*.#{ending}"].each do |file_name| + file_list.each do |file_name| # Skip 3rd party code next if exclude.any? {|e| file_name.include?(e) } @@ -86,6 +87,15 @@ namespace :copyright do end end + desc "Update special files, which do not have an ending" + task :update_special_files, :arg1 do |task, args| + # ruby-like files + file_list = %w{Gemfile Guardfile Rakefile config.ru .travis.yml .rspec .gitignore}.map do |f| + File.absolute_path f + end + rewrite_copyright("rb", [], :rb, args[:arg1], :file_list => file_list) + end + desc "Update the copyright on .rb source files" task :update_rb, :arg1 do |task, args| excluded = (["diff", @@ -190,7 +200,8 @@ namespace :copyright do :update_rake, :update_feature, :update_rdoc, - :update_md].each do |t| + :update_md, + :update_special_files].each do |t| Rake::Task['copyright:' + t.to_s].invoke(args[:arg1]) end end