faceter 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +2 -0
  3. data/.gitignore +9 -0
  4. data/.metrics +9 -0
  5. data/.rspec +2 -0
  6. data/.rubocop.yml +2 -0
  7. data/.travis.yml +18 -0
  8. data/.yardopts +3 -0
  9. data/CHANGELOG.md +3 -0
  10. data/Gemfile +9 -0
  11. data/Guardfile +10 -0
  12. data/LICENSE +21 -0
  13. data/README.md +295 -0
  14. data/Rakefile +37 -0
  15. data/benchmark/data.json +1 -0
  16. data/benchmark/faceter.rb +73 -0
  17. data/benchmark/rom.rb +85 -0
  18. data/benchmark/run.rb +54 -0
  19. data/config/metrics/STYLEGUIDE +230 -0
  20. data/config/metrics/cane.yml +5 -0
  21. data/config/metrics/churn.yml +6 -0
  22. data/config/metrics/flay.yml +2 -0
  23. data/config/metrics/metric_fu.yml +14 -0
  24. data/config/metrics/reek.yml +1 -0
  25. data/config/metrics/roodi.yml +24 -0
  26. data/config/metrics/rubocop.yml +75 -0
  27. data/config/metrics/saikuro.yml +3 -0
  28. data/config/metrics/simplecov.yml +6 -0
  29. data/config/metrics/yardstick.yml +37 -0
  30. data/faceter.gemspec +29 -0
  31. data/lib/faceter.rb +54 -0
  32. data/lib/faceter/coercers.rb +68 -0
  33. data/lib/faceter/functions.rb +30 -0
  34. data/lib/faceter/functions/add_prefix.rb +25 -0
  35. data/lib/faceter/functions/claster.rb +27 -0
  36. data/lib/faceter/functions/clean.rb +27 -0
  37. data/lib/faceter/functions/drop_prefix.rb +29 -0
  38. data/lib/faceter/functions/exclude.rb +27 -0
  39. data/lib/faceter/functions/group.rb +41 -0
  40. data/lib/faceter/functions/keep_symbol.rb +27 -0
  41. data/lib/faceter/functions/split.rb +28 -0
  42. data/lib/faceter/functions/ungroup.rb +31 -0
  43. data/lib/faceter/functions/unwrap.rb +32 -0
  44. data/lib/faceter/functions/wrap.rb +32 -0
  45. data/lib/faceter/mapper.rb +38 -0
  46. data/lib/faceter/nodes/add_prefix.rb +21 -0
  47. data/lib/faceter/nodes/change_prefix.rb +51 -0
  48. data/lib/faceter/nodes/create.rb +43 -0
  49. data/lib/faceter/nodes/exclude.rb +25 -0
  50. data/lib/faceter/nodes/field.rb +25 -0
  51. data/lib/faceter/nodes/fold.rb +25 -0
  52. data/lib/faceter/nodes/group.rb +26 -0
  53. data/lib/faceter/nodes/list.rb +25 -0
  54. data/lib/faceter/nodes/remove_prefix.rb +21 -0
  55. data/lib/faceter/nodes/rename.rb +25 -0
  56. data/lib/faceter/nodes/stringify_keys.rb +26 -0
  57. data/lib/faceter/nodes/symbolize_keys.rb +26 -0
  58. data/lib/faceter/nodes/unfold.rb +25 -0
  59. data/lib/faceter/nodes/ungroup.rb +26 -0
  60. data/lib/faceter/nodes/unwrap.rb +26 -0
  61. data/lib/faceter/nodes/wrap.rb +26 -0
  62. data/lib/faceter/rules/append_nested.rb +28 -0
  63. data/lib/faceter/rules/merge_branches.rb +41 -0
  64. data/lib/faceter/rules/merge_excludes.rb +29 -0
  65. data/lib/faceter/rules/merge_renames.rb +27 -0
  66. data/lib/faceter/rules/order_fields.rb +27 -0
  67. data/lib/faceter/rules/prepend_nested.rb +51 -0
  68. data/lib/faceter/version.rb +11 -0
  69. data/spec/integration/commands/add_prefix_spec.rb +37 -0
  70. data/spec/integration/commands/create_spec.rb +33 -0
  71. data/spec/integration/commands/exclude_spec.rb +55 -0
  72. data/spec/integration/commands/fold_spec.rb +41 -0
  73. data/spec/integration/commands/group_spec.rb +64 -0
  74. data/spec/integration/commands/remove_prefix_spec.rb +63 -0
  75. data/spec/integration/commands/rename_spec.rb +45 -0
  76. data/spec/integration/commands/stringify_keys_spec.rb +65 -0
  77. data/spec/integration/commands/symbolize_keys_spec.rb +49 -0
  78. data/spec/integration/commands/unfold_spec.rb +41 -0
  79. data/spec/integration/commands/ungroup_spec.rb +64 -0
  80. data/spec/integration/commands/unwrap_spec.rb +51 -0
  81. data/spec/integration/commands/wrap_spec.rb +51 -0
  82. data/spec/integration/rom_spec.rb +39 -0
  83. data/spec/spec_helper.rb +25 -0
  84. data/spec/unit/coercers/create_spec.rb +16 -0
  85. data/spec/unit/coercers/exclude_spec.rb +31 -0
  86. data/spec/unit/coercers/field_spec.rb +11 -0
  87. data/spec/unit/coercers/fold_spec.rb +11 -0
  88. data/spec/unit/coercers/prefix_spec.rb +38 -0
  89. data/spec/unit/coercers/rename_spec.rb +11 -0
  90. data/spec/unit/coercers/unfold_spec.rb +11 -0
  91. data/spec/unit/coercers/unwrap_spec.rb +35 -0
  92. data/spec/unit/coercers/wrap_spec.rb +35 -0
  93. data/spec/unit/functions/add_prefix_spec.rb +12 -0
  94. data/spec/unit/functions/claster_spec.rb +12 -0
  95. data/spec/unit/functions/clean_spec.rb +18 -0
  96. data/spec/unit/functions/drop_prefix_spec.rb +33 -0
  97. data/spec/unit/functions/exclude_spec.rb +64 -0
  98. data/spec/unit/functions/group_spec.rb +176 -0
  99. data/spec/unit/functions/keep_symbol_spec.rb +21 -0
  100. data/spec/unit/functions/split_spec.rb +64 -0
  101. data/spec/unit/functions/ungroup_spec.rb +87 -0
  102. data/spec/unit/functions/unwrap_spec.rb +54 -0
  103. data/spec/unit/functions/wrap_spec.rb +67 -0
  104. data/spec/unit/nodes/add_prefix_spec.rb +62 -0
  105. data/spec/unit/nodes/create_spec.rb +53 -0
  106. data/spec/unit/nodes/exclude_spec.rb +18 -0
  107. data/spec/unit/nodes/field_spec.rb +30 -0
  108. data/spec/unit/nodes/fold_spec.rb +19 -0
  109. data/spec/unit/nodes/group_spec.rb +163 -0
  110. data/spec/unit/nodes/list_spec.rb +27 -0
  111. data/spec/unit/nodes/remove_prefix_spec.rb +62 -0
  112. data/spec/unit/nodes/rename_spec.rb +16 -0
  113. data/spec/unit/nodes/stringify_keys_spec.rb +21 -0
  114. data/spec/unit/nodes/symbolize_keys_spec.rb +21 -0
  115. data/spec/unit/nodes/unfold_spec.rb +19 -0
  116. data/spec/unit/nodes/ungroup_spec.rb +92 -0
  117. data/spec/unit/nodes/unwrap_spec.rb +47 -0
  118. data/spec/unit/nodes/wrap_spec.rb +33 -0
  119. data/spec/unit/rules/append_nested_spec.rb +41 -0
  120. data/spec/unit/rules/merge_branches_spec.rb +58 -0
  121. data/spec/unit/rules/merge_excludes_spec.rb +31 -0
  122. data/spec/unit/rules/merge_renames_spec.rb +29 -0
  123. data/spec/unit/rules/order_fields_spec.rb +31 -0
  124. data/spec/unit/rules/prepend_nested_spec.rb +41 -0
  125. metadata +315 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2e033f423bf97c5a01e4a82d0d7cf4b7ed79a7fb
4
+ data.tar.gz: 1ba016d6090a2221a922dafe55e0149d91eca4f6
5
+ SHA512:
6
+ metadata.gz: 325f69c325db01ebf36f74c563733d76d01f7cdf662c126a2132baa2fb55d1b1eeb5c7a7a61600e8a30be8b7d01c125c8eb97625a19b79d8b5888c1cda44a17b
7
+ data.tar.gz: 9e9586cdbdbfb53a59e61638408450bd662e70a491a679fadd1453a0a43485d798f3f4aeee4fd39b32447f203a4b35c3201d9390336678f8e39a8e8806717453
@@ -0,0 +1,2 @@
1
+ ---
2
+ service_name: travis-ci
@@ -0,0 +1,9 @@
1
+ *.gem
2
+ *.lock
3
+ .bundle/
4
+ .yardoc/
5
+ coverage/
6
+ doc/
7
+ log/
8
+ pkg/
9
+ tmp/
@@ -0,0 +1,9 @@
1
+ # Settings for metric_fu and its packages are collected in the `config/metrics`
2
+ # and loaded by the Hexx::Suit::Metrics::MetricFu.
3
+
4
+ begin
5
+ require "hexx-suit"
6
+ Hexx::Suit::Metrics::MetricFu.load
7
+ rescue LoadError
8
+ puts "The 'hexx-suit' gem is not installed"
9
+ end
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --require spec_helper
2
+ --color
@@ -0,0 +1,2 @@
1
+ ---
2
+ inherit_from: "./config/metrics/rubocop.yml"
@@ -0,0 +1,18 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ script: "bundle exec rake test:coverage:run"
5
+ bundler_args: --without metrics
6
+ env:
7
+ global:
8
+ - JRUBY_OPTS='--dev -J-Xmx1024M'
9
+ rvm:
10
+ - '2.1'
11
+ - '2.2'
12
+ - ruby-head
13
+ - rbx-2 --2.1
14
+ - jruby-head
15
+ matrix:
16
+ allow_failures:
17
+ - rvm: ruby-head
18
+ - rvm: jruby-head
@@ -0,0 +1,3 @@
1
+ --asset LICENSE
2
+ --exclude lib/faceter/version.rb
3
+ --output doc/api
@@ -0,0 +1,3 @@
1
+ ## version 0.0.1 2015-08-06
2
+
3
+ This is the first published version
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ group :metrics do
6
+ gem "hexx-suit", "~> 2.3" if RUBY_ENGINE == "ruby"
7
+ end
8
+
9
+ gem "thread_safe"
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+
3
+ guard :rspec, cmd: "bundle exec rspec" do
4
+
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/faceter/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
7
+ watch("lib/faceter.rb") { "spec" }
8
+ watch("spec/spec_helper.rb") { "spec" }
9
+
10
+ end # guard :rspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2015 Andrew Kozin (nepalez), andrew.kozin@gmail.com
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.
@@ -0,0 +1,295 @@
1
+ Faceter
2
+ =======
3
+
4
+ [![Gem Version](https://img.shields.io/gem/v/faceter.svg?style=flat)][gem]
5
+ [![Build Status](https://img.shields.io/travis/nepalez/faceter/master.svg?style=flat)][travis]
6
+ [![Dependency Status](https://img.shields.io/gemnasium/nepalez/faceter.svg?style=flat)][gemnasium]
7
+ [![Code Climate](https://img.shields.io/codeclimate/github/nepalez/faceter.svg?style=flat)][codeclimate]
8
+ [![Coverage](https://img.shields.io/coveralls/nepalez/faceter.svg?style=flat)][coveralls]
9
+ [![Inline docs](http://inch-ci.org/github/nepalez/faceter.svg)][inch]
10
+
11
+ [codeclimate]: https://codeclimate.com/github/nepalez/faceter
12
+ [coveralls]: https://coveralls.io/r/nepalez/faceter
13
+ [gem]: https://rubygems.org/gems/faceter
14
+ [gemnasium]: https://gemnasium.com/nepalez/faceter
15
+ [travis]: https://travis-ci.org/nepalez/faceter
16
+ [inch]: https://inch-ci.org/github/nepalez/faceter
17
+
18
+ Experimental [ROM]-compatible data mapper, based on the [transproc] gem.
19
+
20
+ No monkey-patching, no mutable instances of any class.
21
+
22
+ 100% [mutant]-covered.
23
+
24
+ [ROM]: https://github.com/rom-rb/rom
25
+ [transproc]: https://github.com/solnic/transproc
26
+ [mutant]: https://github.com/mbj/mutant
27
+
28
+ Motivation
29
+ ----------
30
+
31
+ Basicaly the gem does about the same as the ROM mappers do. But its DSL has a different semantics:
32
+
33
+ * Unlike ROM mappers, that describes the structure of transformed data with *nouns* (`attribute :foo, from: :bar`), the `Faceter` DSL uses *verbs* to describe transformations (`rename :bar, to: :foo`). `Faceter` transformations are either "do this, from: that", or "change this, to: that".
34
+
35
+ * Unlike ROM, that mixes transformations (`attribute :bar, from: :foo`) with structures (wrap(:foo) { attribute :bar }), the `Faceter` strictly separates them. It uses 2 *nouns*: `list` an `field` (like `embedded` in ROM) to browse the data, and *verbs* to transform them. Only browsing can be nested and should end up with some transformation. Nested transformations are not supported.
36
+
37
+ * Due to stronger separation between browsing an transforming data, every command in `Faceter` is executed as a single `step` in ROM. The output of every transformation serves the input for the next one. This makes it possible to read mapper DSL as a set of instructions: "go to this level and change data in this way, then go to that level etc.".
38
+
39
+ * Because `Faceter` uses one-step transformations, it supports inline syntax for the transformations only. Blocks are used either to browse the data, or to provide value for the `create` command.
40
+
41
+ * When you inherit a mapper, the subclass will do all the transformations from its superclass and then add its own. So the inheritance can be used to deepen transformation as an alternative to chaining mappers.
42
+
43
+ The `Faceter` is the **experimental** gem. I've wrote it to check whether this "concept" of procedure-like syntax would work fine and not overkill the recipy with too much details.
44
+
45
+ Synopsis
46
+ --------
47
+
48
+ To access the data the mapper DSL has two methods, that can be nested deeply:
49
+
50
+ * `list` - "do something with every element of array"
51
+ * `field` - "do something with a value of hash key"
52
+
53
+ The mapper also has methods to transform the accessed data (either a field of some tuple or values of some array):
54
+
55
+ * `rename` to rename fields in a tuple
56
+ * `create` and `exclude` to provide a new field from other ones (while keeping those fields unchanged) or exclude the existing one(s).
57
+ * `add_prefix` and `remove_prefix` to add/remove a prefix to names of field
58
+ * `stringify_keys` and `symbolize_keys` to stringify/symbolize all keys from given layer and deeper
59
+ * `wrap` and `unwrap` to wrap a value to nested tuple or unwrap it from a tuple
60
+ * `group` and `ungroup` to group/ungroup tuples in array by some field(s)
61
+
62
+ Suppose you need to transform array of nested data:
63
+
64
+ ```ruby
65
+ source = [
66
+ {
67
+ id: 1, name: 'Joe', roles: ['admin'],
68
+ emails: [
69
+ { address: 'joe@doe.com', type: 'job' },
70
+ { address: 'joe@job.com', type: 'job' },
71
+ { address: 'joe@doe.org', type: 'personal' }
72
+ ]
73
+ }
74
+ ]
75
+ ```
76
+
77
+ To create a mapper, include `Faceter` to the mapper class and define the sequence of transformations. Transformations will be applied step-by-step to data at a corresponding level.
78
+
79
+ ```ruby
80
+ require "faceter"
81
+
82
+ class Mapper
83
+ include Faceter
84
+
85
+ list do
86
+ field :roles do
87
+ list { fold to: :role }
88
+ end
89
+
90
+ rename :emails, to: :contacts
91
+ end
92
+
93
+ # Both `ungroup` and `group` work with arrays as a whole. You haven't
94
+ # wrap them to the `list` unless your data are not the arrays of arrays.
95
+ ungroup :role, from: :roles
96
+
97
+ group :id, :name, :contacts, to: :user
98
+
99
+ list do
100
+ field :user do
101
+ field :contacts do
102
+ list { rename :address, to: :email }
103
+ group :address, to: :emails
104
+ end
105
+ end
106
+ end
107
+ end
108
+ ```
109
+
110
+ To apply transformation to the source initialize the mapper and send the source array to its `call` instance method:
111
+
112
+ ```ruby
113
+ mapper = Mapper.new
114
+ mapper.call source
115
+ # => [
116
+ # {
117
+ # role: 'admin',
118
+ # users: [
119
+ # {
120
+ # id: 1,
121
+ # name: 'Joe',
122
+ # contacts: [
123
+ # { type: 'job', emails: ['joe@doe.com', 'joe@job.com'] },
124
+ # { type: 'personal', emails: ['joe@doe.org'] }
125
+ # ]
126
+ # }
127
+ # ]
128
+ # }
129
+ # ]
130
+ ```
131
+
132
+ Instantiating Models
133
+ --------------------
134
+
135
+ You can do any data transformations using `create` method, that does the following:
136
+
137
+ * takes values from tuple by keys given in `:from` option,
138
+ * sends those values to the block in the same order,
139
+ * assigns the result of the block either to given key, or rewrites the whole tuple with given value.
140
+
141
+ ```ruby
142
+ require "faceter"
143
+ require "ostruct"
144
+
145
+ class Mapper
146
+ include Faceter
147
+
148
+ list do
149
+ create from: [:id, :name, :email] do |id, name, email|
150
+ OpenStruct.new id: id, name: name, email: email
151
+ end
152
+ end
153
+ end
154
+ ```
155
+
156
+ Alternatively, you could wrap the necessary keys and then create new value with the same key:
157
+
158
+ ```ruby
159
+ require "faceter"
160
+ require "ostruct"
161
+
162
+ class Mapper
163
+ include Faceter
164
+
165
+ list do
166
+ wrap to: :user # wraps all keys in every tuple to the :user key
167
+
168
+ create from: :user do |user|
169
+ OpenStruct.new(user)
170
+ end
171
+ end
172
+ end
173
+ ```
174
+
175
+ Both the examples transform the array of tuples:
176
+
177
+ ```ruby
178
+ source = [
179
+ { id: 1, name: "Joe", email: "joe@doe.com" },
180
+ { id: 2, name: "Jane", email: "jane@doe.com" }
181
+ ]
182
+ ```
183
+
184
+ into the array of instances:
185
+
186
+ ```ruby
187
+ mapper = Mapper.new
188
+ mapper.call(source)
189
+ # => [
190
+ # #<OpenStruct @id=1, @name="Joe", @email="joe@doe.com">,
191
+ # #<OpenStruct @id=2, @name="Jane", @email="jane@doe.com">
192
+ # ]
193
+ ```
194
+
195
+ ### Data Serialization
196
+
197
+ In just the same way you can serialize models at the mapper layer:
198
+
199
+ ```ruby
200
+ source = [
201
+ OpenStruct.new(id: 1, name: "Joe", email: "joe@doe.com"),
202
+ OpenStruct.new(id: 2, name: "Jane", email: "jane@doe.com")
203
+ ]
204
+
205
+ class Mapper < Faceter::Mapper
206
+ list do
207
+ # take every item in a list, create the value and assign it back to the item
208
+ create do |item|
209
+ { id: item.id, name: item.name, email: item.email }
210
+ end
211
+ end
212
+ end
213
+
214
+ mapper = Mapper.new
215
+ mapper.call source
216
+ # => [
217
+ # { id: 1, name: "Joe", email: "joe@doe.com" },
218
+ # { id: 2, name: "Jane", email: "jane@doe.com" }
219
+ # ]
220
+ ```
221
+
222
+ ### ROM-compatibility
223
+
224
+ To use the mapper in [ROM] you can register it as a custom mapper for the corresponding relation:
225
+
226
+ ```ruby
227
+ setup = ROM.setup :memory
228
+
229
+ setup.relation(:users)
230
+ setup.mappers { register(:users, my_mapper: mapper) }
231
+
232
+ rom = ROM.finalize.env
233
+
234
+ rom.relation(:users).as(:my_mapper).to_a
235
+ # => returns the converted data
236
+ ```
237
+
238
+ Installation
239
+ ------------
240
+
241
+ Add this line to your application's Gemfile:
242
+
243
+ ```ruby
244
+ # Gemfile
245
+ gem "faceter"
246
+ ```
247
+
248
+ Then execute:
249
+
250
+ ```
251
+ bundle
252
+ ```
253
+
254
+ Or add it manually:
255
+
256
+ ```
257
+ gem install faceter
258
+ ```
259
+
260
+ Compatibility
261
+ -------------
262
+
263
+ Tested under rubies [compatible to MRI 2.1+](.travis.yml).
264
+ JRuby is supported from the head version only.
265
+
266
+ Uses [RSpec] 3.0+ for testing and [hexx-suit] for dev/test tools collection.
267
+
268
+ [RSpec]: http://rspec.org
269
+ [hexx-suit]: https://github.com/nepalez/hexx-suit
270
+
271
+ Contributing
272
+ ------------
273
+
274
+ * Read the [STYLEGUIDE](config/metrics/STYLEGUIDE)
275
+ * [Fork the project](https://github.com/nepalez/faceter)
276
+ * Create your feature branch (`git checkout -b my-new-feature`)
277
+ * Add tests for it
278
+ * Commit your changes (`git commit -am '[UPDATE] Add some feature'`)
279
+ * Push to the branch (`git push origin my-new-feature`)
280
+ * Create a new Pull Request
281
+
282
+ Credits
283
+ -------
284
+
285
+ This project is heavily inspired by and based on gems written by [Piotr Solnica]:
286
+
287
+ * [ROM] aka Ruby Object Mapper
288
+ * [transproc] Functional-style transformations in Ruby
289
+
290
+ [Piotr Solnica]: https://github.com/solnic
291
+
292
+ License
293
+ -------
294
+
295
+ See the [MIT LICENSE](LICENSE).
@@ -0,0 +1,37 @@
1
+ # encoding: utf-8
2
+
3
+ require "rubygems"
4
+ require "bundler/setup"
5
+
6
+ # Loads bundler tasks
7
+ Bundler::GemHelper.install_tasks
8
+
9
+ # Loads the Hexx::RSpec and its tasks
10
+ begin
11
+ require "hexx-suit"
12
+ Hexx::Suit.install_tasks
13
+ rescue LoadError
14
+ require "hexx-rspec"
15
+ Hexx::RSpec.install_tasks
16
+ end
17
+
18
+ # Sets the Hexx::RSpec :test task to default
19
+ task default: "test:coverage:run"
20
+
21
+ desc "Shows the first evil"
22
+ task :mutant do
23
+ system "bundle exec mutant -r faceter --use rspec 'Faceter*' --fail-fast"
24
+ end
25
+
26
+ desc "Shows all evils"
27
+ task :exhort do
28
+ system "bundle exec mutant -r faceter --use rspec 'Faceter*'"
29
+ end
30
+
31
+ desc "Runs all the necessary metrics before making a commit"
32
+ task prepare: %w(exhort check:inch check:rubocop check:fu)
33
+
34
+ desc "Compares faceter to rom mapper"
35
+ task :benchmark do
36
+ system "ruby benchmark/run.rb"
37
+ end