annotate .svn/pristine/5f/5fdc3b8b927a8add790e209403b886f1225320fa.svn-base @ 1519:afce8026aaeb redmine-2.4-integration

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