abyme 0.2.2 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/.github/workflows/build.yml +60 -0
- data/.gitignore +2 -0
- data/.simplecov +0 -0
- data/CHANGELOG.md +114 -0
- data/Gemfile.lock +162 -28
- data/README.md +119 -180
- data/Rakefile +31 -8
- data/abyme.gemspec +15 -1
- data/javascript/abyme_controller.js +86 -11
- data/lib/abyme.rb +2 -0
- data/lib/abyme/abyme_builder.rb +21 -10
- data/lib/abyme/action_view_extensions/builder.rb +17 -0
- data/lib/abyme/controller.rb +15 -0
- data/lib/abyme/engine.rb +3 -1
- data/lib/abyme/model.rb +81 -5
- data/lib/abyme/version.rb +4 -2
- data/lib/abyme/view_helpers.rb +186 -15
- data/package.json +2 -2
- metadata +148 -7
- data/.travis.yml +0 -7
- data/lib/generators/.DS_Store +0 -0
- data/lib/generators/abyme/install_generator.rb +0 -25
- data/lib/generators/abyme/templates/abyme_controller.js +0 -17
data/README.md
CHANGED
@@ -1,16 +1,47 @@
|
|
1
|
-
#
|
1
|
+
# abyme 🕳
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/abyme.svg)](https://badge.fury.io/rb/abyme)
|
4
|
+
![build](https://github.com/bear-in-mind/abyme/workflows/build/badge.svg)
|
5
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/f591a9e00f7cf5188ad5/maintainability)](https://codeclimate.com/github/bear-in-mind/abyme/maintainability)
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/github/bear-in-mind/abyme/badge.svg)](https://coveralls.io/github/bear-in-mind/abyme?branch=master)
|
4
7
|
|
5
|
-
|
6
|
-
|
8
|
+
abyme is an easy and form-agnostic way to handle nested attributes in Rails, using [stimulus](https://stimulusjs.org/handbook/introduction) under the hood. Here's an example :
|
9
|
+
```ruby
|
10
|
+
# views/projects/_form.html.erb
|
11
|
+
<%= form_for @project do |f| %>
|
12
|
+
<%= f.text_field :title %>
|
13
|
+
<%= f.text_area :description %>
|
14
|
+
<%= f.submit 'Save' %>
|
15
|
+
|
16
|
+
<%= f.abyme_for(:tasks) %>
|
17
|
+
<% end %>
|
18
|
+
```
|
19
|
+
Supposing you have a `Project` that `has_many :tasks` and a partial located in `views/abyme/_task_fields` containing your form fields for `tasks`, the `abyme_for` command will generate and display 3 elements in this order :
|
20
|
+
- A `div` containing all task fields for `@project.tasks` (either persisted or already built instances of `tasks`)
|
21
|
+
- A `div` which will contain all additional tasks about to be created (added through the `Add task` button below)
|
22
|
+
- A `button` to generate fields for new instances of tasks
|
7
23
|
|
8
|
-
|
24
|
+
Have a look below to learn more about configuration and all its different options.
|
9
25
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
26
|
+
## Demo app
|
27
|
+
|
28
|
+
![Demo preview](https://res.cloudinary.com/aux-belles-autos/image/upload/v1603040053/abyme-preview.gif)
|
29
|
+
|
30
|
+
Check out our demo app here : https://abyme-demo.herokuapp.com/
|
31
|
+
|
32
|
+
Source code is right here : https://github.com/bear-in-mind/abyme_demo
|
33
|
+
|
34
|
+
## Breaking changes
|
35
|
+
Careful ! As of February 12th, we changed quite a few methods name :
|
36
|
+
In model:
|
37
|
+
- `abyme_for` became `abymize`
|
38
|
+
In views:
|
39
|
+
- `abymize(:association, f)` became `f.abyme_for(:association)`
|
40
|
+
- `add_association` became `add_associated_record`
|
41
|
+
- `remove_association` became `remove_associated_record`
|
42
|
+
|
43
|
+
The former method names will be deprecated soon.
|
44
|
+
If you update, don't forget to change those ! All changes are reflected in the README below.
|
14
45
|
|
15
46
|
## Installation
|
16
47
|
|
@@ -41,272 +72,180 @@ application.load(definitionsFromContext(context))
|
|
41
72
|
application.register('abyme', AbymeController)
|
42
73
|
```
|
43
74
|
|
44
|
-
##
|
75
|
+
## Get started
|
76
|
+
|
77
|
+
To learn more about the *why* of this gem, check out our [wiki](https://github.com/bear-in-mind/abyme/wiki/What-are-nested-forms-and-why-a-new-gem-%3F)
|
45
78
|
|
46
|
-
|
79
|
+
You may also check out our [step by step tutorial](https://github.com/bear-in-mind/abyme/wiki/Step-by-step-Tutorial)
|
47
80
|
|
48
|
-
Rails provides [its own helper](https://api.rubyonrails.org/v6.0.1/classes/ActionView/Helpers/FormHelper.html#method-i-fields_for) to handle nested attributes. **abyme** is basically a smart wrapper around it, offering easier syntax along with some fancy additions. To work properly, some configuration will be required in both models and controllers (see below).
|
49
81
|
|
50
|
-
|
82
|
+
### Model
|
51
83
|
|
52
|
-
|
84
|
+
💡 Don't forget to `include Abyme::Model` in your parent model
|
53
85
|
|
54
|
-
|
55
|
-
|
86
|
+
#### #abymize(:association, permit: nil, reject: nil, options = {})
|
87
|
+
In models, the `abyme_for :association` acts as an alias for this command :
|
56
88
|
```ruby
|
57
|
-
|
58
|
-
class Project < ApplicationRecord
|
59
|
-
has_many :tasks
|
60
|
-
validates :title, :description, presence: true
|
61
|
-
end
|
62
|
-
|
63
|
-
# models/task.rb
|
64
|
-
class Task < ApplicationRecord
|
65
|
-
belongs_to :project
|
66
|
-
has_many :comments
|
67
|
-
validates :title, :description, presence: true
|
68
|
-
end
|
69
|
-
|
70
|
-
# models/comment.rb
|
71
|
-
class Comment < ApplicationRecord
|
72
|
-
belongs_to :task
|
73
|
-
validates :content, presence: true
|
74
|
-
end
|
89
|
+
accepts_nested_attributes_for :association, reject_if: :all_blank, :allow_destroy: true
|
75
90
|
```
|
76
|
-
|
77
|
-
|
91
|
+
|
92
|
+
* `permit: []` : allows you to generate a hash of attributes that can be easily called on the controller side through the `::abyme_attributes` class method (see details below).
|
78
93
|
```ruby
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
# ...
|
84
|
-
abyme_for :tasks
|
85
|
-
end
|
86
|
-
|
87
|
-
# models/task.rb
|
88
|
-
class Task < ApplicationRecord
|
89
|
-
include Abyme::Model
|
90
|
-
has_many :comments, inverse_of: :task
|
91
|
-
# ...
|
92
|
-
abyme_for :comments
|
93
|
-
end
|
94
|
+
abymize :association, permit: [:name, :description]
|
95
|
+
|
96
|
+
# You may also permit all attributes like so :
|
97
|
+
abymize :association, permit: :all_attributes
|
94
98
|
```
|
95
|
-
Note the use of the `inverse_of` option. It is needed for Rails to effectively associate children to their yet unsaved parent. Have a peek to the bottom of [this page](https://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html#method-i-accepts_nested_attributes_for) for more info.
|
96
|
-
|
97
|
-
### Controller
|
98
|
-
Since we're dealing with one form, we're only concerned with one controller : the one the form routes to. In our example, this would be the `ProjectsController`.
|
99
|
-
The only configuration needed here will concern our strong params. Nested attributes require a very specific syntax to white-list the permitted attributes. It looks like this :
|
100
99
|
|
100
|
+
* `reject: []` : allows you to add all attributes to `::abyme_attributes`, excepted the ones specified.
|
101
101
|
```ruby
|
102
|
-
|
103
|
-
params.require(:project).permit(
|
104
|
-
:title, :description, tasks_attributes: [
|
105
|
-
:id, :title, :description, :_destroy, comments_attributes: [
|
106
|
-
:id, :content, :_destroy
|
107
|
-
]
|
108
|
-
]
|
109
|
-
)
|
110
|
-
end
|
102
|
+
abymize :association, reject: [:password]
|
111
103
|
```
|
112
|
-
A few explanations here.
|
113
104
|
|
114
|
-
*
|
105
|
+
* `options: {}` : [the same options] you may pass to the `accepts_nested_attributes` method (see [this link](https://api.rubyonrails.org/v6.1.0/classes/ActiveRecord/NestedAttributes/ClassMethods.html) for details)
|
106
|
+
```ruby
|
107
|
+
abyme_for :association, limit: 3, allow_destroy: false
|
108
|
+
```
|
115
109
|
|
116
|
-
|
110
|
+
#### ::abyme_attributes
|
111
|
+
Returns a hash to the right format to be included in the `strong params` on the controller side. For a `Project` model with nested `:tasks` :
|
112
|
+
```ruby
|
113
|
+
Project.abyme_attributes
|
114
|
+
# => {tasks_attributes: [:title, :description, :id, :_destroy]}
|
115
|
+
```
|
117
116
|
|
118
|
-
|
117
|
+
### Controller
|
118
|
+
#### #abyme_attributes
|
119
|
+
Infers the name of the resource from the controller name, and calls the `::abyme_attributes` method on it. Hence, in your `ProjectsController` :
|
120
|
+
```ruby
|
121
|
+
def project_params
|
122
|
+
params.require(:project).permit(:title, :description, abyme_attributes)
|
123
|
+
end
|
124
|
+
```
|
119
125
|
|
120
|
-
|
126
|
+
### Views
|
121
127
|
|
122
|
-
|
123
|
-
|
124
|
-
* Display fields for the **new records** (future `:tasks` not yet persisted)
|
125
|
-
* A button to **trigger the addition** of fields for a new resource (an `Add a new task` button)
|
126
|
-
* A button to **remove fields** for a given resource (`Remove task`)
|
128
|
+
#### #abyme_for(:association, options = {}, &block)
|
129
|
+
This is the container for all your nested fields. It takes the symbolized association as a parameter, along with options, and an optional block to specify any layout you may wish for the different parts of the `abyme` builder.
|
127
130
|
|
128
|
-
|
131
|
+
💡 Please note an id is automatically added to this element, which value is : `abyme--association_name`.
|
129
132
|
|
133
|
+
💡 If you don't pass a block, `records`, `new_records` and `add_association` will be called and will appear in this order in your layout.
|
134
|
+
* `partial: ` : allows you to indicate a custom partial path for both `records` and `new_records`
|
130
135
|
```ruby
|
131
|
-
|
132
|
-
<%= simple_form_for @project do |f| %>
|
133
|
-
<%= f.input :title %>
|
134
|
-
<%= f.input :description %>
|
135
|
-
<%= f.submit 'Save' %>
|
136
|
-
|
137
|
-
<%= abymize(:tasks, f) do |abyme| %>
|
136
|
+
<%= f.abyme_for(:tasks, partial: 'projects/task_fields') do |abyme| %>
|
138
137
|
<%= abyme.records %>
|
139
138
|
<%= abyme.new_records %>
|
140
139
|
<%= add_association %>
|
141
140
|
<% end %>
|
142
|
-
<% end %>
|
143
|
-
```
|
144
|
-
|
145
|
-
`abyme.records` will contain the persisted associations fields, while `abyme.new_records` will contain fields for the new associations. `add_association` will by default generate a button with a text of type "Add `resource_name`". To work properly, this method **has** to be called **inside the block** passed to the `abymize` method.
|
146
|
-
|
147
|
-
Now where's the code for these fields ? abyme will assume a **partial** to be present in the directory `/views/abyme` with a *name respecting this naming convention* (just like with [cocoon](https://github.com/nathanvda/cocoon#basic-usage)): `_singular_association_name_fields.html.erb`.
|
148
|
-
|
149
|
-
This partial might look like this:
|
150
|
-
```ruby
|
151
|
-
# views/abyme/_task_fields.html.erb
|
152
|
-
<%= f.input :title %>
|
153
|
-
<%= f.input :description %>
|
154
|
-
<%= f.hidden_field :_destroy %>
|
155
|
-
|
156
|
-
<%= remove_association(tag: :div) do %>
|
157
|
-
<i class="fas fa-trash"></i>
|
158
|
-
<% end %>
|
159
141
|
```
|
160
|
-
|
161
|
-
Note the presence of the `remove_association` button. Here, we pass it an option to make it a `<div>`, as well as a block to customize its content. Don't forget the `_destroy` attribute, needed to mark items for destruction.
|
162
|
-
|
163
|
-
### What about the controller ?
|
164
|
-
|
165
|
-
What about it ? Well, not much. That's the actual magical thing about `nested_attributes`: once your model is aware of its acceptance of those for a given association, and your strong params are correctly configured, there's nothing else to do.
|
166
|
-
`@project.create(project_params)` is all you'll need to save a project along with its descendants 👨👧👧
|
167
|
-
|
168
|
-
### Auto mode
|
169
|
-
|
170
|
-
Let's now take care of our comments fields. We'll add these using our neat *automatic mode*: just stick this line at the end of the partial:
|
142
|
+
* `limit: ` : allows you to limit the number of new fields that can be created through JS. If you need to limit the number of associations in database, you will need to add validations. You can also pass an option [in your model as well](https://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html#method-i-accepts_nested_attributes_for).
|
171
143
|
```ruby
|
172
|
-
|
173
|
-
#
|
174
|
-
<%=
|
144
|
+
<%= f.abyme_for(:tasks, limit: 5) do |abyme| %>
|
145
|
+
# Beyond 5 tasks, the add button won't add any more fields. See events section below to see how to handle the 'abyme:limit-reached' event
|
146
|
+
<%= abyme.records %>
|
147
|
+
<%= abyme.new_records %>
|
148
|
+
<%= add_association %>
|
149
|
+
<% end %>
|
175
150
|
```
|
176
|
-
|
177
|
-
|
178
|
-
## Advanced usage
|
179
|
-
### Models
|
180
|
-
In models, the `abyme_for :association` acts as an alias for this command :
|
181
|
-
|
151
|
+
* `min_count: ` by default, there won't be any blank fields added on page load. By passing a `min_count` option, you can set how many empty fields should appear in the form.
|
182
152
|
```ruby
|
183
|
-
|
153
|
+
<%= f.abyme_for(:tasks, min_count: 1) do |abyme| %>
|
154
|
+
# 1 blank task will automatically be added to the form.
|
155
|
+
<%= abyme.records %>
|
156
|
+
<%= abyme.new_records %>
|
157
|
+
<%= add_association %>
|
158
|
+
<% end %>
|
184
159
|
```
|
185
160
|
|
186
|
-
|
187
|
-
|
188
|
-
abyme_for :association, limit: 3, allow_destroy: false
|
189
|
-
```
|
161
|
+
*If you're not passing a block*, the `abyme_for` method can take a few additional options:
|
162
|
+
* `button_text: ` this will set the `add_association` button text to the string of your choice.
|
190
163
|
|
191
|
-
|
164
|
+
💡 All options that should be passed to either `records` or `new_records` below can be passed here and will be passed down.
|
192
165
|
|
193
166
|
#### #records
|
194
167
|
A few options can be passed to `abyme.records`:
|
195
168
|
* `collection:` : allows you to pass a collection of your choice to only display specific objects.
|
196
169
|
```ruby
|
197
|
-
<%=
|
170
|
+
<%= f.abyme_for(:tasks) do |abyme| %>
|
198
171
|
<%= abyme.records(collection: @project.tasks.where(done: false)) %>
|
199
172
|
<%= abyme.new_records %>
|
200
|
-
<%=
|
173
|
+
<%= add_associated_record %>
|
201
174
|
<% end %>
|
202
175
|
```
|
203
176
|
* `order:` : allows you to pass an ActiveRecord `order` method to sort your instances the way you want.
|
204
177
|
```ruby
|
205
|
-
<%=
|
178
|
+
<%= f.abyme_for(:tasks) do |abyme| %>
|
206
179
|
<%= abyme.records(order: { created_at: :asc }) %>
|
207
180
|
<%= abyme.new_records %>
|
208
|
-
<%=
|
181
|
+
<%= add_associated_record %>
|
209
182
|
<% end %>
|
210
183
|
```
|
211
|
-
* `partial:` : allows you to indicate a custom partial, if one has not already been passed to `
|
184
|
+
* `partial:` : allows you to indicate a custom partial, if one has not already been passed to `abyme_for`.
|
212
185
|
```ruby
|
213
|
-
<%=
|
186
|
+
<%= f.abyme_for(:tasks) do |abyme| %>
|
214
187
|
<%= abyme.records %>
|
215
188
|
<%= abyme.new_records(partial: 'projects/task_fields') %>
|
216
|
-
<%=
|
189
|
+
<%= add_associated_record %>
|
217
190
|
<% end %>
|
218
191
|
```
|
219
192
|
* `fields_html:` : gives you the possibility to add any HTML attribute you may want to each set of fields. By default, an `abyme--fields` and an `singular_association-fields` class are already present.
|
220
193
|
```ruby
|
221
|
-
<%=
|
194
|
+
<%= f.abyme_for(:tasks) do |abyme| %>
|
222
195
|
<%= abyme.records(fields_html: { class: "some-class" }) %>
|
223
196
|
# Every set of persisted fields will have these 3 classes : 'abyme--fields', 'task-fields', and 'some-class'
|
224
197
|
<%= abyme.new_records %>
|
225
|
-
<%=
|
198
|
+
<%= add_associated_record %>
|
226
199
|
<% end %>
|
227
200
|
```
|
228
|
-
* `wrapper_html:` : gives you the possibility to add any HTML attribute you may want to the wrapper containing all fields.
|
201
|
+
* `wrapper_html:` : gives you the possibility to add any HTML attribute you may want to the wrapper containing all persisted fields.
|
229
202
|
```ruby
|
230
|
-
<%=
|
203
|
+
<%= f.abyme_for(:tasks) do |abyme| %>
|
231
204
|
<%= abyme.records(wrapper_html: { class: "persisted-records" }) %>
|
232
205
|
# The wrapper containing all persisted task fields will have an id "abyme-tasks-wrapper" and a class "persisted-records"
|
233
206
|
<%= abyme.new_records %>
|
234
|
-
<%=
|
207
|
+
<%= add_associated_record %>
|
235
208
|
<% end %>
|
236
209
|
```
|
237
210
|
#### #new_records
|
238
211
|
Here are the options that can be passed to `abyme.new_records`:
|
239
212
|
* `position:` : allows you to specify whether new fields added dynamically should go at the top or at the bottom. `:end` is the default value.
|
240
213
|
```ruby
|
241
|
-
<%=
|
214
|
+
<%= f.abyme_for(:tasks) do |abyme| %>
|
242
215
|
<%= abyme.records %>
|
243
216
|
<%= abyme.new_records(position: :start) %>
|
244
|
-
<%=
|
217
|
+
<%= add_associated_record %>
|
245
218
|
<% end %>
|
246
219
|
```
|
247
220
|
* `partial:` : same as `#records`
|
248
221
|
* `fields_html:` : same as `#records`
|
249
222
|
* `wrapper_html:` : same as `#records`
|
250
223
|
|
251
|
-
#### #
|
224
|
+
#### #add_associated_record, #remove_associated_record
|
252
225
|
These 2 methods behave the same. Here are their options :
|
253
226
|
* `tag:` : allows you to specify a tag of your choosing, like `:a`, or `:div`. Default is `:button`.
|
254
227
|
* `content:` : the text to display inside the element. Default is `Add association_name`
|
255
228
|
* `html:` : gives you the possibility to add any HTML attribute you may want to the element.
|
256
229
|
```ruby
|
257
|
-
<%=
|
230
|
+
<%= f.abyme_for(:tasks) do |abyme| %>
|
258
231
|
# ...
|
259
|
-
<%=
|
232
|
+
<%= add_associated_record(tag: :a, content: "Add a super task", html: {id: "add-super-task"}) %>
|
260
233
|
<% end %>
|
261
234
|
```
|
262
235
|
|
263
236
|
As you may have seen above, you can also pass a block to the method to give it whatever HTML content you want :
|
264
237
|
```ruby
|
265
|
-
<%=
|
238
|
+
<%= f.abyme_for(:tasks) do |abyme| %>
|
266
239
|
# ...
|
267
|
-
<%=
|
240
|
+
<%= add_associated_record(tag: :div, html: {id: "add-super-task", class: "flex"}) do %>
|
268
241
|
<i class="fas fa-plus"></i>
|
269
242
|
<h2>Add a super task</h2>
|
270
243
|
<% end %>
|
271
244
|
<% end %>
|
272
245
|
```
|
273
246
|
|
274
|
-
|
275
|
-
#### #abymize(:association, form_object)
|
276
|
-
This is the container for all your nested fields. It takes two parameters (the symbolized association and the `form_builder`), and some optional ones. Please note an id is automatically added to this element, which value is : `abyme--association`.
|
277
|
-
* `partial:` : allows you to indicate a custom partial path for both `records` and `new_records`
|
278
|
-
```ruby
|
279
|
-
<%= abymize(:tasks, f, partial: 'projects/task_fields') do |abyme| %>
|
280
|
-
<%= abyme.records %>
|
281
|
-
<%= abyme.new_records %>
|
282
|
-
<%= add_association %>
|
283
|
-
<% end %>
|
284
|
-
```
|
285
|
-
* `limit:` : allows you to limit the number of new fields that can be created through JS. If you need to limit the number of associations in database, you will need to add validations. You can also pass an option [in your model as well](https://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html#method-i-accepts_nested_attributes_for).
|
286
|
-
```ruby
|
287
|
-
<%= abymize(:tasks, f, limit: 5) do |abyme| %>
|
288
|
-
# Beyond 5 tasks, the add button won't add any more fields. See events section below to see how to handle the 'abyme:limit-reached' event
|
289
|
-
<%= abyme.records %>
|
290
|
-
<%= abyme.new_records %>
|
291
|
-
<%= add_association %>
|
292
|
-
<% end %>
|
293
|
-
```
|
294
|
-
* `min_count` : by default, there won't be any blank fields added on page load. By passing a `min_count` option, you can set how many empty fields should appear in the form.
|
295
|
-
```ruby
|
296
|
-
<%= abymize(:tasks, f, min_count: 1) do |abyme| %>
|
297
|
-
# 1 blank task will automatically be added to the form.
|
298
|
-
<%= abyme.records %>
|
299
|
-
<%= abyme.new_records %>
|
300
|
-
<%= add_association %>
|
301
|
-
<% end %>
|
302
|
-
```
|
303
|
-
|
304
|
-
*When in auto mode*, the abymize method can take a few options:
|
305
|
-
* `button_text:` : this will set the `add_association` button text to the string of your choice.
|
306
|
-
* All options that should be passed to either `records` or `new_records` can be passed here and will be passed down.
|
307
|
-
|
308
247
|
## Events
|
309
|
-
This part is still a work in progress and subject to change. We're providing some basic self-explanatory events to attach to. These are emitted by the main container (created by the `
|
248
|
+
This part is still a work in progress and subject to change. We're providing some basic self-explanatory events to attach to. These are emitted by the main container (created by the `abyme_for` method).
|
310
249
|
|
311
250
|
We're currently thinking about a way to attach to these via Stimulus. Coming soon !
|
312
251
|
|
data/Rakefile
CHANGED
@@ -1,15 +1,31 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
1
|
+
# require "bundler/gem_tasks"
|
2
2
|
require "rspec/core/rake_task"
|
3
|
-
require 'rails/dummy/tasks'
|
3
|
+
# require 'rails/dummy/tasks'
|
4
4
|
|
5
5
|
RSpec::Core::RakeTask.new(:spec)
|
6
6
|
task :default => :spec
|
7
7
|
|
8
|
-
APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
|
9
|
-
load 'rails/tasks/engine.rake'
|
10
|
-
load 'rails/tasks/statistics.rake'
|
8
|
+
# APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
|
9
|
+
# load 'rails/tasks/engine.rake'
|
10
|
+
# load 'rails/tasks/statistics.rake'
|
11
11
|
|
12
|
-
Bundler::GemHelper.install_tasks
|
12
|
+
# Bundler::GemHelper.install_tasks
|
13
|
+
|
14
|
+
# begin
|
15
|
+
# require 'bundler/setup'
|
16
|
+
# rescue LoadError
|
17
|
+
# puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
18
|
+
# end
|
19
|
+
|
20
|
+
# require 'rdoc/task'
|
21
|
+
|
22
|
+
# RDoc::Task.new(:rdoc) do |rdoc|
|
23
|
+
# rdoc.rdoc_dir = 'rdoc'
|
24
|
+
# rdoc.title = 'Abyme'
|
25
|
+
# rdoc.options << '--line-numbers'
|
26
|
+
# rdoc.rdoc_files.include('README.md')
|
27
|
+
# rdoc.rdoc_files.include('lib/**/*.rb')
|
28
|
+
# end
|
13
29
|
|
14
30
|
begin
|
15
31
|
require 'bundler/setup'
|
@@ -21,8 +37,15 @@ require 'rdoc/task'
|
|
21
37
|
|
22
38
|
RDoc::Task.new(:rdoc) do |rdoc|
|
23
39
|
rdoc.rdoc_dir = 'rdoc'
|
24
|
-
rdoc.title = '
|
40
|
+
rdoc.title = 'SampleEngineWithRspecAndCucumber'
|
25
41
|
rdoc.options << '--line-numbers'
|
26
|
-
rdoc.rdoc_files.include('README.
|
42
|
+
rdoc.rdoc_files.include('README.rdoc')
|
27
43
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
28
44
|
end
|
45
|
+
|
46
|
+
APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
|
47
|
+
|
48
|
+
load 'rails/tasks/engine.rake'
|
49
|
+
load 'rails/tasks/statistics.rake'
|
50
|
+
|
51
|
+
Bundler::GemHelper.install_tasks
|