hot-glue 0.0.2 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +12 -7
- data/Gemfile +4 -9
- data/Gemfile.lock +42 -22
- data/README.md +140 -30
- data/Rakefile +1 -1
- data/app/assets/config/manifest.js +0 -0
- data/bin/rails +2 -2
- data/config/database.yml +11 -0
- data/db/migrate/20210306212711_create_abcs.rb +11 -0
- data/db/migrate/20210306223300_create_defs.rb +9 -0
- data/db/migrate/20210306223305_create_hgis.rb +9 -0
- data/db/migrate/20210306223309_create_jkls.rb +9 -0
- data/db/migrate/20210306223701_devise_create_users.rb +44 -0
- data/db/migrate/20210306225506_create_xyzs.rb +9 -0
- data/db/schema.rb +60 -0
- data/lib/generators/hot_glue/install_generator.rb +3 -3
- data/lib/generators/hot_glue/scaffold_generator.rb +250 -138
- data/lib/generators/hot_glue/templates/_errors.haml +6 -5
- data/lib/generators/hot_glue/templates/_flash_notices.haml +7 -6
- data/lib/generators/hot_glue/templates/_line.haml +1 -1
- data/lib/generators/hot_glue/templates/_list.haml +4 -2
- data/lib/generators/hot_glue/templates/_new_button.haml +1 -1
- data/lib/generators/hot_glue/templates/_new_form.haml +10 -0
- data/lib/generators/hot_glue/templates/_show.haml +1 -1
- data/lib/generators/hot_glue/templates/{base_controller.rb → base_controller.rb.erb} +0 -0
- data/lib/generators/hot_glue/templates/{controller.rb → controller.rb.erb} +11 -7
- data/lib/generators/hot_glue/templates/create.turbo_stream.haml +12 -3
- data/lib/generators/hot_glue/templates/edit.haml +2 -0
- data/lib/generators/hot_glue/templates/index.haml +1 -1
- data/lib/generators/hot_glue/templates/new.haml +1 -10
- data/lib/generators/hot_glue/templates/{controller_spec.rb → request_spec.rb.erb} +0 -0
- data/lib/generators/hot_glue/templates/system_spec.rb.erb +109 -0
- data/lib/hotglue/version.rb +1 -1
- metadata +17 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae1088aa0a809a10fb6332fa7ca062e1af6aa39a1c8541dabdf4d8451c5ba04d
|
4
|
+
data.tar.gz: a3ff6d5d8a171e1d1d361df692f6255f855720609e692c21573d6311fbeb41e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f65f042a47123cb7a7f69222ddf6618ca085f8cb38bf372179f3bb3da6e47fb07cb383ecba4e0c22642d775db004c0ab111fc99667f575fde62869f7d4c4efba
|
7
|
+
data.tar.gz: e6c36f5bb8a516ee2e74250000174eede61f39c38c46fb74ac963cfa958ac2c5ba2bd3323832b1359ef452e532b7e01b24e04ff68bb67b28df781ccf04e958a4
|
data/.gitignore
CHANGED
@@ -1,16 +1,21 @@
|
|
1
1
|
.bundle/
|
2
2
|
log/*.log
|
3
3
|
pkg/
|
4
|
-
|
5
|
-
test/dummy/db/*.sqlite3-journal
|
6
|
-
test/dummy/db/*.sqlite3-*
|
7
|
-
test/dummy/log/*.log
|
8
|
-
test/dummy/storage/
|
9
|
-
test/dummy/tmp/
|
4
|
+
|
10
5
|
.byebug_history
|
11
6
|
|
12
7
|
.idea/
|
13
8
|
*.gem
|
14
9
|
.DS_Store
|
15
10
|
|
16
|
-
dump.rdb
|
11
|
+
dump.rdb
|
12
|
+
tmp/
|
13
|
+
|
14
|
+
|
15
|
+
db/*.sqlite3
|
16
|
+
|
17
|
+
spec/dummy/app/views/
|
18
|
+
spec/dummy/app/controllers/
|
19
|
+
spec/dummy/specs/
|
20
|
+
|
21
|
+
spec/strawman/
|
data/Gemfile
CHANGED
@@ -1,15 +1,10 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
3
3
|
|
4
|
-
# Declare your gem's dependencies in common_core_js.gemspec.
|
5
|
-
# Bundler will treat runtime dependencies like base dependencies, and
|
6
|
-
# development dependencies will be added by default to the :development group.
|
7
4
|
gemspec
|
8
5
|
|
9
|
-
|
10
|
-
|
11
|
-
# Git. Remember to move these dependencies to your gemspec before releasing
|
12
|
-
# your gem to rubygems.org.
|
6
|
+
gem 'sqlite3'
|
7
|
+
gem 'byebug'
|
13
8
|
|
14
|
-
|
15
|
-
|
9
|
+
gem 'rails', '6.1'
|
10
|
+
gem 'devise', require: true
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hot-glue (0.0.
|
4
|
+
hot-glue (0.0.7)
|
5
5
|
ffaker (~> 2.16)
|
6
6
|
haml-rails (~> 2.0)
|
7
7
|
kaminari (~> 1.2)
|
8
8
|
rails (~> 6.0)
|
9
9
|
sass-rails
|
10
|
+
turbo-rails (~> 0.5)
|
10
11
|
|
11
12
|
GEM
|
12
13
|
remote: https://rubygems.org/
|
@@ -70,12 +71,20 @@ GEM
|
|
70
71
|
minitest (>= 5.1)
|
71
72
|
tzinfo (~> 2.0)
|
72
73
|
zeitwerk (~> 2.3)
|
74
|
+
bcrypt (3.1.16)
|
73
75
|
builder (3.2.4)
|
76
|
+
byebug (11.1.3)
|
74
77
|
concurrent-ruby (1.1.8)
|
75
78
|
crass (1.0.6)
|
79
|
+
devise (4.7.3)
|
80
|
+
bcrypt (~> 3.0)
|
81
|
+
orm_adapter (~> 0.1)
|
82
|
+
railties (>= 4.1.0)
|
83
|
+
responders
|
84
|
+
warden (~> 1.2.3)
|
76
85
|
erubi (1.10.0)
|
77
86
|
erubis (2.7.0)
|
78
|
-
ffaker (2.
|
87
|
+
ffaker (2.18.0)
|
79
88
|
ffi (1.14.2)
|
80
89
|
globalid (0.4.2)
|
81
90
|
activesupport (>= 4.2.0)
|
@@ -117,10 +126,13 @@ GEM
|
|
117
126
|
method_source (1.0.0)
|
118
127
|
mimemagic (0.3.5)
|
119
128
|
mini_mime (1.0.2)
|
120
|
-
|
121
|
-
|
122
|
-
|
129
|
+
mini_portile2 (2.5.0)
|
130
|
+
minitest (5.14.4)
|
131
|
+
nio4r (2.5.7)
|
132
|
+
nokogiri (1.11.1)
|
133
|
+
mini_portile2 (~> 2.5.0)
|
123
134
|
racc (~> 1.4)
|
135
|
+
orm_adapter (0.5.0)
|
124
136
|
racc (1.5.2)
|
125
137
|
rack (2.2.3)
|
126
138
|
rack-test (1.1.0)
|
@@ -152,35 +164,39 @@ GEM
|
|
152
164
|
rake (>= 0.8.7)
|
153
165
|
thor (~> 1.0)
|
154
166
|
rake (13.0.3)
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
ruby_parser (3.15.
|
167
|
+
responders (3.0.1)
|
168
|
+
actionpack (>= 5.0)
|
169
|
+
railties (>= 5.0)
|
170
|
+
ruby_parser (3.15.1)
|
159
171
|
sexp_processor (~> 4.9)
|
160
|
-
sass (
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
sprockets
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
sprockets (3.7.2)
|
172
|
+
sass-rails (6.0.0)
|
173
|
+
sassc-rails (~> 2.1, >= 2.1.1)
|
174
|
+
sassc (2.4.0)
|
175
|
+
ffi (~> 1.9)
|
176
|
+
sassc-rails (2.1.2)
|
177
|
+
railties (>= 4.0.0)
|
178
|
+
sassc (>= 2.0)
|
179
|
+
sprockets (> 3.0)
|
180
|
+
sprockets-rails
|
181
|
+
tilt
|
182
|
+
sexp_processor (4.15.2)
|
183
|
+
sprockets (4.0.2)
|
173
184
|
concurrent-ruby (~> 1.0)
|
174
185
|
rack (> 1, < 3)
|
175
186
|
sprockets-rails (3.2.2)
|
176
187
|
actionpack (>= 4.0)
|
177
188
|
activesupport (>= 4.0)
|
178
189
|
sprockets (>= 3.0.0)
|
190
|
+
sqlite3 (1.4.2)
|
179
191
|
temple (0.8.2)
|
180
192
|
thor (1.1.0)
|
181
193
|
tilt (2.0.10)
|
194
|
+
turbo-rails (0.5.9)
|
195
|
+
rails (>= 6.0.0)
|
182
196
|
tzinfo (2.0.4)
|
183
197
|
concurrent-ruby (~> 1.0)
|
198
|
+
warden (1.2.9)
|
199
|
+
rack (>= 2.0.9)
|
184
200
|
websocket-driver (0.7.3)
|
185
201
|
websocket-extensions (>= 0.1.0)
|
186
202
|
websocket-extensions (0.1.5)
|
@@ -190,7 +206,11 @@ PLATFORMS
|
|
190
206
|
ruby
|
191
207
|
|
192
208
|
DEPENDENCIES
|
209
|
+
byebug
|
210
|
+
devise
|
193
211
|
hot-glue!
|
212
|
+
rails (= 6.1)
|
213
|
+
sqlite3
|
194
214
|
|
195
215
|
BUNDLED WITH
|
196
216
|
2.1.4
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ As well, its premise is a little different than the configuration-heavy admin in
|
|
6
6
|
|
7
7
|
It gives users full control over objects they 'own' and by default it spits out functionality giving access to all fields.
|
8
8
|
|
9
|
-
Hot Glue generates functionality that's quick and dirty. It let's you be crafty.
|
9
|
+
Hot Glue generates functionality that's quick and dirty. It let's you be crafty. As with a real glue gun, take care not to burn yourself while using it.
|
10
10
|
|
11
11
|
* Build plug-and-play scaffolding mixing HAML and turbo_stream responses
|
12
12
|
* Automatically Reads Your Models (make them before building your scaffolding!)
|
@@ -35,20 +35,29 @@ rails generate hot_glue:scaffold Thing
|
|
35
35
|
|
36
36
|
## TO INSTALL
|
37
37
|
|
38
|
-
- Add Turbo-Rails to your Gemfile & bundle install
|
38
|
+
- Add Turbo-Rails to your Gemfile & bundle install
|
39
|
+
|
40
|
+
- Then install it with `rails turbo:install`
|
39
41
|
|
40
42
|
- The Turbo install has switched your action cable settings from 'async' to Redis, so be sure to start a redis server
|
41
43
|
|
42
|
-
- Add hot_glue to your Gemfile & bundle install
|
44
|
+
- Add `hot_glue` to your Gemfile & `bundle install`
|
45
|
+
|
46
|
+
- Then install it with `rails generate hot_glue:install`
|
47
|
+
|
48
|
+
- Add to your `application.html.erb`
|
49
|
+
```
|
50
|
+
<%= render partial: 'layouts/flash_notices' %>
|
51
|
+
```
|
43
52
|
|
44
53
|
- Install Bootstrap (optional)
|
45
54
|
|
46
|
-
with Webpack:
|
55
|
+
Bootstrap with Webpack:
|
47
56
|
- change `stylesheet_link_tag` to `stylesheet_pack_tag` in your application layout
|
48
57
|
- `yarn add bootstrap`
|
49
|
-
- create a new file at `app/javascript/css/site.scss` with this
|
58
|
+
- create a new file at `app/javascript/css/site.scss` with this content
|
50
59
|
```
|
51
|
-
@import "~bootstrap/scss/bootstrap.scss
|
60
|
+
@import "~bootstrap/scss/bootstrap.scss";
|
52
61
|
```
|
53
62
|
|
54
63
|
- add to `app/javascript/packs/application.js`
|
@@ -56,28 +65,31 @@ with Webpack:
|
|
56
65
|
import 'css/site'
|
57
66
|
```
|
58
67
|
|
68
|
+
Bootstrap with Sprockets:
|
69
|
+
- use bootstrap-rails gem
|
59
70
|
|
60
71
|
|
61
72
|
- Install Devise or implement your own authentication
|
62
73
|
|
74
|
+
- Also recommended: font-awesome-sass
|
63
75
|
|
64
76
|
|
65
|
-
|
77
|
+
### First Argument
|
78
|
+
(no double slash)
|
66
79
|
|
67
|
-
|
80
|
+
TitleCase class name of the thing you want to build a scaffoling for.
|
68
81
|
|
69
|
-
Flags take two dashes (--) and do not take any value. Always pass options first, followed by the flags (or else your options won't work!)
|
70
82
|
|
71
|
-
|
83
|
+
## Options With Arguments
|
72
84
|
|
73
|
-
|
85
|
+
All options two dashes (--) and these take an `=` and a value
|
74
86
|
|
75
|
-
###
|
87
|
+
### `--namespace=`
|
76
88
|
|
77
|
-
pass
|
89
|
+
pass `--namespace=` as an option to denote a namespace to apply to the Rails path helpers
|
78
90
|
|
79
91
|
|
80
|
-
`rails generate hot_glue:scaffold Thing namespace=dashboard`
|
92
|
+
`rails generate hot_glue:scaffold Thing --namespace=dashboard`
|
81
93
|
|
82
94
|
This produces several views at `app/views/dashboard/things/` and a controller at`app/controllers/dashboard/things_controller.rb`
|
83
95
|
|
@@ -96,12 +108,12 @@ end
|
|
96
108
|
```
|
97
109
|
|
98
110
|
|
99
|
-
###
|
111
|
+
### `--nest=`
|
100
112
|
|
101
|
-
pass
|
113
|
+
pass `--nest=` to denote a nested resources
|
102
114
|
|
103
115
|
|
104
|
-
`rails generate hot_glue:scaffold Line nest=invoice`
|
116
|
+
`rails generate hot_glue:scaffold Line --nest=invoice`
|
105
117
|
|
106
118
|
In this example, it is presumed that the current user has_many :invoices, and that invoices have many :lines
|
107
119
|
|
@@ -120,7 +132,7 @@ In this example, it is presumed that the current user has_many :invoices, and th
|
|
120
132
|
|
121
133
|
|
122
134
|
To generate scaffold:
|
123
|
-
`rails generate hot_glue:scaffold Charge nest=invoice/line`
|
135
|
+
`rails generate hot_glue:scaffold Charge --nest=invoice/line`
|
124
136
|
|
125
137
|
The order of the nest should match the nested resources you have in your own app. In particular, you auth root will be used as the starting point when loading the objects from the URL:
|
126
138
|
|
@@ -143,7 +155,7 @@ It works, but it isn't granular. As well, it isn't appropriate for a large app w
|
|
143
155
|
Your customers can delete their own objects by default (may be a good idea or a bad idea for you). If you don't want that, you should strip out the delete actions off the controllers.
|
144
156
|
|
145
157
|
|
146
|
-
###
|
158
|
+
### `--auth=`
|
147
159
|
|
148
160
|
By default, it will be assumed you have a `current_user` for your user authentication. This will be treated as the "authentication root" for the "poor man's auth" explained above.
|
149
161
|
|
@@ -157,7 +169,7 @@ If you use Devise, you probably already have a `current_user` method available i
|
|
157
169
|
|
158
170
|
If you use a different object other than "User" for authentication, override using the `auth` option.
|
159
171
|
|
160
|
-
`rails generate hot_glue:scaffold Thing auth=current_account`
|
172
|
+
`rails generate hot_glue:scaffold Thing --auth=current_account`
|
161
173
|
|
162
174
|
You will note that in this example it is presumed that the Account object will have an association for `things`
|
163
175
|
|
@@ -168,7 +180,7 @@ If you supply nesting (see below), your nest chain will automatically begin with
|
|
168
180
|
|
169
181
|
|
170
182
|
|
171
|
-
###
|
183
|
+
### `--auth_identifier=`
|
172
184
|
|
173
185
|
Your controller will call a method authenticate_ (AUTH IDENTIFIER) bang, like:
|
174
186
|
|
@@ -198,7 +210,7 @@ As well, the `after_sign_in_path_for(user)` here is a hook for Devise also that
|
|
198
210
|
The default (do not pass `auth_identifier=`) will match the `auth` (So if you use 'account' as the auth, `authenticate_account!` will get invoked from your generated controller; the default is always 'user', so you can leave both auth and auth_identifier off if you want 'user')
|
199
211
|
|
200
212
|
|
201
|
-
`rails generate hot_glue:scaffold Thing auth=current_account auth_identifier=login`
|
213
|
+
`rails generate hot_glue:scaffold Thing --auth=current_account --auth_identifier=login`
|
202
214
|
In this example, the controller produced with:
|
203
215
|
```
|
204
216
|
before_action :authenticate_login!
|
@@ -209,25 +221,55 @@ However, the object graph anchors would continue to start from current_account.
|
|
209
221
|
```
|
210
222
|
|
211
223
|
Use empty string to **turn this method off**:
|
212
|
-
`rails generate hot_glue:scaffold Thing auth=current_account auth_identifier=''`
|
224
|
+
`rails generate hot_glue:scaffold Thing --auth=current_account --auth_identifier=''`
|
213
225
|
|
214
226
|
In this case a controller would be generated that would have NO before_action to authenticate the account, but it would still treat the current_account as the auth root for the purpose of loading the objects.
|
215
227
|
|
216
228
|
Please note that this example would product non-functional code, so you would need to manually fix your controllers to make sure `current_account` is available to the controller.
|
217
229
|
|
218
230
|
|
219
|
-
###
|
231
|
+
### `--plural=`
|
232
|
+
|
233
|
+
You don't need this if the pluralized version is just + "s" of the singular version. Only use for non-standard plurlizations, and be sure to pass it as TitleCase (as if you pluralized the model name which is non-standard for Rails)
|
234
|
+
|
235
|
+
|
236
|
+
### `--exclude=`
|
237
|
+
(separate field names by COMMA)
|
238
|
+
|
239
|
+
By default, all fields are included unless they are on the exclude list. (The default for the exclude list is `id`, `created_at`, and `updated_at` so you don't need to exclude those-- they are added.)
|
240
|
+
|
241
|
+
If you specify an exclude list, those and the default excluded list will be excluded.
|
242
|
+
|
243
|
+
|
244
|
+
`rails generate hot_glue:scaffold Account --exclude=password`
|
220
245
|
|
221
|
-
|
246
|
+
(The default excluded list is: :id, :created_at, :updated_at, :encrypted_password, :reset_password_token, :reset_password_sent_at, :remember_created_at, :confirmation_token, :confirmed_at, :confirmation_sent_at, :unconfirmed_email. If you want to edit any fields with the same name, you must use the include flag instead.)
|
222
247
|
|
223
248
|
|
224
|
-
### `--
|
249
|
+
### `--include=`
|
250
|
+
(separate field names by COMMA)
|
225
251
|
|
226
|
-
|
252
|
+
You may not specify both include and exclude. If you specify an include list, it will be treated as a whitelist: no fields will be included unless specified on the include list.
|
227
253
|
|
228
|
-
|
254
|
+
`rails generate hot_glue:scaffold Account --include=first_name,last_name,company_name,created_at,kyc_verified_at`
|
229
255
|
|
230
|
-
|
256
|
+
|
257
|
+
### `--show-only=`
|
258
|
+
(separate field names by COMMA)
|
259
|
+
|
260
|
+
Any fields only the 'show-only' list will appear as non-editable on the generate form. (visible only)
|
261
|
+
|
262
|
+
IMPORTANT: By default, all fields that begin with an underscore (`_`) are automatically show-only.
|
263
|
+
|
264
|
+
I would recommend this for fields you want globally non-editable by users in your app. For example, a counter cache or other field set only by a backend mechanism.
|
265
|
+
|
266
|
+
### `--god` or `--gd`
|
267
|
+
|
268
|
+
Use this flag to create controllers with no root authentication. You can still use an auth_identifier, which can be useful for a meta-leval authentication to the controller.
|
269
|
+
|
270
|
+
For example, FOR ADMIN CONTROLLERS ONLY, supply a auth_identifier and use `--god` flag.
|
271
|
+
|
272
|
+
In Gd mode, the objects are loaded directly from the base class (these controllers have full access)
|
231
273
|
```
|
232
274
|
def load_thing
|
233
275
|
@thing = Thing.find(params[:id])
|
@@ -235,7 +277,8 @@ end
|
|
235
277
|
|
236
278
|
```
|
237
279
|
|
238
|
-
|
280
|
+
## FLAGS (Options with no values)
|
281
|
+
These options (flags) also uses `--` syntax but do not take any values. Everything is assumed (default) to be false unless specified.
|
239
282
|
|
240
283
|
### `--specs-only`
|
241
284
|
|
@@ -247,7 +290,43 @@ Produces ONLY the controller spec file, nothing else.
|
|
247
290
|
Produces all the files except the spec file.
|
248
291
|
|
249
292
|
|
293
|
+
### `--no-paginate`
|
294
|
+
|
295
|
+
Omits pagination. (All list views have pagination by default.)
|
296
|
+
|
297
|
+
|
298
|
+
### `--no-create`
|
299
|
+
|
300
|
+
Omits create action.
|
301
|
+
|
302
|
+
### `--no-delete`
|
303
|
+
|
304
|
+
Omits delete action.
|
305
|
+
|
306
|
+
### `--big-edit`
|
307
|
+
|
308
|
+
If you do not want inline editing of your list items but instead to fall back to old fashioned new page behavior for your edit views, use `--big-edit`.
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
250
314
|
# VERSION HISTORY
|
315
|
+
|
316
|
+
#### 2021-03-21 - v0.0.8 - show only flag; more specific spec coverage in generator spec
|
317
|
+
|
318
|
+
#### 2021-03-20 - v0.0.7 - adds lots of spec coverage; cleans up generated cruft code on each run; adds no-delete, no-create; a working --big-edit with basic data-turbo false to disable inline editing
|
319
|
+
|
320
|
+
#### 2021-03-06 - v0.0.6 - internal specs test the error catches and cover basic code generation (dummy testing only)
|
321
|
+
|
322
|
+
#### 2021-03-01 - v0.0.5 - Validation magic; refactors the options to the correct Rails::Generators syntax
|
323
|
+
|
324
|
+
#### (yanked) - v0.0.4
|
325
|
+
|
326
|
+
#### 2021-02-27 - v0.0.3 - several fixes for namespaces; adds pagination; adds exclude list to fields
|
327
|
+
|
328
|
+
#### 2021-02-25 - v0.0.2 - bootstrapy
|
329
|
+
|
251
330
|
#### 2021-02-24 - v0.0.1 - first proof of concept release -- basic CRUD works
|
252
331
|
|
253
332
|
#### 2021-02-23 - v0.0.0 - Port of my prior work from github.com/jasonfb/common_core_js
|
@@ -260,3 +339,34 @@ Produces all the files except the spec file.
|
|
260
339
|
I hope one day I will leave this Earth a poor man (like my code) owning only the most simple structure for the simple form of my existence. Thanks for having educated me in this wisdom goes to my former mentor [@trak3r](https://github.com/trak3r)!
|
261
340
|
|
262
341
|
|
342
|
+
|
343
|
+
|
344
|
+
# HOW THIS GEM IS TESTED
|
345
|
+
|
346
|
+
The testing of functionality-within-functionality is a little tricky and requires thinking outside the box.
|
347
|
+
|
348
|
+
We have two kinds of "sandboxes": a DUMMY sandbox, and also a STRAWMAN sandbox
|
349
|
+
|
350
|
+
The dummy sandbox is found at `spec/dummy`
|
351
|
+
|
352
|
+
The dummy lives as mostly checked- into the repository, except the folders where the generated code goes (`spec/dummy/app/views/`, `spec/dummy/app/controllers/`, `spec/dummy/specs/` are excluded from Git)
|
353
|
+
|
354
|
+
When you run the **internal specs**, which you can do **at the root of this repo** using the command `rspec`, a set of specs will run to assert the generators are erroring when they are supposed to and producing code when they are supposed to.
|
355
|
+
|
356
|
+
|
357
|
+
The DUMMY testing DOES NOT test the actual functionality of the output code (it just tests the functionality of the generation process).
|
358
|
+
|
359
|
+
For this reason, I've also added something I call STRAWMAN testing, which is a set of steps that does these things:
|
360
|
+
|
361
|
+
The Strawman isn't in the repository, but if you build it locally, it will create itself into
|
362
|
+
|
363
|
+
`spec/strawman/`
|
364
|
+
|
365
|
+
1) Builds you a strawman sandbox app from scratch, using the native `rails new`
|
366
|
+
2) Makes a few small modifications to the new app to support this gem
|
367
|
+
3) Create two nonsense tables called OmnitableA and OmnitableB. Each omnitable has one of each kind of field (integer, text, string, date, time, etc)
|
368
|
+
4) In this way, it is a "Noah's Arc" testing strategy: It will build you a fully functional app using all of the feature sets of the gem.
|
369
|
+
5) The built app itself will contain its own specs
|
370
|
+
6) You will then cd into `spec/strawman` and run `rspec`. This second test suite now runs to full test all of the *generated* code.
|
371
|
+
|
372
|
+
|