annotate lib/tasks/redmine.rake @ 1516:b450a9d58aed redmine-2.4

Update to Redmine SVN revision 13356 on 2.4-stable branch
author Chris Cannam
date Tue, 09 Sep 2014 09:28:31 +0100
parents e248c7af89ec
children dffacf8a6908
rev   line source
Chris@1115 1 # Redmine - project management software
Chris@1494 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
Chris@1115 3 #
Chris@1115 4 # This program is free software; you can redistribute it and/or
Chris@1115 5 # modify it under the terms of the GNU General Public License
Chris@1115 6 # as published by the Free Software Foundation; either version 2
Chris@1115 7 # of the License, or (at your option) any later version.
Chris@1115 8 #
Chris@1115 9 # This program is distributed in the hope that it will be useful,
Chris@1115 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@1115 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@1115 12 # GNU General Public License for more details.
Chris@1115 13 #
Chris@1115 14 # You should have received a copy of the GNU General Public License
Chris@1115 15 # along with this program; if not, write to the Free Software
Chris@1115 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@1115 17
Chris@1115 18 namespace :redmine do
Chris@1115 19 namespace :attachments do
Chris@1115 20 desc 'Removes uploaded files left unattached after one day.'
Chris@1115 21 task :prune => :environment do
Chris@1115 22 Attachment.prune
Chris@1115 23 end
Chris@1464 24
Chris@1464 25 desc 'Moves attachments stored at the root of the file directory (ie. created before Redmine 2.3) to their subdirectories'
Chris@1464 26 task :move_to_subdirectories => :environment do
Chris@1464 27 Attachment.move_from_root_to_target_directory
Chris@1464 28 end
Chris@1115 29 end
Chris@1115 30
Chris@1115 31 namespace :tokens do
Chris@1115 32 desc 'Removes expired tokens.'
Chris@1115 33 task :prune => :environment do
Chris@1115 34 Token.destroy_expired
Chris@1115 35 end
Chris@1115 36 end
Chris@1115 37
Chris@1115 38 namespace :watchers do
Chris@1115 39 desc 'Removes watchers from what they can no longer view.'
Chris@1115 40 task :prune => :environment do
Chris@1115 41 Watcher.prune
Chris@1115 42 end
Chris@1115 43 end
Chris@1115 44
Chris@1115 45 desc 'Fetch changesets from the repositories'
Chris@1115 46 task :fetch_changesets => :environment do
Chris@1115 47 Repository.fetch_changesets
Chris@1115 48 end
Chris@1115 49
Chris@1115 50 desc 'Migrates and copies plugins assets.'
Chris@1115 51 task :plugins do
Chris@1115 52 Rake::Task["redmine:plugins:migrate"].invoke
Chris@1115 53 Rake::Task["redmine:plugins:assets"].invoke
Chris@1115 54 end
Chris@1115 55
Chris@1115 56 namespace :plugins do
Chris@1115 57 desc 'Migrates installed plugins.'
Chris@1115 58 task :migrate => :environment do
Chris@1115 59 name = ENV['NAME']
Chris@1115 60 version = nil
Chris@1115 61 version_string = ENV['VERSION']
Chris@1115 62 if version_string
Chris@1115 63 if version_string =~ /^\d+$/
Chris@1115 64 version = version_string.to_i
Chris@1115 65 if name.nil?
Chris@1115 66 abort "The VERSION argument requires a plugin NAME."
Chris@1115 67 end
Chris@1115 68 else
Chris@1115 69 abort "Invalid VERSION #{version_string} given."
Chris@1115 70 end
Chris@1115 71 end
Chris@1115 72
Chris@1115 73 begin
Chris@1115 74 Redmine::Plugin.migrate(name, version)
Chris@1115 75 rescue Redmine::PluginNotFound
Chris@1115 76 abort "Plugin #{name} was not found."
Chris@1115 77 end
Chris@1115 78
Chris@1115 79 Rake::Task["db:schema:dump"].invoke
Chris@1115 80 end
Chris@1115 81
Chris@1115 82 desc 'Copies plugins assets into the public directory.'
Chris@1115 83 task :assets => :environment do
Chris@1115 84 name = ENV['NAME']
Chris@1115 85
Chris@1115 86 begin
Chris@1115 87 Redmine::Plugin.mirror_assets(name)
Chris@1115 88 rescue Redmine::PluginNotFound
Chris@1115 89 abort "Plugin #{name} was not found."
Chris@1115 90 end
Chris@1115 91 end
Chris@1115 92
Chris@1115 93 desc 'Runs the plugins tests.'
Chris@1115 94 task :test do
Chris@1115 95 Rake::Task["redmine:plugins:test:units"].invoke
Chris@1115 96 Rake::Task["redmine:plugins:test:functionals"].invoke
Chris@1115 97 Rake::Task["redmine:plugins:test:integration"].invoke
Chris@1115 98 end
Chris@1115 99
Chris@1115 100 namespace :test do
Chris@1115 101 desc 'Runs the plugins unit tests.'
Chris@1115 102 Rake::TestTask.new :units => "db:test:prepare" do |t|
Chris@1115 103 t.libs << "test"
Chris@1115 104 t.verbose = true
Chris@1115 105 t.pattern = "plugins/#{ENV['NAME'] || '*'}/test/unit/**/*_test.rb"
Chris@1115 106 end
Chris@1115 107
Chris@1115 108 desc 'Runs the plugins functional tests.'
Chris@1115 109 Rake::TestTask.new :functionals => "db:test:prepare" do |t|
Chris@1115 110 t.libs << "test"
Chris@1115 111 t.verbose = true
Chris@1115 112 t.pattern = "plugins/#{ENV['NAME'] || '*'}/test/functional/**/*_test.rb"
Chris@1115 113 end
Chris@1115 114
Chris@1115 115 desc 'Runs the plugins integration tests.'
Chris@1115 116 Rake::TestTask.new :integration => "db:test:prepare" do |t|
Chris@1115 117 t.libs << "test"
Chris@1115 118 t.verbose = true
Chris@1115 119 t.pattern = "plugins/#{ENV['NAME'] || '*'}/test/integration/**/*_test.rb"
Chris@1115 120 end
Chris@1115 121 end
Chris@1115 122 end
Chris@1115 123 end
Chris@1115 124
Chris@1115 125 # Load plugins' rake tasks
Chris@1115 126 Dir[File.join(Rails.root, "plugins/*/lib/tasks/**/*.rake")].sort.each { |ext| load ext }