annotate lib/tasks/redmine.rake @ 1466:834828a14f2b bug_598

Close obsolete branch bug_598
author Chris Cannam
date Fri, 21 Jun 2013 14:51:55 +0100
parents 433d4f72a19b
children 622f24f53b42
rev   line source
Chris@1115 1 # Redmine - project management software
Chris@1115 2 # Copyright (C) 2006-2012 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@1115 24 end
Chris@1115 25
Chris@1115 26 namespace :tokens do
Chris@1115 27 desc 'Removes expired tokens.'
Chris@1115 28 task :prune => :environment do
Chris@1115 29 Token.destroy_expired
Chris@1115 30 end
Chris@1115 31 end
Chris@1115 32
Chris@1115 33 namespace :watchers do
Chris@1115 34 desc 'Removes watchers from what they can no longer view.'
Chris@1115 35 task :prune => :environment do
Chris@1115 36 Watcher.prune
Chris@1115 37 end
Chris@1115 38 end
Chris@1115 39
Chris@1115 40 desc 'Fetch changesets from the repositories'
Chris@1115 41 task :fetch_changesets => :environment do
Chris@1115 42 Repository.fetch_changesets
Chris@1115 43 end
Chris@1115 44
Chris@1115 45 desc 'Migrates and copies plugins assets.'
Chris@1115 46 task :plugins do
Chris@1115 47 Rake::Task["redmine:plugins:migrate"].invoke
Chris@1115 48 Rake::Task["redmine:plugins:assets"].invoke
Chris@1115 49 end
Chris@1115 50
Chris@1115 51 namespace :plugins do
Chris@1115 52 desc 'Migrates installed plugins.'
Chris@1115 53 task :migrate => :environment do
Chris@1115 54 name = ENV['NAME']
Chris@1115 55 version = nil
Chris@1115 56 version_string = ENV['VERSION']
Chris@1115 57 if version_string
Chris@1115 58 if version_string =~ /^\d+$/
Chris@1115 59 version = version_string.to_i
Chris@1115 60 if name.nil?
Chris@1115 61 abort "The VERSION argument requires a plugin NAME."
Chris@1115 62 end
Chris@1115 63 else
Chris@1115 64 abort "Invalid VERSION #{version_string} given."
Chris@1115 65 end
Chris@1115 66 end
Chris@1115 67
Chris@1115 68 begin
Chris@1115 69 Redmine::Plugin.migrate(name, version)
Chris@1115 70 rescue Redmine::PluginNotFound
Chris@1115 71 abort "Plugin #{name} was not found."
Chris@1115 72 end
Chris@1115 73
Chris@1115 74 Rake::Task["db:schema:dump"].invoke
Chris@1115 75 end
Chris@1115 76
Chris@1115 77 desc 'Copies plugins assets into the public directory.'
Chris@1115 78 task :assets => :environment do
Chris@1115 79 name = ENV['NAME']
Chris@1115 80
Chris@1115 81 begin
Chris@1115 82 Redmine::Plugin.mirror_assets(name)
Chris@1115 83 rescue Redmine::PluginNotFound
Chris@1115 84 abort "Plugin #{name} was not found."
Chris@1115 85 end
Chris@1115 86 end
Chris@1115 87
Chris@1115 88 desc 'Runs the plugins tests.'
Chris@1115 89 task :test do
Chris@1115 90 Rake::Task["redmine:plugins:test:units"].invoke
Chris@1115 91 Rake::Task["redmine:plugins:test:functionals"].invoke
Chris@1115 92 Rake::Task["redmine:plugins:test:integration"].invoke
Chris@1115 93 end
Chris@1115 94
Chris@1115 95 namespace :test do
Chris@1115 96 desc 'Runs the plugins unit tests.'
Chris@1115 97 Rake::TestTask.new :units => "db:test:prepare" do |t|
Chris@1115 98 t.libs << "test"
Chris@1115 99 t.verbose = true
Chris@1115 100 t.pattern = "plugins/#{ENV['NAME'] || '*'}/test/unit/**/*_test.rb"
Chris@1115 101 end
Chris@1115 102
Chris@1115 103 desc 'Runs the plugins functional tests.'
Chris@1115 104 Rake::TestTask.new :functionals => "db:test:prepare" do |t|
Chris@1115 105 t.libs << "test"
Chris@1115 106 t.verbose = true
Chris@1115 107 t.pattern = "plugins/#{ENV['NAME'] || '*'}/test/functional/**/*_test.rb"
Chris@1115 108 end
Chris@1115 109
Chris@1115 110 desc 'Runs the plugins integration tests.'
Chris@1115 111 Rake::TestTask.new :integration => "db:test:prepare" do |t|
Chris@1115 112 t.libs << "test"
Chris@1115 113 t.verbose = true
Chris@1115 114 t.pattern = "plugins/#{ENV['NAME'] || '*'}/test/integration/**/*_test.rb"
Chris@1115 115 end
Chris@1115 116 end
Chris@1115 117 end
Chris@1115 118 end
Chris@1115 119
Chris@1115 120 # Load plugins' rake tasks
Chris@1115 121 Dir[File.join(Rails.root, "plugins/*/lib/tasks/**/*.rake")].sort.each { |ext| load ext }