hot-glue 0.4.3 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +71 -0
- data/.gitignore +2 -1
- data/Gemfile +4 -1
- data/Gemfile.lock +7 -17
- data/{LICENCE → LICENSE} +10 -6
- data/README.md +79 -41
- data/config/database.yml +8 -83
- data/db/schema.rb +1 -0
- data/lib/generators/hot_glue/install_generator.rb +7 -6
- data/lib/generators/hot_glue/layout/builder.rb +11 -9
- data/lib/generators/hot_glue/markup_templates/erb.rb +33 -22
- data/lib/generators/hot_glue/scaffold_generator.rb +99 -52
- data/lib/generators/hot_glue/templates/controller.rb.erb +39 -33
- data/lib/generators/hot_glue/templates/erb/_form.erb +3 -2
- data/lib/generators/hot_glue/templates/erb/_list.erb +22 -19
- data/lib/generators/hot_glue/templates/erb/_new_form.erb +2 -1
- data/lib/generators/hot_glue/templates/erb/_show.erb +3 -3
- data/lib/generators/hot_glue/templates/erb/new.erb +1 -1
- data/lib/hotglue/version.rb +1 -1
- metadata +6 -29
- data/db/schema.rb +0 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea7829bc862ee2a0a10b70bc624c31f2f20391731932857423483d27f068a173
|
4
|
+
data.tar.gz: 22f9c32718db75de7d4bd84a5486218b2a75823dba7a2b191bb211cdf5b7770f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d98362fe10be3c546ea9aa253a3141ca936e53adc05028c899667e46601fc8278d818865e503941fcd3d045d300325b083c75cbd507ef70389e904766cc3f46
|
7
|
+
data.tar.gz: 8378310ecb1563d2c7601954d5e0c1bb9494ed49c88ebbe3bc50a15536b19f8dcc5232457e15bdc7ddb27229cf0c87dc4db25fd36861eeeddf0e6ca920c09634
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# Use the latest 2.1 version of CircleCI pipeline process engine.
|
2
|
+
# See: https://circleci.com/docs/2.0/configuration-reference
|
3
|
+
version: 2.1
|
4
|
+
|
5
|
+
# Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects.
|
6
|
+
# See: https://circleci.com/docs/2.0/orb-intro/
|
7
|
+
orbs:
|
8
|
+
ruby: circleci/ruby@1.4.0
|
9
|
+
|
10
|
+
# Define a job to be invoked later in a workflow.
|
11
|
+
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
|
12
|
+
jobs:
|
13
|
+
build:
|
14
|
+
docker:
|
15
|
+
- image: cimg/ruby:2.7.5-browsers
|
16
|
+
executor: ruby/default
|
17
|
+
steps:
|
18
|
+
- checkout
|
19
|
+
- ruby/install-deps # use the ruby orb to install dependencies
|
20
|
+
|
21
|
+
- run:
|
22
|
+
name: Which bundler?
|
23
|
+
command: bundle -v
|
24
|
+
test: # our next job, called "test"
|
25
|
+
parallelism: 1
|
26
|
+
# here we set TWO docker images.
|
27
|
+
docker:
|
28
|
+
|
29
|
+
- image: cimg/ruby:2.7.5-browsers # this is our primary docker image, where step commands run.
|
30
|
+
auth:
|
31
|
+
username: mydockerhub-user
|
32
|
+
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
|
33
|
+
- image: redis:6.2.6
|
34
|
+
- image: circleci/postgres:9.5-alpine
|
35
|
+
auth:
|
36
|
+
username: mydockerhub-user
|
37
|
+
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
|
38
|
+
environment: # add POSTGRES environment variables.
|
39
|
+
POSTGRES_USER: circleci-demo-ruby
|
40
|
+
POSTGRES_DB: hot-glue-test
|
41
|
+
POSTGRES_PASSWORD: ""
|
42
|
+
# environment variables specific to Ruby/Rails, applied to the primary container.
|
43
|
+
environment:
|
44
|
+
BUNDLE_JOBS: "3"
|
45
|
+
BUNDLE_RETRY: "3"
|
46
|
+
PGHOST: 127.0.0.1
|
47
|
+
PGUSER: circleci-demo-ruby
|
48
|
+
PGPASSWORD: ""
|
49
|
+
RAILS_ENV: test
|
50
|
+
# A series of steps to run, some are similar to those in "build".
|
51
|
+
steps:
|
52
|
+
- checkout
|
53
|
+
- ruby/install-deps
|
54
|
+
# Here we make sure that the secondary container boots
|
55
|
+
# up before we run operations on the database.
|
56
|
+
- run:
|
57
|
+
name: Wait for DB
|
58
|
+
command: dockerize -wait tcp://localhost:5432 -timeout 1m
|
59
|
+
# Run rspec in parallel
|
60
|
+
- ruby/rspec-test
|
61
|
+
|
62
|
+
# We use workflows to orchestrate the jobs that we declared above.
|
63
|
+
workflows:
|
64
|
+
version: 2
|
65
|
+
build_and_test: # The name of our workflow is "build_and_test"
|
66
|
+
jobs: # The list of jobs we run as part of this workflow.
|
67
|
+
- build # Run build first.
|
68
|
+
- test: # Then run test,
|
69
|
+
requires: # Test requires that build passes for it to run.
|
70
|
+
- build # Finally, run the build job.
|
71
|
+
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# THESE GEMS ARE NOT PART OF YOUR RAILS APP!!!
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
3
5
|
|
4
6
|
gemspec
|
5
7
|
|
6
8
|
# not required for your app
|
7
|
-
gem '
|
9
|
+
gem 'sqlite3'
|
8
10
|
gem 'byebug'
|
9
11
|
gem 'rails'
|
10
12
|
gem 'devise', require: true
|
@@ -13,4 +15,5 @@ gem 'devise', require: true
|
|
13
15
|
gem "rails-controller-testing", group: [:test]
|
14
16
|
gem "database_cleaner", group: [:test]
|
15
17
|
gem "rspec-rails", group: [:test]
|
18
|
+
gem "rspec_junit_formatter", group: [:test]
|
16
19
|
gem "factory_bot", group: [:test]
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hot-glue (0.4.
|
4
|
+
hot-glue (0.4.6)
|
5
5
|
ffaker (~> 2.16)
|
6
6
|
kaminari (~> 1.2)
|
7
|
-
rails (> 5.1
|
8
|
-
sass-rails
|
7
|
+
rails (> 5.1)
|
9
8
|
|
10
9
|
GEM
|
11
10
|
remote: https://rubygems.org/
|
@@ -91,7 +90,6 @@ GEM
|
|
91
90
|
factory_bot (6.2.0)
|
92
91
|
activesupport (>= 5.0.0)
|
93
92
|
ffaker (2.20.0)
|
94
|
-
ffi (1.15.4)
|
95
93
|
globalid (0.4.2)
|
96
94
|
activesupport (>= 4.2.0)
|
97
95
|
i18n (1.8.10)
|
@@ -127,7 +125,6 @@ GEM
|
|
127
125
|
mini_portile2 (~> 2.5.0)
|
128
126
|
racc (~> 1.4)
|
129
127
|
orm_adapter (0.5.0)
|
130
|
-
pg (1.2.3)
|
131
128
|
racc (1.5.2)
|
132
129
|
rack (2.2.3)
|
133
130
|
rack-test (1.1.0)
|
@@ -183,16 +180,8 @@ GEM
|
|
183
180
|
rspec-mocks (~> 3.10)
|
184
181
|
rspec-support (~> 3.10)
|
185
182
|
rspec-support (3.10.2)
|
186
|
-
|
187
|
-
|
188
|
-
sassc (2.4.0)
|
189
|
-
ffi (~> 1.9)
|
190
|
-
sassc-rails (2.1.2)
|
191
|
-
railties (>= 4.0.0)
|
192
|
-
sassc (>= 2.0)
|
193
|
-
sprockets (> 3.0)
|
194
|
-
sprockets-rails
|
195
|
-
tilt
|
183
|
+
rspec_junit_formatter (0.5.1)
|
184
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
196
185
|
sprockets (4.0.2)
|
197
186
|
concurrent-ruby (~> 1.0)
|
198
187
|
rack (> 1, < 3)
|
@@ -200,8 +189,8 @@ GEM
|
|
200
189
|
actionpack (>= 4.0)
|
201
190
|
activesupport (>= 4.0)
|
202
191
|
sprockets (>= 3.0.0)
|
192
|
+
sqlite3 (1.4.2)
|
203
193
|
thor (1.1.0)
|
204
|
-
tilt (2.0.10)
|
205
194
|
tzinfo (2.0.4)
|
206
195
|
concurrent-ruby (~> 1.0)
|
207
196
|
warden (1.2.9)
|
@@ -221,10 +210,11 @@ DEPENDENCIES
|
|
221
210
|
devise
|
222
211
|
factory_bot
|
223
212
|
hot-glue!
|
224
|
-
pg
|
225
213
|
rails
|
226
214
|
rails-controller-testing
|
227
215
|
rspec-rails
|
216
|
+
rspec_junit_formatter
|
217
|
+
sqlite3
|
228
218
|
|
229
219
|
BUNDLED WITH
|
230
220
|
2.1.4
|
data/{LICENCE → LICENSE}
RENAMED
@@ -1,3 +1,7 @@
|
|
1
|
+
© 2022 Jason Fleetwood-Boldt. All Rights Reserved
|
2
|
+
This software is 'fauxpen source,' which means you can think of it like 'free' as in speech but not 'free' as in beer....
|
3
|
+
|
4
|
+
It is definitely 'free' as in Britney.
|
1
5
|
|
2
6
|
FOR HOBBYISTS/STUDENTS/TEACHERS/INDIVIDUALS/NON-PROFITS:
|
3
7
|
|
@@ -7,14 +11,14 @@ Any users of this software agree to work to
|
|
7
11
|
1) dismantle systemic racism
|
8
12
|
2) seek justice for black, brown, transgender people, women, and
|
9
13
|
3) work towards LGBTQIAA+ representation and inclusion
|
10
|
-
|
11
|
-
FOR ALL OTHERS:
|
12
|
-
|
13
|
-
TO PURCHASE A LICENSE PLEASE VISIT
|
14
|
-
https://heliosdev.shop/hot-glue-license
|
15
|
-
|
16
14
|
Organizations using this software agree to center the narratives of black, brown, transgender, and non-advantaged people in the world.
|
17
15
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
18
16
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
19
17
|
|
18
|
+
Just sign the pledge at https://heliosdev.shop/hot-glue-license and your email will be granted lifetime usage access.
|
19
|
+
|
20
|
+
TO PURCHASE A COMMERCIAL USAGE LICENSE PLEASE VISIT
|
21
|
+
https://heliosdev.shop/hot-glue-license
|
20
22
|
|
23
|
+
OR JUST BUY THE TUTORIAL (all purchases come with lifetime license)
|
24
|
+
https://jfb.teachable.com/p/hot-glue-in-depth-tutorial
|
data/README.md
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
|
2
|
-
[![
|
3
|
-
|
2
|
+
[![Hot Glue](https://circleci.com/gh/jasonfb/hot-glue.svg?style=shield)](https://circleci.com/gh/jasonfb/hot-glue)
|
4
3
|
|
5
4
|
Hot Glue is a Rails scaffold builder for the Turbo era. It is an evolution of the admin-interface style scaffolding systems of the 2010s ([activeadmin](https://github.com/activeadmin/activeadmin), [rails_admin](https://github.com/sferik/rails_admin), and [active_scaffold](https://github.com/activescaffold/active_scaffold)).
|
6
5
|
|
@@ -79,11 +78,17 @@ _BOOTSTRAP IS NO LONGER NEEDED_, but I recommend it.
|
|
79
78
|
|
80
79
|
IF you are using `--layout=bootstrap` (step 3), you must install Bootstrap here.
|
81
80
|
|
82
|
-
|
81
|
+
Webpacker is no longer in Rails 7. Also, there is a new option for Rails 7 to build Bootstrap using `cssbundling-rails`
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
83
86
|
|
84
|
-
For
|
87
|
+
For the old method:
|
85
88
|
|
86
|
-
|
89
|
+
- https://github.com/twbs/bootstrap-rubygem
|
90
|
+
|
91
|
+
With the old method, install the gem using:
|
87
92
|
```
|
88
93
|
gem 'bootstrap', '~> 5.1.3'
|
89
94
|
```
|
@@ -243,7 +248,7 @@ https://github.com/FortAwesome/font-awesome-sass
|
|
243
248
|
|
244
249
|
Add to your Gemfile
|
245
250
|
|
246
|
-
As of
|
251
|
+
As of 2022-01-26 Devise for Rails 7 is still not released so you must use main branch, like so:
|
247
252
|
`gem 'devise', branch: 'main', git: 'https://github.com/heartcombo/devise.git'`
|
248
253
|
|
249
254
|
If on Rails 6 **or** Rails 7, you must do the steps in **Legacy Step #5** (below).
|
@@ -252,6 +257,7 @@ If on Rails 6 **or** Rails 7, you must do the steps in **Legacy Step #5** (below
|
|
252
257
|
|
253
258
|
To be clear: You CAN use Devise with Rails 7, but you must still do the Legacy Step #5 described below for your login to work.
|
254
259
|
|
260
|
+
You MUST run the installer FIRST or else you will put your app into a non-workable state:
|
255
261
|
```
|
256
262
|
rails generate devise:install
|
257
263
|
```
|
@@ -277,6 +283,18 @@ As described in Legacy Step #5, **you cannot** skip Devise installer Step 4, eve
|
|
277
283
|
Once you copy the files, you must modify the Devise views to disable Turbo as described in Legacy Step #5.
|
278
284
|
|
279
285
|
|
286
|
+
Be sure to create primary auth model with:
|
287
|
+
|
288
|
+
`rails generate devise User name:string`
|
289
|
+
|
290
|
+
Remember, you don't need to tell Devise that your User has an email, an encrypted password, a reset token, and a 'remember me' flag to let the user stay logged in.
|
291
|
+
|
292
|
+
Those features come by default with Devise, and you'll find the fields for them in the newly generated migration file.
|
293
|
+
|
294
|
+
In the example above, you are creating all of those fields along with a simple 'name' (string) field for your User table.
|
295
|
+
|
296
|
+
|
297
|
+
|
280
298
|
## LEGACY SETUP FOR RAILS 6
|
281
299
|
|
282
300
|
(Note Legacy Step #5 is necessary for BOTH Rails 6 and Rails 7.)
|
@@ -404,17 +422,27 @@ end
|
|
404
422
|
```
|
405
423
|
|
406
424
|
|
407
|
-
### `--
|
425
|
+
### `--nested=`
|
426
|
+
|
427
|
+
This object is nested within another tree of objects, and there is a nested route in your routes.rb file
|
428
|
+
|
429
|
+
resources :invoices do
|
430
|
+
resource :lines do
|
431
|
+
end
|
432
|
+
|
433
|
+
|
434
|
+
`rails generate hot_glue:scaffold Line --nested=invoice`
|
408
435
|
|
409
|
-
pass `--nest=` to denote a nested resources
|
410
436
|
|
437
|
+
Example #1: Invoice has many :lines and line belongs_to :invoice
|
411
438
|
|
412
|
-
`rails generate hot_glue:scaffold Line --nest=invoice`
|
413
439
|
|
414
|
-
|
440
|
+
For multi-level nesting use slashes to separate your levels of nesting.
|
415
441
|
|
442
|
+
`rails generate hot_glue:scaffold Charge --nested=invoice`
|
443
|
+
`rails generate hot_glue:scaffold Charge --nest=invoice/line`
|
416
444
|
|
417
|
-
|
445
|
+
Remember, you should match what you have in your routes.rb file.
|
418
446
|
|
419
447
|
```
|
420
448
|
resources :invoices do
|
@@ -424,13 +452,10 @@ resources :invoices do
|
|
424
452
|
end
|
425
453
|
|
426
454
|
```
|
427
|
-
In this example, it is presumed that the current user has_many :invoices, and that invoices have many :lines, and that lines have many :charges
|
428
455
|
|
456
|
+
For non-Gd controllers, your auth root will be used as the starting point when loading the objects from the URL if this object is nested.
|
429
457
|
|
430
|
-
|
431
|
-
`rails generate hot_glue:scaffold Charge --nest=invoice/line`
|
432
|
-
|
433
|
-
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:
|
458
|
+
(For Gd controllers the root object will be loaded directly from the ActiveRecord object.)
|
434
459
|
|
435
460
|
In the example above, @invoice will be loaded from
|
436
461
|
|
@@ -444,11 +469,14 @@ Then, finally the @charge will be loaded
|
|
444
469
|
|
445
470
|
`@charge = @line.charges.find(params[:id])`
|
446
471
|
|
447
|
-
|
472
|
+
This is "starfish access control" or "poor man's access control." It works when the current user has several things they can manage, and by extension can manage children of those things.
|
473
|
+
|
448
474
|
|
449
|
-
|
475
|
+
## Optional Nesting
|
450
476
|
|
451
|
-
|
477
|
+
**God controllers only ** have a special build feature where they can be specified to be optionally nested.
|
478
|
+
|
479
|
+
When build as optionally nested,
|
452
480
|
|
453
481
|
|
454
482
|
### `--auth=`
|
@@ -576,30 +604,30 @@ IMPORTANT: By default, all fields that begin with an underscore (`_`) are automa
|
|
576
604
|
|
577
605
|
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.
|
578
606
|
|
579
|
-
### `--
|
580
|
-
(for Rails <=6, default is false. For Rails 7, default is true.)
|
607
|
+
### `--ujs_syntax=true` (Default is set automatically based on whether you have turbo-rails installed)
|
581
608
|
|
582
|
-
|
609
|
+
If you are pre-Turbo (UJS), your delete buttons will come out like this:
|
610
|
+
`data: {'confirm': 'Are you sure you want to delete....?'}`
|
583
611
|
|
584
|
-
If you
|
612
|
+
If you are Turbo (Rails 7 or Rails 6 with proactive Turbo-Rails install), your delete button will be:
|
613
|
+
`data: {'turbo-confirm': 'Are you sure you want to delete....?'}`
|
585
614
|
|
586
|
-
|
587
|
-
{confirm: 'Are you sure?'}
|
588
|
-
```
|
615
|
+
If you specify the flag, you preference will be used. If you leave the flag off, Hot Glue will detect the presence of Turbo-Rails in your app.
|
589
616
|
|
590
|
-
If you
|
591
|
-
|
592
|
-
## TODO: fix this
|
593
|
-
```
|
617
|
+
**WARNING**: If you created a new Rails app since October 2021 and you have the yanked turbo-rails Gems on your local machine,
|
618
|
+
you will have some bugs with the delete buttons and also not be on the latest version of turbo-rails.
|
594
619
|
|
620
|
+
Make sure to uninstall the yanked 7.1.0 and 7.1.1 from your machine with `gem uninstall turbo-rails`
|
621
|
+
and also fix any Rails apps created since October 2021 by fixing the Gemfile. Details here:
|
622
|
+
https://stackoverflow.com/questions/70671324/new-rails-7-turbo-app-doesnt-show-the-data-turbo-confirm-alert-messages-dont-f
|
595
623
|
|
596
624
|
|
597
|
-
### `--magic-buttons`
|
625
|
+
### `--magic-buttons`
|
598
626
|
If you pass a list of magic buttons (separated by commas), they will appear in the button area on your list.
|
599
627
|
|
600
|
-
It will be assumed there will be
|
628
|
+
It will be assumed there will be corresponding bang methods on your models.
|
601
629
|
|
602
|
-
The
|
630
|
+
The bang (`!`) methods can respond in one of four ways:
|
603
631
|
|
604
632
|
• With true, in which case a generic success message will be shown in the flash notice (“Approved” or “Rejected” in this case)
|
605
633
|
|
@@ -661,6 +689,11 @@ Omits pagination. (All list views have pagination by default.)
|
|
661
689
|
|
662
690
|
Omits list action. Only makes sense to use this if you are create a view where you only want the create button you want to navigate to the update screen alternative ways.
|
663
691
|
|
692
|
+
|
693
|
+
### `--no-list-labels`
|
694
|
+
|
695
|
+
Omits list labels. (note that in the form the labels are rendered again anyway)
|
696
|
+
|
664
697
|
### `--no-create`
|
665
698
|
|
666
699
|
Omits create action.
|
@@ -711,8 +744,13 @@ Obviously, the created controller will always have this base controller as its s
|
|
711
744
|
|
712
745
|
# VERSION HISTORY
|
713
746
|
|
747
|
+
#### 2022-01-25 - v0.4.7 -
|
748
|
+
|
749
|
+
#### 2022-01-11 - v0.4.5 - buttons on smarty layouts take up 1 bootstrap column each; fixes confirmation alert for delete buttons
|
714
750
|
|
715
|
-
#### 2022-
|
751
|
+
#### 2022-01-01 - v0.4.3 and 0.4.4 - adding fully email based license; no activation codes required
|
752
|
+
|
753
|
+
#### 2022-12-30 - v0.4.2 -- Smart layouts introduced
|
716
754
|
|
717
755
|
#### 2021-12-15 - v0.4.1
|
718
756
|
|
@@ -720,7 +758,6 @@ Obviously, the created controller will always have this base controller as its s
|
|
720
758
|
|
721
759
|
#### 2021-12-12 - v0.3.9 - Magic Buttons
|
722
760
|
|
723
|
-
|
724
761
|
#### 2021-12-11 - v0.3.5 - Downnesting
|
725
762
|
|
726
763
|
|
@@ -786,9 +823,9 @@ SETUP:
|
|
786
823
|
• if you can't get through see https://stackoverflow.com/questions/68050807/gem-install-mimemagic-v-0-3-10-fails-to-install-on-big-sur/68170982#68170982
|
787
824
|
|
788
825
|
|
789
|
-
The dummy sandbox is found at `spec/
|
826
|
+
The dummy sandbox is found at `spec/Dummy`
|
790
827
|
|
791
|
-
The dummy sandbox lives as mostly checked- into the repository, **except** the folders where the generated code goes (`spec/
|
828
|
+
The dummy sandbox 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)
|
792
829
|
|
793
830
|
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.
|
794
831
|
|
@@ -797,15 +834,16 @@ The DUMMY testing DOES NOT test the actual functionality of the output code (it
|
|
797
834
|
|
798
835
|
# DATABASE
|
799
836
|
|
800
|
-
`cd spec/
|
837
|
+
`cd spec/Dummy`
|
801
838
|
`rails db:drop`
|
802
839
|
`rails db:create`
|
803
840
|
`rails db:migrate`
|
804
841
|
`RAILS_ENV=test rails db:migrate`
|
805
842
|
|
806
|
-
`cd ../..`
|
807
843
|
|
808
|
-
|
809
|
-
|
844
|
+
being able to run `rake spec` at the root of this repo is acheived using
|
845
|
+
```
|
846
|
+
ln -s spec/dummy/db/schema.rb db/schema.rb
|
847
|
+
```
|
810
848
|
|
811
849
|
|
data/config/database.yml
CHANGED
@@ -1,86 +1,11 @@
|
|
1
|
-
# PostgreSQL. Versions 9.3 and up are supported.
|
2
|
-
#
|
3
|
-
# Install the pg driver:
|
4
|
-
# gem install pg
|
5
|
-
# On macOS with Homebrew:
|
6
|
-
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
|
7
|
-
# On macOS with MacPorts:
|
8
|
-
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
|
9
|
-
# On Windows:
|
10
|
-
# gem install pg
|
11
|
-
# Choose the win32 build.
|
12
|
-
# Install PostgreSQL and put its /bin directory on your path.
|
13
|
-
#
|
14
|
-
# Configure Using Gemfile
|
15
|
-
# gem 'pg'
|
16
|
-
#
|
17
|
-
default: &default
|
18
|
-
adapter: postgresql
|
19
|
-
encoding: unicode
|
20
|
-
# For details on connection pooling, see Rails configuration guide
|
21
|
-
# https://guides.rubyonrails.org/configuring.html#database-pooling
|
22
|
-
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
23
|
-
|
24
1
|
development:
|
25
|
-
|
26
|
-
database:
|
27
|
-
|
28
|
-
|
29
|
-
# To create additional roles in postgres see `$ createuser --help`.
|
30
|
-
# When left blank, postgres will use the default role. This is
|
31
|
-
# the same name as the operating system user running Rails.
|
32
|
-
#username: Dummy
|
33
|
-
|
34
|
-
# The password associated with the postgres role (username).
|
35
|
-
#password:
|
36
|
-
|
37
|
-
# Connect on a TCP socket. Omitted by default since the client uses a
|
38
|
-
# domain socket that doesn't need configuration. Windows does not have
|
39
|
-
# domain sockets, so uncomment these lines.
|
40
|
-
#host: localhost
|
2
|
+
adapter: sqlite3
|
3
|
+
database: ../spec/dummy/db/development.sqlite3
|
4
|
+
pool: 5
|
5
|
+
timeout: 5000
|
41
6
|
|
42
|
-
# The TCP port the server listens on. Defaults to 5432.
|
43
|
-
# If your server runs on a different port number, change accordingly.
|
44
|
-
#port: 5432
|
45
|
-
|
46
|
-
# Schema search path. The server defaults to $user,public
|
47
|
-
#schema_search_path: myapp,sharedapp,public
|
48
|
-
|
49
|
-
# Minimum log levels, in increasing order:
|
50
|
-
# debug5, debug4, debug3, debug2, debug1,
|
51
|
-
# log, notice, warning, error, fatal, and panic
|
52
|
-
# Defaults to warning.
|
53
|
-
#min_messages: notice
|
54
|
-
|
55
|
-
# Warning: The database defined as "test" will be erased and
|
56
|
-
# re-generated from your development database when you run "rake".
|
57
|
-
# Do not set this db to the same as development or production.
|
58
7
|
test:
|
59
|
-
|
60
|
-
database:
|
61
|
-
|
62
|
-
|
63
|
-
# like your database password, in your source code. If your source code is
|
64
|
-
# ever seen by anyone, they now have access to your database.
|
65
|
-
#
|
66
|
-
# Instead, provide the password or a full connection URL as an environment
|
67
|
-
# variable when you boot the app. For example:
|
68
|
-
#
|
69
|
-
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
|
70
|
-
#
|
71
|
-
# If the connection URL is provided in the special DATABASE_URL environment
|
72
|
-
# variable, Rails will automatically merge its configuration values on top of
|
73
|
-
# the values provided in this file. Alternatively, you can specify a connection
|
74
|
-
# URL environment variable explicitly:
|
75
|
-
#
|
76
|
-
# production:
|
77
|
-
# url: <%= ENV['MY_APP_DATABASE_URL'] %>
|
78
|
-
#
|
79
|
-
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
80
|
-
# for a full overview on how database connection configuration can be specified.
|
81
|
-
#
|
82
|
-
production:
|
83
|
-
<<: *default
|
84
|
-
database: Dummy_production
|
85
|
-
username: Dummy
|
86
|
-
password: <%= ENV['DUMMY_DATABASE_PASSWORD'] %>
|
8
|
+
adapter: sqlite3
|
9
|
+
database: ../spec/dummy/db/test.sqlite3
|
10
|
+
pool: 5
|
11
|
+
timeout: 5000
|
data/db/schema.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
db/spec/dummy/db/schema.rb
|
@@ -31,7 +31,7 @@ module HotGlue
|
|
31
31
|
|
32
32
|
|
33
33
|
print "Do you have a license key (y/N)? "
|
34
|
-
do_you_have_a_license = STDIN.gets.strip || "
|
34
|
+
do_you_have_a_license = STDIN.gets.strip || "N"
|
35
35
|
|
36
36
|
if do_you_have_a_license.downcase == "y"
|
37
37
|
print "Please enter the EMAIL you used to purchase a Hot Glue license, \nTeachable tutorial, or Helios Merch Shop product: "
|
@@ -43,7 +43,9 @@ module HotGlue
|
|
43
43
|
resp = JSON.parse(stream.read)
|
44
44
|
|
45
45
|
if resp['status'] == 'success'
|
46
|
-
|
46
|
+
if resp['redirect']
|
47
|
+
HotGlue::Helpers.open_page(resp['redirect'])
|
48
|
+
end
|
47
49
|
puts "\n" + " * " + resp['response'] + " * \n\n"
|
48
50
|
else
|
49
51
|
puts "\n" + " * " + resp['response'] + " * \n\n"
|
@@ -53,7 +55,6 @@ module HotGlue
|
|
53
55
|
print "https://jfb.teachable.com/p/hot-glue-in-depth-tutorial \n"
|
54
56
|
print "https://shop.heliosdev.shop/ \n"
|
55
57
|
print "All purchases come with a Hot Glue lifetime license for individuals and hobbyists\n"
|
56
|
-
|
57
58
|
return
|
58
59
|
end
|
59
60
|
else
|
@@ -67,12 +68,12 @@ module HotGlue
|
|
67
68
|
if choice == "1"
|
68
69
|
HotGlue::Helpers.open_page("https://heliosdev.shop/hot-glue-license?utm_campaing=hotglue-installer")
|
69
70
|
elsif choice == "2"
|
70
|
-
HotGlue::Helpers.open_page("https://jfb.teachable.com/p/hot-glue-in-depth-tutorial?
|
71
|
+
HotGlue::Helpers.open_page("https://jfb.teachable.com/p/hot-glue-in-depth-tutorial?utm_source=hotglue-installer")
|
71
72
|
print "All purchases come with a Hot Glue lifetime license for individuals and hobbyists\n"
|
72
73
|
|
73
74
|
else
|
74
|
-
HotGlue::Helpers.open_page("https://shop.heliosdev.shop/?
|
75
|
-
print "
|
75
|
+
HotGlue::Helpers.open_page("https://shop.heliosdev.shop/?utm_source=hotglue-installer")
|
76
|
+
print "ALSO check out the HOT GLUE TUTORIAL here: \n"
|
76
77
|
print "https://jfb.teachable.com/p/hot-glue-in-depth-tutorial \n"
|
77
78
|
print "All purchases come with a Hot Glue lifetime license for individuals and hobbyists\n"
|
78
79
|
end
|
@@ -3,13 +3,15 @@
|
|
3
3
|
module HotGlue
|
4
4
|
module Layout
|
5
5
|
class Builder
|
6
|
-
attr_reader :include_setting, :downnest_children, :
|
6
|
+
attr_reader :include_setting, :downnest_children, :buttons_width, :columns, :smart_layout
|
7
7
|
|
8
8
|
def initialize(params)
|
9
9
|
@include_setting = params[:include_setting]
|
10
10
|
@downnest_children = params[:downnest_children]
|
11
|
-
|
12
|
-
@
|
11
|
+
|
12
|
+
@buttons_width = params[:buttons_width]
|
13
|
+
|
14
|
+
@no_buttons = @buttons_width == 0
|
13
15
|
@columns = params[:columns]
|
14
16
|
@smart_layout = params[:smart_layout]
|
15
17
|
end
|
@@ -23,7 +25,7 @@ module HotGlue
|
|
23
25
|
portals: {
|
24
26
|
|
25
27
|
},
|
26
|
-
buttons: { size:
|
28
|
+
buttons: { size: @buttons_width}
|
27
29
|
}
|
28
30
|
|
29
31
|
downnest_children.each do |child|
|
@@ -32,9 +34,8 @@ module HotGlue
|
|
32
34
|
|
33
35
|
# smart layout: 2 columns per field; 4 column for EACH downnested portals, 2 column for buttons
|
34
36
|
how_many_downnest = downnest_children.size
|
35
|
-
button_column_size = (no_edit && no_delete) ? 0 : 2
|
36
37
|
|
37
|
-
bootstrap_columns = (12
|
38
|
+
bootstrap_columns = (12-@buttons_width )
|
38
39
|
bootstrap_columns = bootstrap_columns - (how_many_downnest*4)
|
39
40
|
available_columns = (bootstrap_columns / 2).floor # bascially turns the 12-column grid into a 6-column grid
|
40
41
|
|
@@ -55,7 +56,7 @@ module HotGlue
|
|
55
56
|
|
56
57
|
if columns.size > available_columns
|
57
58
|
each_col_can_have = (columns.size.to_f / available_columns.to_f).round
|
58
|
-
|
59
|
+
|
59
60
|
layout_object[:columns][:container] = (0..available_columns-1).collect { |x|
|
60
61
|
columns.slice(0+(x*each_col_can_have),each_col_can_have)
|
61
62
|
}
|
@@ -71,15 +72,16 @@ module HotGlue
|
|
71
72
|
layout_object[:columns][:container] = columns.collect{|col| [col]}
|
72
73
|
|
73
74
|
else
|
75
|
+
|
74
76
|
(0..available_columns-1).each do |int|
|
75
77
|
layout_object[:columns][:container][int] = []
|
76
78
|
end
|
77
79
|
|
78
80
|
# input control
|
79
|
-
user_layout_columns =
|
81
|
+
user_layout_columns = @include_setting .split(":")
|
80
82
|
|
81
83
|
if user_layout_columns.size > available_columns
|
82
|
-
raise "Your include statement #{
|
84
|
+
raise "Your include statement #{@include_setting } has #{user_layout_columns.size} columns, but I can only construct up to #{available_columns}"
|
83
85
|
end
|
84
86
|
user_layout_columns.each_with_index do |column,i|
|
85
87
|
layout_object[:columns][:container][i] = column.split(",")
|