rails_code_qa 0.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tasks/rails_code_qa.rake +17 -26
- metadata +3 -2
@@ -1,54 +1,45 @@
|
|
1
1
|
require 'rcov/rcovtask'
|
2
2
|
|
3
3
|
desc 'Run all Rails Code QA tests'
|
4
|
-
task :rcqa
|
5
|
-
tasks = %w(raqa:test)
|
6
|
-
errors = tasks.collect do |task|
|
7
|
-
begin
|
8
|
-
Rake::Task[task].invoke
|
9
|
-
nil
|
10
|
-
rescue => e
|
11
|
-
task
|
12
|
-
end
|
13
|
-
end.compact
|
14
|
-
abort "Errors running #{errors * ', '}!" if errors.any?
|
15
|
-
end
|
4
|
+
task :rcqa => ["rcqa:default"]
|
16
5
|
|
17
6
|
|
18
7
|
namespace :rcqa do
|
19
8
|
SECTIONS = {
|
20
|
-
"units" => "app\/models|app\/helpers|lib",
|
21
|
-
"functionals" => "app\/controllers"
|
9
|
+
"units" => {:folders => "app\/models|app\/helpers|lib"},
|
10
|
+
"functionals" => {:folders => "app\/controllers"},
|
11
|
+
"integration" => {}
|
22
12
|
}
|
13
|
+
|
23
14
|
task :default => [:test]
|
24
15
|
|
25
|
-
desc "Run Rails
|
16
|
+
desc "Run all Rails tests with rcov on units and functionals"
|
26
17
|
task(:test) do
|
27
|
-
SECTIONS.each do |section_name,
|
18
|
+
SECTIONS.each do |section_name, section|
|
28
19
|
puts "#################################################"
|
29
20
|
puts "Running #{section_name.singularize} tests"
|
30
21
|
puts "#################################################"
|
31
|
-
Rake::Task["rcqa
|
22
|
+
Rake::Task["rcqa:#{section_name}"].invoke
|
23
|
+
unless section[:folders].nil?
|
24
|
+
puts "HTML output can be found at:"
|
25
|
+
puts "file:///#{File.join([Rails.root, 'coverage', section_name, 'index.html'])}"
|
26
|
+
end
|
27
|
+
puts "\n\n"
|
32
28
|
end
|
33
|
-
|
34
|
-
puts "#################################################"
|
35
|
-
puts "Running integration tests"
|
36
|
-
puts "#################################################"
|
37
|
-
Rake::Task["test:integration"].invoke
|
38
29
|
end
|
39
30
|
|
40
|
-
|
41
|
-
|
31
|
+
SECTIONS.each do |section_name, section|
|
32
|
+
unless section[:folders].nil?
|
42
33
|
Rcov::RcovTask.new("#{section_name}") do |t|
|
43
34
|
t.libs << "test"
|
44
35
|
t.test_files = Dir["test/#{section_name.singularize}/**/*_test.rb"]
|
45
|
-
t.
|
46
|
-
t.rcov_opts = ["--html", "--text-report", "--exclude '^(?!(#{section_folders}))'"]
|
36
|
+
t.rcov_opts = ["--html", "--text-report", "--exclude '^(?!(#{section[:folders]}))'"]
|
47
37
|
t.output_dir = "coverage/#{section_name}"
|
48
38
|
end
|
49
39
|
end
|
50
40
|
end
|
51
41
|
|
42
|
+
task :integration => ["test:integration"]
|
52
43
|
end
|
53
44
|
|
54
45
|
|
metadata
CHANGED
@@ -5,7 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
|
8
|
+
- 1
|
9
|
+
version: 0.2.1
|
9
10
|
platform: ruby
|
10
11
|
authors:
|
11
12
|
- Nathan Humbert
|
@@ -13,7 +14,7 @@ autorequire:
|
|
13
14
|
bindir: bin
|
14
15
|
cert_chain: []
|
15
16
|
|
16
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-15 00:00:00 -07:00
|
17
18
|
default_executable:
|
18
19
|
dependencies:
|
19
20
|
- !ruby/object:Gem::Dependency
|