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