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