annotate .svn/pristine/d6/d6fa2ab030f2e7ebc86e650e4acc6d8328176458.svn-base @ 1298:4f746d8966dd redmine_2.3_integration

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