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