hexx-suit 0.0.1
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.
- checksums.yaml +7 -0
- data/.rubocop.yml +71 -0
- data/.yardopts +3 -0
- data/Guardfile +29 -0
- data/LICENSE +21 -0
- data/README.md +164 -0
- data/Rakefile +18 -0
- data/bin/hexx-suit +14 -0
- data/config/initializers/focus.rb +5 -0
- data/config/initializers/garbage_collection.rb +11 -0
- data/config/initializers/i18n.rb +3 -0
- data/config/initializers/metric_fu.rb +0 -0
- data/config/initializers/random_order.rb +4 -0
- data/config/initializers/rspec.rb +11 -0
- data/lib/hexx-suit.rb +16 -0
- data/lib/hexx/suit.rb +101 -0
- data/lib/hexx/suit/install.rb +85 -0
- data/lib/hexx/suit/install/Guardfile +6 -0
- data/lib/hexx/suit/install/Rakefile +17 -0
- data/lib/hexx/suit/install/_metrics +5 -0
- data/lib/hexx/suit/install/_rspec +2 -0
- data/lib/hexx/suit/install/_rubocop.yml +74 -0
- data/lib/hexx/suit/install/_yardopts +2 -0
- data/lib/hexx/suit/install/metrics/STYLEGUIDE +230 -0
- data/lib/hexx/suit/install/metrics/cane.yml +5 -0
- data/lib/hexx/suit/install/metrics/churn.yml +6 -0
- data/lib/hexx/suit/install/metrics/flay.yml +2 -0
- data/lib/hexx/suit/install/metrics/metric_fu.yml +15 -0
- data/lib/hexx/suit/install/metrics/pippi.yml +3 -0
- data/lib/hexx/suit/install/metrics/reek.yml +1 -0
- data/lib/hexx/suit/install/metrics/roodi.yml +24 -0
- data/lib/hexx/suit/install/metrics/rubocop.yml +79 -0
- data/lib/hexx/suit/install/metrics/saikuro.yml +3 -0
- data/lib/hexx/suit/install/metrics/simplecov.yml +8 -0
- data/lib/hexx/suit/install/metrics/yardstick.yml +37 -0
- data/lib/hexx/suit/metrics/base.rb +96 -0
- data/lib/hexx/suit/metrics/metric_fu.rb +165 -0
- data/lib/hexx/suit/metrics/metric_fu/base.rb +59 -0
- data/lib/hexx/suit/metrics/metric_fu/cane.rb +24 -0
- data/lib/hexx/suit/metrics/metric_fu/churn.rb +24 -0
- data/lib/hexx/suit/metrics/metric_fu/flay.rb +24 -0
- data/lib/hexx/suit/metrics/metric_fu/reek.rb +32 -0
- data/lib/hexx/suit/metrics/metric_fu/roodi.rb +32 -0
- data/lib/hexx/suit/metrics/metric_fu/saikuro.rb +24 -0
- data/lib/hexx/suit/metrics/pippi.rb +89 -0
- data/lib/hexx/suit/metrics/rubocop.rb +39 -0
- data/lib/hexx/suit/metrics/simplecov.rb +119 -0
- data/lib/hexx/suit/metrics/yardstick.rb +91 -0
- data/lib/hexx/suit/utils/system.rb +66 -0
- data/lib/hexx/suit/version.rb +7 -0
- data/lib/tasks/check.rake +32 -0
- data/lib/tasks/check/coverage.rake +27 -0
- data/lib/tasks/check/fu.rake +27 -0
- data/lib/tasks/check/inch.rake +11 -0
- data/lib/tasks/check/pippi.rake +31 -0
- data/lib/tasks/check/rubocop.rake +39 -0
- data/lib/tasks/check/yardstick.rake +27 -0
- data/lib/tasks/debug.rake +6 -0
- data/lib/tasks/test.rake +6 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/support/config/sandbox.rb +16 -0
- data/spec/support/config/tasks.rb +32 -0
- data/spec/support/sandbox/helpers.rb +62 -0
- data/spec/support/sandbox/matchers.rb +21 -0
- data/spec/tests/bin/install_spec.rb +29 -0
- data/spec/tests/lib/install_spec.rb +34 -0
- data/spec/tests/lib/metrics/metric_fu/cane_spec.rb +32 -0
- data/spec/tests/lib/metrics/metric_fu/churn_spec.rb +31 -0
- data/spec/tests/lib/metrics/metric_fu/flay_spec.rb +27 -0
- data/spec/tests/lib/metrics/metric_fu/reek_spec.rb +22 -0
- data/spec/tests/lib/metrics/metric_fu/roodi_spec.rb +22 -0
- data/spec/tests/lib/metrics/metric_fu/saikuro_spec.rb +30 -0
- data/spec/tests/lib/metrics/metric_fu_spec.rb +181 -0
- data/spec/tests/lib/metrics/pippi_spec.rb +102 -0
- data/spec/tests/lib/metrics/rubocop_spec.rb +58 -0
- data/spec/tests/lib/metrics/simplecov_spec.rb +102 -0
- data/spec/tests/lib/metrics/yardstick_spec.rb +110 -0
- data/spec/tests/lib/utils/system_spec.rb +85 -0
- data/spec/tests/suit_spec.rb +96 -0
- data/spec/tests/tasks/check/coverage/display_spec.rb +49 -0
- data/spec/tests/tasks/check/coverage/run_spec.rb +25 -0
- data/spec/tests/tasks/check/coverage_spec.rb +26 -0
- data/spec/tests/tasks/check/display_spec.rb +50 -0
- data/spec/tests/tasks/check/fu/display_spec.rb +42 -0
- data/spec/tests/tasks/check/fu/run_spec.rb +42 -0
- data/spec/tests/tasks/check/fu_spec.rb +18 -0
- data/spec/tests/tasks/check/inch_spec.rb +19 -0
- data/spec/tests/tasks/check/pippi/display_spec.rb +47 -0
- data/spec/tests/tasks/check/pippi/run_spec.rb +25 -0
- data/spec/tests/tasks/check/pippi_spec.rb +26 -0
- data/spec/tests/tasks/check/rubocop/display_spec.rb +61 -0
- data/spec/tests/tasks/check/rubocop/run_spec.rb +78 -0
- data/spec/tests/tasks/check/rubocop_spec.rb +26 -0
- data/spec/tests/tasks/check/run_spec.rb +44 -0
- data/spec/tests/tasks/check/yardstick/display_spec.rb +51 -0
- data/spec/tests/tasks/check/yardstick/run_spec.rb +20 -0
- data/spec/tests/tasks/check/yardstick_spec.rb +26 -0
- data/spec/tests/tasks/check_spec.rb +56 -0
- data/spec/tests/tasks/debug_spec.rb +21 -0
- data/spec/tests/tasks/test_spec.rb +21 -0
- metadata +414 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 6db3970977e3cec6c389e31e36e13df1a1744c25
|
|
4
|
+
data.tar.gz: 6330afe7eb0c5fd3c67d61d23b58c4acdefddf82
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 8936e786a6839d456fd3da48ae37e11190481c83f8e399ac22b456bb0f5cf7d6ce9c61f591ff92978428afd0ef651011ad423eb4bd7b6f90c866c23f7669d018
|
|
7
|
+
data.tar.gz: 74512e4cafa561cdb5ca4bd0ceb2e953100b504b4b7a4e6afb497c015f9c66d67f0084699a6cdd3b2c1496a6ef5679aa1ed4666b91011abd1903ddc2a1342c55
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
Exclude:
|
|
3
|
+
- '**/db/schema.rb'
|
|
4
|
+
|
|
5
|
+
Lint/HandleExceptions:
|
|
6
|
+
Exclude:
|
|
7
|
+
- 'spec/**/*'
|
|
8
|
+
|
|
9
|
+
Lint/RescueException:
|
|
10
|
+
Exclude:
|
|
11
|
+
- 'spec/**/*'
|
|
12
|
+
|
|
13
|
+
Metrics/ClassLength:
|
|
14
|
+
Exclude:
|
|
15
|
+
- 'lib/**/generator*'
|
|
16
|
+
|
|
17
|
+
Style/AccessorMethodName:
|
|
18
|
+
Exclude:
|
|
19
|
+
- 'spec/**/*'
|
|
20
|
+
|
|
21
|
+
Style/AsciiComments:
|
|
22
|
+
Enabled: false
|
|
23
|
+
|
|
24
|
+
Style/ClassAndModuleChildren:
|
|
25
|
+
Exclude:
|
|
26
|
+
- 'spec/**/*'
|
|
27
|
+
|
|
28
|
+
Style/Documentation:
|
|
29
|
+
Exclude:
|
|
30
|
+
- 'lib/**/version.rb'
|
|
31
|
+
- 'spec/**/*'
|
|
32
|
+
|
|
33
|
+
Style/EmptyLinesAroundBlockBody:
|
|
34
|
+
Enabled: false
|
|
35
|
+
|
|
36
|
+
Style/EmptyLinesAroundClassBody:
|
|
37
|
+
Enabled: false
|
|
38
|
+
|
|
39
|
+
Style/EmptyLinesAroundMethodBody:
|
|
40
|
+
Enabled: false
|
|
41
|
+
|
|
42
|
+
Style/EmptyLinesAroundModuleBody:
|
|
43
|
+
Enabled: false
|
|
44
|
+
|
|
45
|
+
Style/EmptyLineBetweenDefs:
|
|
46
|
+
Enabled: false
|
|
47
|
+
|
|
48
|
+
Style/FileName:
|
|
49
|
+
Enabled: false
|
|
50
|
+
|
|
51
|
+
Style/RaiseArgs:
|
|
52
|
+
EnforcedStyle: compact
|
|
53
|
+
|
|
54
|
+
Style/SingleLineMethods:
|
|
55
|
+
Exclude:
|
|
56
|
+
- 'spec/**/*'
|
|
57
|
+
|
|
58
|
+
Style/SpecialGlobalVars:
|
|
59
|
+
Exclude:
|
|
60
|
+
- 'Gemfile'
|
|
61
|
+
- '*.gemspec'
|
|
62
|
+
|
|
63
|
+
Style/StringLiterals:
|
|
64
|
+
EnforcedStyle: double_quotes
|
|
65
|
+
|
|
66
|
+
Style/SingleSpaceBeforeFirstArg:
|
|
67
|
+
Enabled: false
|
|
68
|
+
|
|
69
|
+
Style/TrivialAccessors:
|
|
70
|
+
Exclude:
|
|
71
|
+
- 'spec/**/*'
|
data/.yardopts
ADDED
data/Guardfile
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
|
2
|
+
|
|
3
|
+
watch("bin/hexx-suit") { "spec/tests/bin/install_spec.rb" }
|
|
4
|
+
|
|
5
|
+
watch(%r{^lib/tasks/(.+)\.rb$}) do |m|
|
|
6
|
+
[
|
|
7
|
+
"spec/tests/tasks/#{ m[1] }_spec.rb",
|
|
8
|
+
"spec/tests/tasks/#{ m[1] }/**/*_spec.rb"
|
|
9
|
+
]
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
watch(%r{^lib/hexx/suit/(.+)\.rb$}) do |m|
|
|
13
|
+
"spec/tests/lib/#{ m[1] }_spec.rb"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
watch(%r{^lib/hexx/suit/(.+)/base\.rb$}) do |m|
|
|
17
|
+
"spec/tests/lib/#{ m[1] }/*_spec.rb"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
watch("lib/hexx/suit.rb") { "spec" }
|
|
21
|
+
|
|
22
|
+
watch("lib/hexx-suit.rb") { "spec" }
|
|
23
|
+
|
|
24
|
+
watch(/^spec.+_spec\.rb$/)
|
|
25
|
+
|
|
26
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
|
27
|
+
|
|
28
|
+
watch("spec/spec_helper*.rb") { "spec" }
|
|
29
|
+
end
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 Andrew Kozin, https://github.com/nepalez
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Hexx::Suit
|
|
2
|
+
|
|
3
|
+
[][gem]
|
|
4
|
+
[][travis]
|
|
5
|
+
[][gemnasium]
|
|
6
|
+
[][coveralls]
|
|
7
|
+
[](file:LICENSE)
|
|
8
|
+
|
|
9
|
+
[gem]: https://rubygems.org/gems/hexx-suit
|
|
10
|
+
[travis]: https://travis-ci.org/nepalez/hexx-suit
|
|
11
|
+
[gemnasium]: https://gemnasium.com/nepalez/hexx-suit
|
|
12
|
+
[codeclimate]: https://codeclimate.com/github/nepalez/hexx-suit
|
|
13
|
+
[coveralls]: https://coveralls.io/r/nepalez/hexx-suit
|
|
14
|
+
|
|
15
|
+
The module collects the test/development suit to be shared among projects, along with base settings for included packages.
|
|
16
|
+
|
|
17
|
+
It also defines a set of Rake tasks.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
Add this line to your application's Gemfile:
|
|
22
|
+
|
|
23
|
+
```ruby
|
|
24
|
+
group :test, :development do
|
|
25
|
+
gem "hexx-suit"
|
|
26
|
+
end
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Then execute:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
$ bundle
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
And run the task from the application root:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
$ hexx-suit install
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Require the gem in the `spec_helper.rb` **before** loading application:
|
|
42
|
+
|
|
43
|
+
```ruby
|
|
44
|
+
# spec/spec_helper.rb
|
|
45
|
+
require "hexx-suit"
|
|
46
|
+
|
|
47
|
+
# Loads coveralls and pippi runtime metrics
|
|
48
|
+
# in the application's scope.
|
|
49
|
+
Hexx::Suit.load_metrics_for(self)
|
|
50
|
+
|
|
51
|
+
# ...
|
|
52
|
+
require "my_app"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
You can configure all metrics separately in a corresponding yml files, that are created at `config/metrics` directory. The directory also contains default STYLEGUIDE. Feel free to adapt it to your needs.
|
|
56
|
+
|
|
57
|
+
## Usage
|
|
58
|
+
|
|
59
|
+
The gem adds three tasks for a development process authomation:
|
|
60
|
+
|
|
61
|
+
### Test
|
|
62
|
+
|
|
63
|
+
The task runs rspec (runs no coverage controls) **in a bundle environment**.
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
$ rake test
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This is a simple shortcut for longer syntaxes:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
$ bundle exec rspec spec
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Debug
|
|
76
|
+
|
|
77
|
+
The tasks runs specs wrapped to pry `rescue` command.
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
$ rake debug
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
This is the same as:
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
$ bundle exec rescue rspec spec
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Check
|
|
90
|
+
|
|
91
|
+
The task runs rspec under the test coverage control, and then calls all the code metrics, except for mutation testing.
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
$ rake check
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
You can use single metrics as well:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
$ rake check:yardstick
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
See all tasks at:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
$ rake -T check
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
All the tasks will use settings from `config/metrics` folder.
|
|
110
|
+
|
|
111
|
+
## Package content
|
|
112
|
+
|
|
113
|
+
The gem loads dependencies from the projects below.
|
|
114
|
+
|
|
115
|
+
### Tools for Testing
|
|
116
|
+
|
|
117
|
+
* [rspec v3.0+](http://rspec.info/) - a Ruby test framework.
|
|
118
|
+
* [guard-rspec](https://github.com/guard/guard-rspec) - an authomatic tests launcher.
|
|
119
|
+
* [coveralls](https://coveralls.io/) - a tool for the test coverage control.
|
|
120
|
+
* [mutant](https://github.com/mbj/mutant) - a Ruby mutation testing.
|
|
121
|
+
|
|
122
|
+
### Tools for Debugging
|
|
123
|
+
|
|
124
|
+
* [pry](https://github.com/pry/pry/wiki) - a Ruby development console and debugging tool.
|
|
125
|
+
* [pry-byebug](https://github.com/deivid-rodriguez/pry-byebug)
|
|
126
|
+
* [pry-rescue](https://github.com/ConradIrwin/pry-rescue)
|
|
127
|
+
* [pry-stack-explorer](https://github.com/pry/pry-stack_explorer)
|
|
128
|
+
|
|
129
|
+
### Tools for Tasks Authomation
|
|
130
|
+
|
|
131
|
+
* [rake](https://github.com/ruby/rake) - a Ruby command line interface (CLI).
|
|
132
|
+
|
|
133
|
+
### Code Metrics
|
|
134
|
+
|
|
135
|
+
* [rubocop](https://github.com/bbatsov/rubocop) - a Ruby static code analyzer
|
|
136
|
+
* [metric_fu](https://github.com/metricfu/metric_fu/) - a collection of Ruby code analyzers.
|
|
137
|
+
* [pippi](https://github.com/tcopeland/pippi) - a utility for finding suboptimal Ruby class API usage.
|
|
138
|
+
|
|
139
|
+
### Tools for Documenting
|
|
140
|
+
|
|
141
|
+
* [yard](https://yardoc.org/) - a Ruby documentation tool.
|
|
142
|
+
* [inch](https://trivelop.de/inch/) - a documentation measurement tool.
|
|
143
|
+
* [yardstick](https://github.com/dkubb/yardstick) - a tool that verifies documentation coverage of Ruby code
|
|
144
|
+
|
|
145
|
+
## Compatibility
|
|
146
|
+
|
|
147
|
+
Tested under MRI rubies >= 2.1
|
|
148
|
+
|
|
149
|
+
RSpec 3.0+ used for testing
|
|
150
|
+
|
|
151
|
+
## Contributing
|
|
152
|
+
|
|
153
|
+
* Fork the project.
|
|
154
|
+
* Make your feature addition or bug fix.
|
|
155
|
+
* Add tests for it. This is important so I don't break it in a
|
|
156
|
+
future version unintentionally.
|
|
157
|
+
* Commit, do not mess with Rakefile or version
|
|
158
|
+
(if you want to have your own version, that is fine but bump version
|
|
159
|
+
in a commit by itself I can ignore when I pull)
|
|
160
|
+
* Send me a pull request. Bonus points for topic branches.
|
|
161
|
+
|
|
162
|
+
## License
|
|
163
|
+
|
|
164
|
+
See [MIT LICENSE](file: LICENSE).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
begin
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
rescue LoadError
|
|
5
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
|
6
|
+
exit
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# Loads bundler tasks
|
|
10
|
+
Bundler::GemHelper.install_tasks
|
|
11
|
+
|
|
12
|
+
# Loads the Hexx::Suit without tasks
|
|
13
|
+
require "hexx-suit"
|
|
14
|
+
|
|
15
|
+
# Sets the :spec task to default
|
|
16
|
+
task :default do
|
|
17
|
+
system "bundle exec rspec spec"
|
|
18
|
+
end
|
data/bin/hexx-suit
ADDED
|
File without changes
|
data/lib/hexx-suit.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Loads the parts of the suit to be available.
|
|
2
|
+
%w(i18n pry rake rspec thor yaml).each { |gem| require gem }
|
|
3
|
+
|
|
4
|
+
# Loads the code (the order is significant)
|
|
5
|
+
Dir.chdir File.expand_path("../..", __FILE__) do
|
|
6
|
+
Dir[
|
|
7
|
+
"./config/initializers/*.rb",
|
|
8
|
+
"./lib/hexx/suit/utils/*.rb",
|
|
9
|
+
"./lib/hexx/suit/metrics/base.rb",
|
|
10
|
+
"./lib/hexx/suit/metrics/metric_fu/base.rb",
|
|
11
|
+
"./lib/hexx/suit/metrics/metric_fu/*.rb",
|
|
12
|
+
"./lib/hexx/suit/metrics/*.rb",
|
|
13
|
+
"./lib/hexx/suit/*.rb",
|
|
14
|
+
"./lib/hexx/suit.rb"
|
|
15
|
+
].each { |file| require file }
|
|
16
|
+
end
|
data/lib/hexx/suit.rb
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Shared namespace for the Hexx-based gems
|
|
2
|
+
module Hexx
|
|
3
|
+
|
|
4
|
+
# Namespace for the module.
|
|
5
|
+
#
|
|
6
|
+
# @api public
|
|
7
|
+
module Suit
|
|
8
|
+
class << self
|
|
9
|
+
|
|
10
|
+
# Loads all the necessary rake tasks
|
|
11
|
+
#
|
|
12
|
+
# @example
|
|
13
|
+
# Hexx::Suit.install_tasks
|
|
14
|
+
#
|
|
15
|
+
# @return [self]
|
|
16
|
+
def install_tasks
|
|
17
|
+
load_gem_tasks
|
|
18
|
+
load_rspec_tasks
|
|
19
|
+
load_custom_tasks
|
|
20
|
+
|
|
21
|
+
self
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Loads runtime metrics in a given scope
|
|
25
|
+
#
|
|
26
|
+
# Checks if a corresponding environment is set
|
|
27
|
+
#
|
|
28
|
+
# @example
|
|
29
|
+
# # spec/spec_helper.rb
|
|
30
|
+
# Hexx::Suit.load_metrics_for(self)
|
|
31
|
+
#
|
|
32
|
+
# @param [Object] scope
|
|
33
|
+
#
|
|
34
|
+
# @return [self]
|
|
35
|
+
def load_metrics_for(scope)
|
|
36
|
+
load_pippi_for(scope)
|
|
37
|
+
load_coverage_for(scope)
|
|
38
|
+
|
|
39
|
+
self
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
|
|
44
|
+
# Loads runtime coverage metric in a given scope
|
|
45
|
+
#
|
|
46
|
+
# @param [Object] scope
|
|
47
|
+
#
|
|
48
|
+
# @return self
|
|
49
|
+
def load_coverage_for(scope)
|
|
50
|
+
return unless ENV["USE_SIMPLECOV"]
|
|
51
|
+
scope.instance_eval { Hexx::Suit::Metrics::SimpleCov.run }
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Loads runtime pippi metric in a given scope
|
|
55
|
+
#
|
|
56
|
+
# @param [Object] scope
|
|
57
|
+
#
|
|
58
|
+
# @return [self]
|
|
59
|
+
def load_pippi_for(scope)
|
|
60
|
+
return unless ENV["USE_PIPPI"]
|
|
61
|
+
scope.instance_eval { Hexx::Suit::Metrics::Pippi.run }
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Loads bundler rake tasks
|
|
65
|
+
#
|
|
66
|
+
# @return [self]
|
|
67
|
+
#
|
|
68
|
+
# @api private
|
|
69
|
+
def load_gem_tasks
|
|
70
|
+
require "bundler/gem_tasks"
|
|
71
|
+
::Bundler::GemHelper.install_tasks
|
|
72
|
+
|
|
73
|
+
self
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Loads rspec +spec+ rake task
|
|
77
|
+
#
|
|
78
|
+
# @return [self]
|
|
79
|
+
#
|
|
80
|
+
# @api private
|
|
81
|
+
def load_rspec_tasks
|
|
82
|
+
require "rspec/core/rake_task"
|
|
83
|
+
::RSpec::Core::RakeTask.new(:spec)
|
|
84
|
+
|
|
85
|
+
self
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Loads rake tasks, defined in the gem
|
|
89
|
+
#
|
|
90
|
+
# @return [self]
|
|
91
|
+
#
|
|
92
|
+
# @api private
|
|
93
|
+
def load_custom_tasks
|
|
94
|
+
tasks = ::File.expand_path "../../tasks/**/*.rake", __FILE__
|
|
95
|
+
::Dir[tasks].each { |task| load task }
|
|
96
|
+
|
|
97
|
+
self
|
|
98
|
+
end
|
|
99
|
+
end # singleton_class Suit
|
|
100
|
+
end # module Suit
|
|
101
|
+
end # module Hexx
|