response 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +5 -8
- data/Gemfile +1 -1
- data/Gemfile.devtools +13 -13
- data/config/reek.yml +7 -7
- data/response.gemspec +4 -4
- metadata +12 -34
- data/tasks/metrics/ci.rake +0 -7
- data/tasks/metrics/flay.rake +0 -47
- data/tasks/metrics/flog.rake +0 -43
- data/tasks/metrics/heckle.rake +0 -208
- data/tasks/metrics/metric_fu.rake +0 -29
- data/tasks/metrics/reek.rake +0 -15
- data/tasks/metrics/roodi.rake +0 -15
- data/tasks/metrics/yardstick.rake +0 -23
- data/tasks/spec.rake +0 -45
- data/tasks/yard.rake +0 -9
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9d0ab268a684b74ed37a15376e1d8288c1f1d1d8
|
4
|
+
data.tar.gz: 05a1e423711cbaf9f1cf0f4f21ff3d33263cc891
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 141a5b21ed08fa22f72729946e983ab5f7b7e040017023324705af22c17d6f0a6b91ab44a34f35cb44790261a3233d17f58c1a14370417d8e95a9a0eb6b3b074
|
7
|
+
data.tar.gz: 8203562dc7267beffc734c53c9aeebf91acdd55b57fc1e95612c2a0698e1bc550098340528e53f6a75d19b935faaf515c2414b2933f83b9629633e2f568b2b0e
|
data/.travis.yml
CHANGED
@@ -2,15 +2,12 @@ language: ruby
|
|
2
2
|
before_install: gem install bundler
|
3
3
|
script: bundle exec rake ci
|
4
4
|
rvm:
|
5
|
-
- 1.8.7
|
6
|
-
- 1.9.2
|
7
5
|
- 1.9.3
|
8
|
-
|
9
|
-
-
|
6
|
+
- 2.0.0
|
7
|
+
- ruby-head
|
10
8
|
- rbx-19mode
|
11
|
-
- jruby-18mode
|
12
9
|
- jruby-19mode
|
13
10
|
- jruby-head
|
14
|
-
|
15
|
-
|
16
|
-
-
|
11
|
+
matrix:
|
12
|
+
allow_failures:
|
13
|
+
rvm: ruby-head
|
data/Gemfile
CHANGED
data/Gemfile.devtools
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
group :development do
|
4
|
-
gem 'rake', '~> 10.0
|
4
|
+
gem 'rake', '~> 10.1.0'
|
5
5
|
gem 'rspec', '~> 2.13.0'
|
6
6
|
gem 'yard', '~> 0.8.6.1'
|
7
7
|
end
|
@@ -11,12 +11,12 @@ group :yard do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
group :guard do
|
14
|
-
gem 'guard', '~> 1.8.
|
14
|
+
gem 'guard', '~> 1.8.1'
|
15
15
|
gem 'guard-bundler', '~> 1.0.0'
|
16
|
-
gem 'guard-rspec', '~>
|
16
|
+
gem 'guard-rspec', '~> 3.0.2'
|
17
17
|
|
18
18
|
# file system change event handling
|
19
|
-
gem 'listen', '~> 1.
|
19
|
+
gem 'listen', '~> 1.2.2'
|
20
20
|
gem 'rb-fchange', '~> 0.0.6', :require => false
|
21
21
|
gem 'rb-fsevent', '~> 0.9.3', :require => false
|
22
22
|
gem 'rb-inotify', '~> 0.9.0', :require => false
|
@@ -28,20 +28,20 @@ group :guard do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
group :metrics do
|
31
|
-
gem 'backports',
|
32
|
-
gem 'coveralls',
|
33
|
-
gem 'flay',
|
34
|
-
gem 'flog',
|
35
|
-
gem 'reek',
|
36
|
-
gem 'simplecov',
|
37
|
-
gem 'yardstick',
|
31
|
+
gem 'backports', '~> 3.3', '>= 3.3.2'
|
32
|
+
gem 'coveralls', '~> 0.6.7'
|
33
|
+
gem 'flay', '~> 2.3.0'
|
34
|
+
gem 'flog', '~> 4.1.0'
|
35
|
+
gem 'reek', '~> 1.3.1', :git => 'https://github.com/troessner/reek.git'
|
36
|
+
gem 'simplecov', '~> 0.7.1'
|
37
|
+
gem 'yardstick', '~> 0.9.6'
|
38
38
|
|
39
39
|
platforms :ruby_19 do
|
40
40
|
gem 'yard-spellcheck', '~> 0.1.5'
|
41
41
|
end
|
42
42
|
|
43
|
-
platforms :
|
44
|
-
gem 'mutant', '~> 0.
|
43
|
+
platforms :ruby_19, :ruby_20 do
|
44
|
+
gem 'mutant', '~> 0.3.0.beta4'
|
45
45
|
end
|
46
46
|
|
47
47
|
platforms :rbx do
|
data/config/reek.yml
CHANGED
@@ -7,7 +7,7 @@ UncommunicativeParameterName:
|
|
7
7
|
- !ruby/regexp /^.$/
|
8
8
|
- !ruby/regexp /[0-9]$/
|
9
9
|
- !ruby/regexp /[A-Z]/
|
10
|
-
|
10
|
+
TooManyMethods:
|
11
11
|
max_methods: 12 # Todo bring down to 10
|
12
12
|
exclude: []
|
13
13
|
enabled: true
|
@@ -21,8 +21,8 @@ UncommunicativeMethodName:
|
|
21
21
|
- !ruby/regexp /[0-9]$/
|
22
22
|
- !ruby/regexp /[A-Z]/
|
23
23
|
LongParameterList:
|
24
|
-
max_params: 2
|
25
|
-
exclude:
|
24
|
+
max_params: 2
|
25
|
+
exclude:
|
26
26
|
- Response#self.build # 3 params
|
27
27
|
enabled: true
|
28
28
|
overrides: {}
|
@@ -50,11 +50,11 @@ NestedIterators:
|
|
50
50
|
exclude: []
|
51
51
|
enabled: true
|
52
52
|
max_allowed_nesting: 1
|
53
|
-
|
53
|
+
TooManyStatements:
|
54
54
|
max_statements: 7 # TODO: decrease max_statements to 5 or less
|
55
55
|
exclude: []
|
56
56
|
enabled: true
|
57
|
-
|
57
|
+
DuplicateMethodCall:
|
58
58
|
allow_calls: []
|
59
59
|
exclude: []
|
60
60
|
enabled: true
|
@@ -74,7 +74,7 @@ UncommunicativeVariableName:
|
|
74
74
|
- !ruby/regexp /^.$/
|
75
75
|
- !ruby/regexp /[0-9]$/
|
76
76
|
- !ruby/regexp /[A-Z]/
|
77
|
-
|
77
|
+
RepeatedConditional:
|
78
78
|
exclude: []
|
79
79
|
enabled: true
|
80
80
|
max_ifs: 1
|
@@ -83,7 +83,7 @@ DataClump:
|
|
83
83
|
enabled: true
|
84
84
|
max_copies: 1
|
85
85
|
min_clump_size: 3
|
86
|
-
|
86
|
+
ControlParameter:
|
87
87
|
exclude: []
|
88
88
|
enabled: true
|
89
89
|
LongYieldList:
|
data/response.gemspec
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = 'response'
|
5
|
-
gem.version = '0.0.
|
5
|
+
gem.version = '0.0.3'
|
6
6
|
gem.authors = [ 'Markus Schirp' ]
|
7
|
-
gem.email = [ 'mbj@
|
7
|
+
gem.email = [ 'mbj@schir-dso.com' ]
|
8
8
|
gem.description = 'Build rack responses with functional style'
|
9
9
|
gem.summary = gem.description
|
10
10
|
gem.homepage = 'https://github.com/mbj/response'
|
@@ -14,8 +14,8 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.test_files = `git ls-files -- {spec}/*`.split("\n")
|
15
15
|
gem.extra_rdoc_files = %w[LICENSE README.md TODO]
|
16
16
|
|
17
|
-
gem.add_dependency('ice_nine', '~> 0.
|
18
|
-
gem.add_dependency('adamantium', '~> 0.0.
|
17
|
+
gem.add_dependency('ice_nine', '~> 0.8.0')
|
18
|
+
gem.add_dependency('adamantium', '~> 0.0.8')
|
19
19
|
gem.add_dependency('equalizer', '~> 0.0.5')
|
20
20
|
gem.add_dependency('abstract_type', '~> 0.0.5')
|
21
21
|
gem.add_dependency('concord', '~> 0.1.0')
|
metadata
CHANGED
@@ -1,52 +1,46 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: response
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Markus Schirp
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-07-03 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: ice_nine
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
19
|
+
version: 0.8.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
26
|
+
version: 0.8.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: adamantium
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version: 0.0.
|
33
|
+
version: 0.0.8
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.0.
|
40
|
+
version: 0.0.8
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: equalizer
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: abstract_type
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ~>
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ~>
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -78,7 +69,6 @@ dependencies:
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: concord
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ~>
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,14 +76,13 @@ dependencies:
|
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ~>
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: 0.1.0
|
94
83
|
description: Build rack responses with functional style
|
95
84
|
email:
|
96
|
-
- mbj@
|
85
|
+
- mbj@schir-dso.com
|
97
86
|
executables: []
|
98
87
|
extensions: []
|
99
88
|
extra_rdoc_files:
|
@@ -149,39 +138,28 @@ files:
|
|
149
138
|
- spec/unit/response/with_headers_spec.rb
|
150
139
|
- spec/unit/response/with_status_spec.rb
|
151
140
|
- spec/unit/response/xml/class_methods/build_spec.rb
|
152
|
-
- tasks/metrics/ci.rake
|
153
|
-
- tasks/metrics/flay.rake
|
154
|
-
- tasks/metrics/flog.rake
|
155
|
-
- tasks/metrics/heckle.rake
|
156
|
-
- tasks/metrics/metric_fu.rake
|
157
|
-
- tasks/metrics/reek.rake
|
158
|
-
- tasks/metrics/roodi.rake
|
159
|
-
- tasks/metrics/yardstick.rake
|
160
|
-
- tasks/spec.rake
|
161
|
-
- tasks/yard.rake
|
162
141
|
homepage: https://github.com/mbj/response
|
163
142
|
licenses: []
|
143
|
+
metadata: {}
|
164
144
|
post_install_message:
|
165
145
|
rdoc_options: []
|
166
146
|
require_paths:
|
167
147
|
- lib
|
168
148
|
required_ruby_version: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
149
|
requirements:
|
171
|
-
- -
|
150
|
+
- - '>='
|
172
151
|
- !ruby/object:Gem::Version
|
173
152
|
version: '0'
|
174
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
|
-
none: false
|
176
154
|
requirements:
|
177
|
-
- -
|
155
|
+
- - '>='
|
178
156
|
- !ruby/object:Gem::Version
|
179
157
|
version: '0'
|
180
158
|
requirements: []
|
181
159
|
rubyforge_project:
|
182
|
-
rubygems_version:
|
160
|
+
rubygems_version: 2.0.2
|
183
161
|
signing_key:
|
184
|
-
specification_version:
|
162
|
+
specification_version: 4
|
185
163
|
summary: Build rack responses with functional style
|
186
164
|
test_files: []
|
187
165
|
has_rdoc:
|
data/tasks/metrics/ci.rake
DELETED
data/tasks/metrics/flay.rake
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
if RUBY_VERSION == '1.8.7'
|
3
|
-
require 'flay'
|
4
|
-
require 'yaml'
|
5
|
-
|
6
|
-
config = YAML.load_file(File.expand_path('../../../config/flay.yml', __FILE__)).freeze
|
7
|
-
threshold = config.fetch('threshold').to_i
|
8
|
-
total_score = config.fetch('total_score').to_f
|
9
|
-
files = Flay.expand_dirs_to_files(config.fetch('path', 'lib'))
|
10
|
-
|
11
|
-
# original code by Marty Andrews:
|
12
|
-
# http://blog.martyandrews.net/2009/05/enforcing-ruby-code-quality.html
|
13
|
-
desc 'Analyze for code duplication'
|
14
|
-
task :flay do
|
15
|
-
# run flay once without a threshold to ensure the max mass matches the threshold
|
16
|
-
flay = Flay.new(:fuzzy => false, :verbose => false, :mass => 0)
|
17
|
-
flay.process(*files)
|
18
|
-
|
19
|
-
max = flay.masses.map { |hash, mass| mass.to_f / flay.hashes[hash].size }.max
|
20
|
-
unless max >= threshold
|
21
|
-
raise "Adjust flay threshold down to #{max}"
|
22
|
-
end
|
23
|
-
|
24
|
-
total = flay.masses.reduce(0.0) { |total, (hash, mass)| total + (mass.to_f / flay.hashes[hash].size) }
|
25
|
-
unless total == total_score
|
26
|
-
raise "Flay total is now #{total}, but expected #{total_score}"
|
27
|
-
end
|
28
|
-
|
29
|
-
# run flay a second time with the threshold set
|
30
|
-
flay = Flay.new(:fuzzy => false, :verbose => false, :mass => threshold.succ)
|
31
|
-
flay.process(*files)
|
32
|
-
|
33
|
-
if flay.masses.any?
|
34
|
-
flay.report
|
35
|
-
raise "#{flay.masses.size} chunks of code have a duplicate mass > #{threshold}"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
else
|
39
|
-
task :flay do
|
40
|
-
$stderr.puts 'Flay has inconsistend results accros ruby implementations. It is only enabled on 1.8.7, fix and remove guard'
|
41
|
-
end
|
42
|
-
end
|
43
|
-
rescue LoadError
|
44
|
-
task :flay do
|
45
|
-
abort 'Flay is not available. In order to run flay, you must: gem install flay'
|
46
|
-
end
|
47
|
-
end
|
data/tasks/metrics/flog.rake
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'flog'
|
3
|
-
require 'yaml'
|
4
|
-
|
5
|
-
class Float
|
6
|
-
def round_to(n)
|
7
|
-
(self * 10**n).round.to_f * 10**-n
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
config = YAML.load_file(File.expand_path('../../../config/flog.yml', __FILE__)).freeze
|
12
|
-
threshold = config.fetch('threshold').to_f.round_to(1)
|
13
|
-
|
14
|
-
# original code by Marty Andrews:
|
15
|
-
# http://blog.martyandrews.net/2009/05/enforcing-ruby-code-quality.html
|
16
|
-
desc 'Analyze for code complexity'
|
17
|
-
task :flog do
|
18
|
-
flog = Flog.new
|
19
|
-
flog.flog Array(config.fetch('path', 'lib'))
|
20
|
-
|
21
|
-
totals = flog.totals.select { |name, score| name[-5, 5] != '#none' }.
|
22
|
-
map { |name, score| [ name, score.round_to(1) ] }.
|
23
|
-
sort_by { |name, score| score }
|
24
|
-
|
25
|
-
max = totals.last[1]
|
26
|
-
unless max >= threshold
|
27
|
-
raise "Adjust flog score down to #{max}"
|
28
|
-
end
|
29
|
-
|
30
|
-
bad_methods = totals.select { |name, score| score > threshold }
|
31
|
-
if bad_methods.any?
|
32
|
-
bad_methods.reverse_each do |name, score|
|
33
|
-
puts '%8.1f: %s' % [ score, name ]
|
34
|
-
end
|
35
|
-
|
36
|
-
raise "#{bad_methods.size} methods have a flog complexity > #{threshold}"
|
37
|
-
end
|
38
|
-
end
|
39
|
-
rescue LoadError
|
40
|
-
task :flog do
|
41
|
-
abort 'Flog is not available. In order to run flog, you must: gem install flog'
|
42
|
-
end
|
43
|
-
end
|
data/tasks/metrics/heckle.rake
DELETED
@@ -1,208 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.expand_path('../../../lib', __FILE__))
|
2
|
-
|
3
|
-
# original code by Ashley Moran:
|
4
|
-
# http://aviewfromafar.net/2007/11/1/rake-task-for-heckling-your-specs
|
5
|
-
|
6
|
-
begin
|
7
|
-
require 'pathname'
|
8
|
-
require 'backports'
|
9
|
-
require 'active_support/inflector'
|
10
|
-
require 'heckle'
|
11
|
-
require 'mspec'
|
12
|
-
require 'mspec/utils/name_map'
|
13
|
-
|
14
|
-
SKIP_METHODS = %w[ blank_slate_method_added ].freeze
|
15
|
-
|
16
|
-
class NameMap
|
17
|
-
def file_name(method, constant)
|
18
|
-
map = MAP[method]
|
19
|
-
name = if map
|
20
|
-
map[constant] || map[:default]
|
21
|
-
else
|
22
|
-
method.
|
23
|
-
gsub('?','_ques').
|
24
|
-
gsub('!','_bang').
|
25
|
-
gsub('=','_assign')
|
26
|
-
end
|
27
|
-
"#{name}_spec.rb"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
desc 'Heckle each module and class'
|
32
|
-
task :heckle => :rcov do
|
33
|
-
unless Ruby2Ruby::VERSION == '1.2.2'
|
34
|
-
raise "ruby2ruby version #{Ruby2Ruby::VERSION} may not work properly, 1.2.2 *only* is recommended for use with heckle"
|
35
|
-
end
|
36
|
-
|
37
|
-
require 'response'
|
38
|
-
|
39
|
-
root_module_regexp = Regexp.union('Response')
|
40
|
-
|
41
|
-
spec_dir = Pathname('spec/unit')
|
42
|
-
|
43
|
-
NameMap::MAP.each do |op, method|
|
44
|
-
next if method.kind_of?(Hash)
|
45
|
-
NameMap::MAP[op] = { :default => method }
|
46
|
-
end
|
47
|
-
|
48
|
-
aliases = Hash.new { |h,mod| h[mod] = Hash.new { |h,method| h[method] = method } }
|
49
|
-
map = NameMap.new
|
50
|
-
|
51
|
-
heckle_caught_modules = Hash.new { |hash, key| hash[key] = [] }
|
52
|
-
unhandled_mutations = 0
|
53
|
-
|
54
|
-
ObjectSpace.each_object(Module) do |mod|
|
55
|
-
next unless mod.name =~ /\A#{root_module_regexp}(?::|\z)/
|
56
|
-
|
57
|
-
spec_prefix = spec_dir.join(mod.name.underscore)
|
58
|
-
|
59
|
-
specs = []
|
60
|
-
|
61
|
-
# get the public class methods
|
62
|
-
metaclass = class << mod; self end
|
63
|
-
ancestors = metaclass.ancestors
|
64
|
-
|
65
|
-
spec_class_methods = mod.singleton_methods(false)
|
66
|
-
|
67
|
-
spec_class_methods.reject! do |method|
|
68
|
-
%w[ yaml_new yaml_tag_subclasses? included nesting constants ].include?(method.to_s)
|
69
|
-
end
|
70
|
-
|
71
|
-
if mod.ancestors.include?(Singleton)
|
72
|
-
spec_class_methods.reject! { |method| method.to_s == 'instance' }
|
73
|
-
end
|
74
|
-
|
75
|
-
# get the protected and private class methods
|
76
|
-
other_class_methods = metaclass.protected_instance_methods(false) |
|
77
|
-
metaclass.private_instance_methods(false)
|
78
|
-
|
79
|
-
ancestors.each do |ancestor|
|
80
|
-
other_class_methods -= ancestor.protected_instance_methods(false) |
|
81
|
-
ancestor.private_instance_methods(false)
|
82
|
-
end
|
83
|
-
|
84
|
-
other_class_methods.reject! do |method|
|
85
|
-
method.to_s == 'allocate' || SKIP_METHODS.include?(method.to_s)
|
86
|
-
end
|
87
|
-
|
88
|
-
other_class_methods.reject! do |method|
|
89
|
-
next unless spec_class_methods.any? { |specced| specced.to_s == $1 }
|
90
|
-
|
91
|
-
spec_class_methods << method
|
92
|
-
end
|
93
|
-
|
94
|
-
# get the instances methods
|
95
|
-
spec_methods = mod.public_instance_methods(false)
|
96
|
-
|
97
|
-
other_methods = mod.protected_instance_methods(false) |
|
98
|
-
mod.private_instance_methods(false)
|
99
|
-
|
100
|
-
other_methods.reject! do |method|
|
101
|
-
next unless spec_methods.any? { |specced| specced.to_s == $1 }
|
102
|
-
|
103
|
-
spec_methods << method
|
104
|
-
end
|
105
|
-
|
106
|
-
# map the class methods to spec files
|
107
|
-
spec_class_methods.each do |method|
|
108
|
-
method = aliases[mod.name][method]
|
109
|
-
next if SKIP_METHODS.include?(method.to_s)
|
110
|
-
|
111
|
-
spec_file = spec_prefix.join('class_methods').join(map.file_name(method, mod.name))
|
112
|
-
|
113
|
-
unless spec_file.file?
|
114
|
-
raise "No spec file #{spec_file} for #{mod}.#{method}"
|
115
|
-
next
|
116
|
-
end
|
117
|
-
|
118
|
-
specs << [ ".#{method}", [ spec_file ] ]
|
119
|
-
end
|
120
|
-
|
121
|
-
# map the instance methods to spec files
|
122
|
-
spec_methods.each do |method|
|
123
|
-
method = aliases[mod.name][method]
|
124
|
-
next if SKIP_METHODS.include?(method.to_s)
|
125
|
-
|
126
|
-
spec_file = spec_prefix.join(map.file_name(method, mod.name))
|
127
|
-
|
128
|
-
unless spec_file.file?
|
129
|
-
raise "No spec file #{spec_file} for #{mod}##{method}"
|
130
|
-
next
|
131
|
-
end
|
132
|
-
|
133
|
-
specs << [ "##{method}", [ spec_file ] ]
|
134
|
-
end
|
135
|
-
|
136
|
-
# non-public methods are considered covered if they can be mutated
|
137
|
-
# and any spec fails for the current or descendant modules
|
138
|
-
other_methods.each do |method|
|
139
|
-
descedant_specs = []
|
140
|
-
|
141
|
-
ObjectSpace.each_object(Module) do |descedant|
|
142
|
-
next unless descedant.name =~ /\A#{root_module_regexp}(?::|\z)/ && mod >= descedant
|
143
|
-
descedant_spec_prefix = spec_dir.join(descedant.name.underscore)
|
144
|
-
descedant_specs << descedant_spec_prefix
|
145
|
-
|
146
|
-
if method.to_s == 'initialize'
|
147
|
-
descedant_specs.concat(Pathname.glob(descedant_spec_prefix.join('class_methods/new_spec.rb')))
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
specs << [ "##{method}", descedant_specs ]
|
152
|
-
end
|
153
|
-
|
154
|
-
other_class_methods.each do |method|
|
155
|
-
descedant_specs = []
|
156
|
-
|
157
|
-
ObjectSpace.each_object(Module) do |descedant|
|
158
|
-
next unless descedant.name =~ /\A#{root_module_regexp}(?::|\z)/ && mod >= descedant
|
159
|
-
descedant_specs << spec_dir.join(descedant.name.underscore).join('class_methods')
|
160
|
-
end
|
161
|
-
|
162
|
-
specs << [ ".#{method}", descedant_specs ]
|
163
|
-
end
|
164
|
-
|
165
|
-
specs.sort.each do |(method, spec_files)|
|
166
|
-
puts "Heckling #{mod}#{method}"
|
167
|
-
IO.popen("spec #{spec_files.join(' ')} --heckle '#{mod}#{method}'") do |pipe|
|
168
|
-
while line = pipe.gets
|
169
|
-
case line = line.chomp
|
170
|
-
when "The following mutations didn't cause test failures:"
|
171
|
-
heckle_caught_modules[mod.name] << method
|
172
|
-
when '+++ mutation'
|
173
|
-
unhandled_mutations += 1
|
174
|
-
end
|
175
|
-
end
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
if unhandled_mutations > 0
|
181
|
-
error_message_lines = [ "*************\n" ]
|
182
|
-
|
183
|
-
error_message_lines << "Heckle found #{unhandled_mutations} " \
|
184
|
-
"mutation#{"s" unless unhandled_mutations == 1} " \
|
185
|
-
"that didn't cause spec violations\n"
|
186
|
-
|
187
|
-
heckle_caught_modules.each do |mod, methods|
|
188
|
-
error_message_lines << "#{mod} contains the following " \
|
189
|
-
'poorly-specified methods:'
|
190
|
-
methods.each do |method|
|
191
|
-
error_message_lines << " - #{method}"
|
192
|
-
end
|
193
|
-
error_message_lines << ''
|
194
|
-
end
|
195
|
-
|
196
|
-
error_message_lines << 'Get your act together and come back ' \
|
197
|
-
'when your specs are doing their job!'
|
198
|
-
|
199
|
-
raise error_message_lines.join("\n")
|
200
|
-
else
|
201
|
-
puts 'Well done! Your code withstood a heckling.'
|
202
|
-
end
|
203
|
-
end
|
204
|
-
rescue LoadError
|
205
|
-
task :heckle => :spec do
|
206
|
-
$stderr.puts 'Heckle or mspec is not available. In order to run heckle, you must: gem install heckle mspec'
|
207
|
-
end
|
208
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'metric_fu'
|
3
|
-
require 'json'
|
4
|
-
|
5
|
-
# XXX: temporary hack until metric_fu is fixed
|
6
|
-
MetricFu::Saikuro.class_eval { include FileUtils }
|
7
|
-
|
8
|
-
MetricFu::Configuration.run do |config|
|
9
|
-
config.rcov = {
|
10
|
-
:environment => 'test',
|
11
|
-
:test_files => %w[ spec/**/*_spec.rb ],
|
12
|
-
:rcov_opts => %w[
|
13
|
-
--sort coverage
|
14
|
-
--no-html
|
15
|
-
--text-coverage
|
16
|
-
--no-color
|
17
|
-
--profile
|
18
|
-
--exclude spec/,^/
|
19
|
-
--include lib:spec
|
20
|
-
],
|
21
|
-
}
|
22
|
-
end
|
23
|
-
rescue LoadError
|
24
|
-
namespace :metrics do
|
25
|
-
task :all do
|
26
|
-
$stderr.puts 'metric_fu is not available. In order to run metrics:all, you must: gem install metric_fu'
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/tasks/metrics/reek.rake
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'reek/rake/task'
|
3
|
-
|
4
|
-
if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'rbx'
|
5
|
-
task :reek do
|
6
|
-
$stderr.puts 'Reek fails under rubinius, fix rubinius and remove guard'
|
7
|
-
end
|
8
|
-
else
|
9
|
-
Reek::Rake::Task.new
|
10
|
-
end
|
11
|
-
rescue LoadError
|
12
|
-
task :reek do
|
13
|
-
$stderr.puts 'Reek is not available. In order to run reek, you must: gem install reek'
|
14
|
-
end
|
15
|
-
end
|
data/tasks/metrics/roodi.rake
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'roodi'
|
3
|
-
require 'rake/tasklib'
|
4
|
-
require 'roodi_task'
|
5
|
-
|
6
|
-
RoodiTask.new do |t|
|
7
|
-
t.verbose = false
|
8
|
-
t.config = File.expand_path('../../../config/roodi.yml', __FILE__)
|
9
|
-
t.patterns = %w[ lib/**/*.rb ]
|
10
|
-
end
|
11
|
-
rescue LoadError
|
12
|
-
task :roodi do
|
13
|
-
abort 'Roodi is not available. In order to run roodi, you must: gem install roodi'
|
14
|
-
end
|
15
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'pathname'
|
3
|
-
require 'yardstick'
|
4
|
-
require 'yardstick/rake/measurement'
|
5
|
-
require 'yardstick/rake/verify'
|
6
|
-
require 'yaml'
|
7
|
-
|
8
|
-
config = YAML.load_file(File.expand_path('../../../config/yardstick.yml', __FILE__))
|
9
|
-
|
10
|
-
# yardstick_measure task
|
11
|
-
Yardstick::Rake::Measurement.new
|
12
|
-
|
13
|
-
# verify_measurements task
|
14
|
-
Yardstick::Rake::Verify.new do |verify|
|
15
|
-
verify.threshold = config.fetch('threshold')
|
16
|
-
end
|
17
|
-
rescue LoadError
|
18
|
-
%w[ yardstick_measure verify_measurements ].each do |name|
|
19
|
-
task name.to_s do
|
20
|
-
abort "Yardstick is not available. In order to run #{name}, you must: gem install yardstick"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/tasks/spec.rake
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'rspec/core/rake_task'
|
5
|
-
rescue LoadError
|
6
|
-
require 'spec/rake/spectask'
|
7
|
-
|
8
|
-
module RSpec
|
9
|
-
module Core
|
10
|
-
RakeTask = Spec::Rake::SpecTask
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
desc 'run all specs'
|
16
|
-
task :spec => %w[ spec:unit spec:integration ]
|
17
|
-
|
18
|
-
namespace :spec do
|
19
|
-
RSpec::Core::RakeTask.new(:integration) do |t|
|
20
|
-
t.pattern = 'spec/integration/**/*_spec.rb'
|
21
|
-
end
|
22
|
-
|
23
|
-
RSpec::Core::RakeTask.new(:unit) do |t|
|
24
|
-
t.pattern = 'spec/unit/**/*_spec.rb'
|
25
|
-
end
|
26
|
-
end
|
27
|
-
rescue LoadError
|
28
|
-
task :spec do
|
29
|
-
abort 'rspec is not available. In order to run spec, you must: gem install rspec'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
begin
|
34
|
-
desc "Generate code coverage"
|
35
|
-
RSpec::Core::RakeTask.new(:rcov) do |t|
|
36
|
-
t.rcov = true
|
37
|
-
t.rcov_opts = File.read('spec/rcov.opts').split(/\s+/)
|
38
|
-
end
|
39
|
-
rescue LoadError
|
40
|
-
task :rcov do
|
41
|
-
abort 'rcov is not available. In order to run rcov, you must: gem install rcov'
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
task :test => 'spec'
|