bartes-rcov_stats 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/init.rb +1 -9
- data/lib/rcov_stats.rb +35 -5
- data/lib/rcov_stats_tasks.rb +26 -0
- data/tasks/rcov.rake +6 -5
- metadata +2 -1
data/init.rb
CHANGED
@@ -1,10 +1,2 @@
|
|
1
|
-
require '
|
1
|
+
require 'rcov_stats'
|
2
2
|
|
3
|
-
plugin_root = File.dirname(__FILE__)
|
4
|
-
config_file = File.join(RAILS_ROOT,'config','rcov_stats.yml')
|
5
|
-
|
6
|
-
unless File.exists?(config_file)
|
7
|
-
use_rspec = File.exists?(File.join(RAILS_ROOT, 'spec'))
|
8
|
-
config_file_base = (use_rspec ? 'rcov_rspec' : 'rcov_standard') + '.yml'
|
9
|
-
FileUtils.cp(File.join(plugin_root, 'config', config_file_base), config_file)
|
10
|
-
end
|
data/lib/rcov_stats.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require File.join(RAILS_ROOT,'config','environment')
|
2
|
-
|
3
1
|
module RcovStats
|
4
2
|
|
5
3
|
class << self
|
@@ -8,8 +6,18 @@ module RcovStats
|
|
8
6
|
File.join(File.dirname(__FILE__),'..')
|
9
7
|
end
|
10
8
|
|
9
|
+
def is_rails?
|
10
|
+
Object.const_defined?('RAILS_ROOT')
|
11
|
+
end
|
12
|
+
|
13
|
+
def is_merb?
|
14
|
+
Object.const_defined?('Merb')
|
15
|
+
end
|
16
|
+
|
11
17
|
def root
|
12
|
-
RAILS_ROOT
|
18
|
+
root_dir = RAILS_ROOT if is_rails?
|
19
|
+
root_dir = Merb.root if is_merb?
|
20
|
+
root_dir
|
13
21
|
end
|
14
22
|
|
15
23
|
def get_config(name)
|
@@ -49,7 +57,7 @@ module RcovStats
|
|
49
57
|
end
|
50
58
|
|
51
59
|
def before_rcov
|
52
|
-
(pre_rcov = get_config("before_rcov")).blank? ?
|
60
|
+
(pre_rcov = get_config("before_rcov")).blank? ? nil : pre_rcov
|
53
61
|
end
|
54
62
|
|
55
63
|
def use_rspec?
|
@@ -160,4 +168,26 @@ module RcovStats
|
|
160
168
|
end
|
161
169
|
end
|
162
170
|
|
163
|
-
end
|
171
|
+
end
|
172
|
+
|
173
|
+
require 'fileutils'
|
174
|
+
|
175
|
+
unless Object.const_defined?('RCOV_STATS_ROOT')
|
176
|
+
RCOV_STATS_ROOT = RAILS_ROOT if RcovStats.is_rails?
|
177
|
+
RCOV_STATS_ROOT = Merb.root if RcovStats.is_merb?
|
178
|
+
if RcovStats.is_merb?
|
179
|
+
Merb::Plugins.add_rakefiles(File.join(File.dirname(__FILE__),"rcov_stats_tasks"))
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
|
184
|
+
file_path = File.dirname(__FILE__)
|
185
|
+
config_file = File.join(RCOV_STATS_ROOT,'config','rcov_stats.yml')
|
186
|
+
|
187
|
+
unless File.exists?(config_file)
|
188
|
+
use_rspec = File.exists?(File.join(RCOV_STATS_ROOT, 'spec'))
|
189
|
+
config_file_base = (use_rspec ? 'rcov_rspec' : 'rcov_standard') + '.yml'
|
190
|
+
FileUtils.cp(File.join(file_path, '..','config', config_file_base), config_file)
|
191
|
+
end
|
192
|
+
|
193
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
namespace :rcov do
|
2
|
+
desc "run rcov for units tests"
|
3
|
+
task(RcovStats.before_rcov ? ({:units => RcovStats.before_rcov}) : :units ) do
|
4
|
+
puts '** rcov:units **'
|
5
|
+
RcovStats.invoke('units')
|
6
|
+
end
|
7
|
+
|
8
|
+
desc "run rcov for functionals tests"
|
9
|
+
task(RcovStats.before_rcov ? ({:functionals => RcovStats.before_rcov}) : :functionals ) do
|
10
|
+
puts '** rcov:functionals **'
|
11
|
+
RcovStats.invoke('functionals')
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "run rcov for functionals and units tests"
|
15
|
+
task(RcovStats.before_rcov ? ({:stats => RcovStats.before_rcov}) : :stats ) do
|
16
|
+
puts '** rcov:stats **'
|
17
|
+
Rake::Task['rcov:units'].invoke
|
18
|
+
Rake::Task['rcov:functionals'].invoke
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "run general rcov tests"
|
22
|
+
task(RcovStats.before_rcov ? ({:general => RcovStats.before_rcov}) : :general ) do
|
23
|
+
puts '** rcov:general **'
|
24
|
+
RcovStats.invoke('general')
|
25
|
+
end
|
26
|
+
end
|
data/tasks/rcov.rake
CHANGED
@@ -1,27 +1,28 @@
|
|
1
1
|
namespace :rcov do
|
2
2
|
require File.join(File.dirname(__FILE__), "../lib/rcov_stats.rb")
|
3
3
|
desc "run rcov for units tests"
|
4
|
-
task :units => RcovStats.before_rcov do
|
4
|
+
task(RcovStats.before_rcov ? ({:units => RcovStats.before_rcov}) : :units ) do
|
5
5
|
puts '** rcov:units **'
|
6
6
|
RcovStats.invoke('units')
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
desc "run rcov for functionals tests"
|
10
|
-
task :functionals => RcovStats.before_rcov do
|
10
|
+
task(RcovStats.before_rcov ? ({:functionals => RcovStats.before_rcov}) : :functionals ) do
|
11
11
|
puts '** rcov:functionals **'
|
12
12
|
RcovStats.invoke('functionals')
|
13
13
|
end
|
14
14
|
|
15
15
|
desc "run rcov for functionals and units tests"
|
16
|
-
task :stats => RcovStats.before_rcov do
|
16
|
+
task(RcovStats.before_rcov ? ({:stats => RcovStats.before_rcov}) : :stats ) do
|
17
17
|
puts '** rcov:stats **'
|
18
18
|
Rake::Task['rcov:units'].invoke
|
19
19
|
Rake::Task['rcov:functionals'].invoke
|
20
20
|
end
|
21
21
|
|
22
22
|
desc "run general rcov tests"
|
23
|
-
task :general => RcovStats.before_rcov do
|
23
|
+
task(RcovStats.before_rcov ? ({:general => RcovStats.before_rcov}) : :general ) do
|
24
24
|
puts '** rcov:general **'
|
25
25
|
RcovStats.invoke('general')
|
26
26
|
end
|
27
27
|
end
|
28
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bartes-rcov_stats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bartosz Knapik
|
@@ -23,6 +23,7 @@ extra_rdoc_files: []
|
|
23
23
|
|
24
24
|
files:
|
25
25
|
- lib/rcov_stats.rb
|
26
|
+
- lib/rcov_stats_tasks.rb
|
26
27
|
- tasks/rcov.rake
|
27
28
|
- config/rcov_standard.yml
|
28
29
|
- config/rcov_rspec.yml
|