hot-glue 0.4.1 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +2 -1
- data/Gemfile +4 -4
- data/Gemfile.lock +18 -18
- data/{LICENCE → LICENSE} +10 -6
- data/README.md +811 -0
- data/config/database.yml +83 -8
- data/config/hot_glue.yml +3 -0
- data/db/schema.rb +3 -3
- data/lib/generators/hot_glue/helpers.rb +13 -0
- data/lib/generators/hot_glue/install_generator.rb +47 -16
- data/lib/generators/hot_glue/layout/builder.rb +117 -0
- data/lib/generators/hot_glue/markup_templates/erb.rb +160 -181
- data/lib/generators/hot_glue/markup_templates/haml.rb +7 -2
- data/lib/generators/hot_glue/scaffold_generator.rb +119 -88
- data/lib/generators/hot_glue/templates/controller.rb.erb +1 -1
- data/lib/generators/hot_glue/templates/erb/_form.erb +1 -1
- data/lib/generators/hot_glue/templates/erb/_list.erb +9 -12
- data/lib/generators/hot_glue/templates/erb/_show.erb +10 -10
- data/lib/generators/hot_glue/templates/system_spec.rb.erb +37 -26
- data/lib/hotglue/version.rb +1 -1
- metadata +9 -36
- data/db/migrate/20210306212711_create_abcs.rb +0 -11
- data/db/migrate/20210306223300_create_defs.rb +0 -9
- data/db/migrate/20210306223305_create_ghis.rb +0 -9
- data/db/migrate/20210306223309_create_jkls.rb +0 -9
- data/db/migrate/20210306223701_devise_create_users.rb +0 -44
- data/db/migrate/20210306225506_create_xyzs.rb +0 -9
@@ -4,18 +4,18 @@ describe "interaction for <%= controller_class_name %>", type: :feature do
|
|
4
4
|
include HotGlue::ControllerHelper
|
5
5
|
<%= @existing_content %>
|
6
6
|
<% unless @god %>let(:<%= @auth %>) {create(:<%= @auth.gsub('current_', '') %>)}<%end%>
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
15
|
-
else
|
7
|
+
<%= (@columns - @show_only).map { |col|
|
8
|
+
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
9
|
+
case type
|
10
|
+
when :integer
|
11
|
+
if col.to_s.ends_with?("_id")
|
12
|
+
assoc = "#{col.to_s.gsub('_id','')}"
|
13
|
+
"let!(:#{assoc}1) {create(:#{assoc})}"
|
16
14
|
end
|
17
|
-
|
18
|
-
|
15
|
+
else
|
16
|
+
end
|
17
|
+
}.compact.join("\n")
|
18
|
+
%>
|
19
19
|
<% item1_addOns = ""
|
20
20
|
if (eval(@singular_class).instance_methods.include?(display_class.to_s))
|
21
21
|
item1_addOns << "#{display_class}: FFaker::Name.name"
|
@@ -32,7 +32,7 @@ describe "interaction for <%= controller_class_name %>", type: :feature do
|
|
32
32
|
when :float
|
33
33
|
"#{col}: rand(1)*10000"
|
34
34
|
when :boolean
|
35
|
-
"#{col}: !!rand(2).
|
35
|
+
"#{col}: !!rand(2).floor"
|
36
36
|
when :time
|
37
37
|
"#{col}: Time.current + rand(5000).seconds"
|
38
38
|
when :date
|
@@ -41,7 +41,7 @@ describe "interaction for <%= controller_class_name %>", type: :feature do
|
|
41
41
|
"#{col}: DateTime.current + rand(1000).seconds"
|
42
42
|
when :integer
|
43
43
|
if col.to_s.ends_with?("_id")
|
44
|
-
#
|
44
|
+
"#{col.to_s.gsub('_id','')}: #{col.to_s.gsub('_id','')}1"
|
45
45
|
else
|
46
46
|
"#{col}: rand(100)"
|
47
47
|
end
|
@@ -82,13 +82,20 @@ describe "interaction for <%= controller_class_name %>", type: :feature do
|
|
82
82
|
expect(page).to have_selector(:xpath, './/h3[contains(., "New <%= singular.titlecase %>")]')
|
83
83
|
|
84
84
|
<%=
|
85
|
-
@columns.map { |col|
|
85
|
+
(@columns - @show_only).map { |col|
|
86
86
|
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
87
87
|
case type
|
88
|
-
when :
|
88
|
+
when :date
|
89
|
+
" " + "new_#{col} = Date.current + (rand(100).days) \n" +
|
90
|
+
' ' + "find(\"[name='#{singular}[#{ col.to_s }]']\").fill_in(with: new_#{col.to_s})"
|
91
|
+
when :time
|
89
92
|
# " " + "new_#{col} = DateTime.current + (rand(100).days) \n" +
|
90
93
|
# ' ' + "find(\"[name='#{singular}[#{ col.to_s }]']\").fill_in(with: new_#{col.to_s})"
|
91
94
|
|
95
|
+
when :datetime
|
96
|
+
" " + "new_#{col} = DateTime.current + (rand(100).days) \n" +
|
97
|
+
' ' + "find(\"[name='#{singular}[#{ col.to_s }]']\").fill_in(with: new_#{col.to_s})"
|
98
|
+
|
92
99
|
when :integer
|
93
100
|
|
94
101
|
if col.to_s.ends_with?("_id")
|
@@ -118,6 +125,9 @@ describe "interaction for <%= controller_class_name %>", type: :feature do
|
|
118
125
|
" " + "new_#{col} = 'new_test-email@nowhere.com' \n" +
|
119
126
|
" find(\"[name='#{singular}[#{ col.to_s }]']\").fill_in(with: new_#{col.to_s})"
|
120
127
|
end
|
128
|
+
when :text
|
129
|
+
" " + "new_#{col} = FFaker::Lorem.paragraphs(1).join("") \n" +
|
130
|
+
" find(\"[name='#{singular}[#{ col.to_s }]']\").fill_in(with: new_#{col.to_s})"
|
121
131
|
end
|
122
132
|
|
123
133
|
}.join("\n")
|
@@ -125,8 +135,9 @@ describe "interaction for <%= controller_class_name %>", type: :feature do
|
|
125
135
|
%>
|
126
136
|
click_button "Save"
|
127
137
|
expect(page).to have_content("Successfully created")
|
128
|
-
<%=
|
129
|
-
|
138
|
+
<%=" " +
|
139
|
+
|
140
|
+
(@columns - @show_only).map { |col|
|
130
141
|
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
131
142
|
|
132
143
|
case type
|
@@ -147,7 +158,6 @@ describe "interaction for <%= controller_class_name %>", type: :feature do
|
|
147
158
|
|
148
159
|
}.compact.join("\n ")
|
149
160
|
%>
|
150
|
-
|
151
161
|
end
|
152
162
|
end<% end %>
|
153
163
|
|
@@ -157,9 +167,9 @@ describe "interaction for <%= controller_class_name %>", type: :feature do
|
|
157
167
|
visit <%= path_helper_plural %>
|
158
168
|
find("a.edit-<%= singular %>-button[href='/<%= namespace_with_slash %><%= plural %>/#{<%= singular %>1.id}/edit']").click
|
159
169
|
|
160
|
-
expect(page).to have_content("Editing #{<%= singular %>1.<%= @display_class
|
170
|
+
expect(page).to have_content("Editing #{<%= singular %>1.<%= @display_class %>.squish || "(no name)"}")
|
161
171
|
<%=
|
162
|
-
@columns.map { |col|
|
172
|
+
(@columns - @show_only).map { |col|
|
163
173
|
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
164
174
|
limit = eval("#{singular_class}.columns_hash['#{col}']").limit
|
165
175
|
sql_type = eval("#{singular_class}.columns_hash['#{col}']").sql_type
|
@@ -201,11 +211,15 @@ describe "interaction for <%= controller_class_name %>", type: :feature do
|
|
201
211
|
" new_#{col} = rand(1)*5000 \n" +
|
202
212
|
" find(\"[name='#{singular}[#{col}]']\").fill_in(with: new_#{col.to_s })"
|
203
213
|
when :date
|
204
|
-
"
|
205
|
-
"
|
214
|
+
" new_#{col} = Date.current + rand(100).days \n" +
|
215
|
+
" find(\"[name='#{singular}[#{col}]']\").fill_in(with: new_#{col.to_s })"
|
206
216
|
when :time
|
207
217
|
" new_#{col} = Time.current + rand(144).hours \n" +
|
208
218
|
" find(\"[name='#{singular}[#{col}]']\").fill_in(with: new_#{col.to_s })"
|
219
|
+
when :datetime
|
220
|
+
" new_#{col} = DateTime.current + rand(1000).minutes \n" +
|
221
|
+
" find(\"[name='#{singular}[#{col}]']\").fill_in(with: new_#{col.to_s })"
|
222
|
+
|
209
223
|
when :enum
|
210
224
|
" list_of_#{col.to_s} = #{singular_class}.defined_enums['#{col.to_s}'].keys \n" +
|
211
225
|
" " + "new_#{col.to_s} = list_of_#{col.to_s}[rand(list_of_#{col.to_s}.length)].to_s \n" +
|
@@ -221,7 +235,7 @@ describe "interaction for <%= controller_class_name %>", type: :feature do
|
|
221
235
|
click_button "Save"
|
222
236
|
within("turbo-frame#<%= singular %>__#{<%= singular %>1.id} ") do
|
223
237
|
<%=
|
224
|
-
@columns.map { |col|
|
238
|
+
(@columns - @show_only).map { |col|
|
225
239
|
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
226
240
|
case type
|
227
241
|
when :datetime
|
@@ -239,7 +253,6 @@ describe "interaction for <%= controller_class_name %>", type: :feature do
|
|
239
253
|
end
|
240
254
|
}.compact.join("\n")
|
241
255
|
%>
|
242
|
-
|
243
256
|
end
|
244
257
|
end
|
245
258
|
end <% end %>
|
@@ -250,8 +263,6 @@ describe "interaction for <%= controller_class_name %>", type: :feature do
|
|
250
263
|
accept_alert do
|
251
264
|
find("form[action='<%= namespace_with_dash %>/<%= plural %>/#{<%= singular %>1.id}'] > input.delete-<%= singular %>-button").click
|
252
265
|
end
|
253
|
-
# find("form[action='<%= namespace_with_dash %>/<%= plural %>/#{<%= singular %>1.id}'] > input.delete-<%= singular %>-button").click
|
254
|
-
|
255
266
|
expect(page).to_not have_content(<%= singular %>1.<%= @display_class %>)
|
256
267
|
expect(<%= singular_class %>.where(id: <%= singular %>1.id).count).to eq(0)
|
257
268
|
end
|
data/lib/hotglue/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hot-glue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Fleetwood-Boldt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -17,9 +17,6 @@ dependencies:
|
|
17
17
|
- - ">"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '5.1'
|
20
|
-
- - "<="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 7.0.0
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,9 +24,6 @@ dependencies:
|
|
27
24
|
- - ">"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '5.1'
|
30
|
-
- - "<="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 7.0.0
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: kaminari
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,20 +38,6 @@ dependencies:
|
|
44
38
|
- - "~>"
|
45
39
|
- !ruby/object:Gem::Version
|
46
40
|
version: '1.2'
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: turbo-rails
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - ">"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0.5'
|
54
|
-
type: :runtime
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - ">"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '0.5'
|
61
41
|
- !ruby/object:Gem::Dependency
|
62
42
|
name: sass-rails
|
63
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,7 +78,7 @@ files:
|
|
98
78
|
- ".travis.yml"
|
99
79
|
- Gemfile
|
100
80
|
- Gemfile.lock
|
101
|
-
-
|
81
|
+
- LICENSE
|
102
82
|
- README.md
|
103
83
|
- Rakefile
|
104
84
|
- app/assets/config/manifest.js
|
@@ -107,14 +87,11 @@ files:
|
|
107
87
|
- app/views/layouts/_flash_notices.erb
|
108
88
|
- bin/rails
|
109
89
|
- config/database.yml
|
110
|
-
-
|
111
|
-
- db/migrate/20210306223300_create_defs.rb
|
112
|
-
- db/migrate/20210306223305_create_ghis.rb
|
113
|
-
- db/migrate/20210306223309_create_jkls.rb
|
114
|
-
- db/migrate/20210306223701_devise_create_users.rb
|
115
|
-
- db/migrate/20210306225506_create_xyzs.rb
|
90
|
+
- config/hot_glue.yml
|
116
91
|
- db/schema.rb
|
92
|
+
- lib/generators/hot_glue/helpers.rb
|
117
93
|
- lib/generators/hot_glue/install_generator.rb
|
94
|
+
- lib/generators/hot_glue/layout/builder.rb
|
118
95
|
- lib/generators/hot_glue/markup_templates/base.rb
|
119
96
|
- lib/generators/hot_glue/markup_templates/erb.rb
|
120
97
|
- lib/generators/hot_glue/markup_templates/haml.rb
|
@@ -162,19 +139,15 @@ files:
|
|
162
139
|
- lib/hot-glue.rb
|
163
140
|
- lib/hotglue/engine.rb
|
164
141
|
- lib/hotglue/version.rb
|
165
|
-
homepage: https://
|
142
|
+
homepage: https://jfb.teachable.com/p/hot-glue-in-depth-tutorial?utm_source=rubygems.org&utm_campaign=rubygems_link
|
166
143
|
licenses:
|
167
|
-
-
|
144
|
+
- Commercial with free option
|
168
145
|
metadata:
|
169
146
|
source_code_uri: https://github.com/jasonfb/hot-glue
|
170
|
-
tutorial: https://jfbcodes.com/hot-glue-tutorial
|
171
|
-
buy_license: https://heliosdev.shop/hot-glue-licens
|
172
|
-
get_merch: https://shop.heliosdev.shop/?utm_source=rubygems&utm_campaign=hot_glue_gem_metadata
|
173
147
|
post_install_message: |
|
174
148
|
---------------------------------------------
|
175
149
|
Welcome to Hot Glue - A Scaffold Building Companion for Hotwire + Turbo-Rails
|
176
|
-
|
177
|
-
To purchase a license, please visit https://heliosdev.shop/hot-glue-license
|
150
|
+
For license options visit https://heliosdev.shop/hot-glue-license
|
178
151
|
---------------------------------------------
|
179
152
|
rdoc_options: []
|
180
153
|
require_paths:
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class DeviseCreateUsers < ActiveRecord::Migration[6.1]
|
4
|
-
def change
|
5
|
-
create_table :users do |t|
|
6
|
-
## Database authenticatable
|
7
|
-
t.string :email, null: false, default: ""
|
8
|
-
t.string :encrypted_password, null: false, default: ""
|
9
|
-
|
10
|
-
## Recoverable
|
11
|
-
t.string :reset_password_token
|
12
|
-
t.datetime :reset_password_sent_at
|
13
|
-
|
14
|
-
## Rememberable
|
15
|
-
t.datetime :remember_created_at
|
16
|
-
|
17
|
-
## Trackable
|
18
|
-
# t.integer :sign_in_count, default: 0, null: false
|
19
|
-
# t.datetime :current_sign_in_at
|
20
|
-
# t.datetime :last_sign_in_at
|
21
|
-
# t.string :current_sign_in_ip
|
22
|
-
# t.string :last_sign_in_ip
|
23
|
-
|
24
|
-
## Confirmable
|
25
|
-
# t.string :confirmation_token
|
26
|
-
# t.datetime :confirmed_at
|
27
|
-
# t.datetime :confirmation_sent_at
|
28
|
-
# t.string :unconfirmed_email # Only if using reconfirmable
|
29
|
-
|
30
|
-
## Lockable
|
31
|
-
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
32
|
-
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
33
|
-
# t.datetime :locked_at
|
34
|
-
|
35
|
-
|
36
|
-
t.timestamps null: false
|
37
|
-
end
|
38
|
-
|
39
|
-
add_index :users, :email, unique: true
|
40
|
-
add_index :users, :reset_password_token, unique: true
|
41
|
-
# add_index :users, :confirmation_token, unique: true
|
42
|
-
# add_index :users, :unlock_token, unique: true
|
43
|
-
end
|
44
|
-
end
|