hot-glue 0.7.3 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00062223cad2c1adb79987dc16eec8e5a1cb612f18106c6b01878346630737d7
4
- data.tar.gz: fd0fcf30cccc20b02e552d44628cf4856e08582338e296eea08699ff1318b85d
3
+ metadata.gz: 1ac74e056098b9847487adc764e7bb03b0024c94bdbdf151eb24eb688cc53309
4
+ data.tar.gz: a23e9e6c569539b30542b97446bea589317cd1118bd87bf7c4330fff3a08603d
5
5
  SHA512:
6
- metadata.gz: 1ec04a5a3a6783caac2efc0035b409d9ac768a0d8094729b2f9551cdb363629f6433e24364a8caaaee675877ad996cbc51a219d666b9bfa05055143d372f3f77
7
- data.tar.gz: '028e4f5fc7cb0a490ee715df7201976f79d026ff8916b5b0c9568901e215b61f61d54d4987a2748f40d48b7f91620acf719f59f6d52ed586853de6756eaefd61'
6
+ metadata.gz: eae357a387a886f4f24156f78f666a56f81a829d1aab3dd3e128698cbf59ede7136bf9d6c0c8e286b9840205860133ea6d17085ff7e340aea4a3b9be8bcacae1
7
+ data.tar.gz: d5d23aaac0178a602cbc0f1893819aba6b12d57270f218389742a54bdfdea5a59c6bd800b1a5e7b05cedb75d452bd6a8da170a6cc3a57fd6c2caf9edcca4c2e1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hot-glue (0.7.2)
4
+ hot-glue (0.7.5)
5
5
  ffaker (~> 2.16)
6
6
  rails (> 5.1)
7
7
 
@@ -75,7 +75,7 @@ GEM
75
75
  tzinfo (~> 2.0)
76
76
  addressable (2.8.1)
77
77
  public_suffix (>= 2.0.2, < 6.0)
78
- base64 (0.2.0)
78
+ base64 (0.3.0)
79
79
  bcrypt (3.1.18)
80
80
  builder (3.2.4)
81
81
  byebug (11.1.3)
@@ -90,7 +90,7 @@ GEM
90
90
  xpath (~> 3.2)
91
91
  concurrent-ruby (1.1.10)
92
92
  crass (1.0.6)
93
- date (3.4.1)
93
+ date (3.5.1)
94
94
  devise (4.8.1)
95
95
  bcrypt (~> 3.0)
96
96
  orm_adapter (~> 0.1)
@@ -113,21 +113,23 @@ GEM
113
113
  importmap-rails (1.1.5)
114
114
  actionpack (>= 6.0.0)
115
115
  railties (>= 6.0.0)
116
+ logger (1.7.0)
116
117
  loofah (2.19.0)
117
118
  crass (~> 1.0.2)
118
119
  nokogiri (>= 1.5.9)
119
- mail (2.8.1)
120
+ mail (2.9.0)
121
+ logger
120
122
  mini_mime (>= 0.1.1)
121
123
  net-imap
122
124
  net-pop
123
125
  net-smtp
124
- marcel (1.0.4)
126
+ marcel (1.1.0)
125
127
  matrix (0.4.2)
126
128
  method_source (1.0.0)
127
129
  mini_mime (1.1.2)
128
130
  mini_portile2 (2.8.4)
129
131
  minitest (5.16.3)
130
- net-imap (0.5.8)
132
+ net-imap (0.6.2)
131
133
  date
132
134
  net-protocol
133
135
  net-pop (0.1.2)
@@ -223,7 +225,7 @@ GEM
223
225
  stimulus-rails (1.1.1)
224
226
  railties (>= 6.0.0)
225
227
  thor (1.2.1)
226
- timeout (0.4.3)
228
+ timeout (0.6.0)
227
229
  turbo-rails (1.3.2)
228
230
  actionpack (>= 6.0.0)
229
231
  activejob (>= 6.0.0)
@@ -233,7 +235,7 @@ GEM
233
235
  warden (1.2.9)
234
236
  rack (>= 2.0.9)
235
237
  websocket (1.2.9)
236
- websocket-driver (0.7.7)
238
+ websocket-driver (0.8.0)
237
239
  base64
238
240
  websocket-extensions (>= 0.1.0)
239
241
  websocket-extensions (0.1.5)
data/README.md CHANGED
@@ -22,13 +22,13 @@ Hot Glue generates quick and dirty functionality. It lets you be crafty. However
22
22
  * Automatically reads your models (make them, add relationships, **and** migrate your database before building your scaffolding!)
23
23
  * Excellent for CREATE-READ-UPDATE-DELETE (CRUD), lists with pagination
24
24
  * Great for prototyping, but you should learn Rails fundamentals first.
25
- * 'Packaged' with Devise, Kaminari, Rspec
25
+ * Defaults to Devise & Rspec, but these are optional
26
+ * Use Pagy for pagination
26
27
  * Create system specs automatically along with the generated code.
27
28
  * Nest your routes model-by-model for built-in poor man's authentication.
28
29
  * Throw the scaffolding away when your app is ready to graduate to its next phase.
29
30
 
30
31
  How is it different than Rails scaffolding?
31
- 77
32
32
  Although inspired by the Rails scaffold generators (built-in to Rails), Hot Glue does something similiar but has made opinionated decisions that deviate from the normal Rails scaffold:
33
33
 
34
34
  1. The Hot Glue scaffolds are complete packages and are pre-optimized for 'edit-in-place' so that new and edit operations happen in-page smoothly.
@@ -2146,6 +2146,18 @@ https://jasonfleetwoodboldt.com/courses/rails-7-crash-course/rails-7-stimulus-js
2146
2146
  # SPECIAL FEATURES DISCUSSION
2147
2147
  This section discusses features that don't correspond to a single option or flag.
2148
2148
 
2149
+ ## PAGINATION
2150
+ - Although legacy support Kaminari and will_paginate exist, I recommend Pagy.
2151
+
2152
+ For Pagy version 9 or below
2153
+ 1. include the gem
2154
+ 2. in `config/initializers/pagy.rb` add `require 'pagy/extras/bootstrap'`
2155
+ 3. add `include Pagy::Backend` to ApplicationController
2156
+ 4. add `include Pagy::Frontend` to ApplicationHelper
2157
+
2158
+ For Pagy version 43 (there was a version jump)
2159
+ *NOT YET COMPATIBLE WITH PAGY 43*
2160
+ TODO: implement pagy 43
2149
2161
 
2150
2162
  ## "Thing" Label
2151
2163
 
@@ -2461,11 +2473,27 @@ The `within` partials should do operations within the form (like hidden fields),
2461
2473
  These automatic pickups for partials are detected at build time. This means that if you add these partials later, you must rebuild your scaffold.
2462
2474
 
2463
2475
 
2476
+
2477
+
2478
+
2464
2479
  # VERSION HISTORY
2465
2480
 
2466
- #### 2025-12-24 - v0.7.3
2481
+ #### 2026-01-11 - v0.7.5
2482
+ This is mostly a maintenance release to address these two issues related to the hawk:
2483
+ - removes the hawk in the create action because we are alrady doing it in the creation_syntax
2484
+ - fixes variable mutation problem affecting when the singular hawk contains the name of the object itself, was duplicitiously adding @ to local variables, now fixed for to produce correct instance var for the controller code
2485
+ - when using the hawk, don't add @ in your syntax; a local variable the same name of the thing being built will automatically get @ appended to the front in controller code
2486
+
2487
+
2488
+ #### 2025-12-28 - v0.7.4
2489
+ • `--list-back-link-to-parent` has been renamed `--back-link-to-parent`
2490
+ • something was wrong with non-nested scaffolder calling `parent_resource_name` — thor invoked this method even when it wasn't called; it has been moved into a helper to prevent this
2491
+ • Check to only support Pagy version 9 or below; Pagy 43 has breaking changes and cannot yet be used (coming soon)
2467
2492
 
2468
- `--list-back-link-to-parent` (default: false)
2493
+
2494
+ #### 2025-12-24 - v0.7.3
2495
+ (previously `--list-back-link-to-parent`; release notes retroactively edited)
2496
+ `--back-link-to-parent` (default: false)
2469
2497
 
2470
2498
  If the parent is itself a big edit, and we got to the nested edit (also a big edit) through a tab showing subview list (loaded lazily via Turbo's built-in mechanism),
2471
2499
  then we don't typically want the "back to" link at the top of the edit page to take us back to the list of the current object.
@@ -2474,7 +2502,7 @@ That's because although the list of the current object exists as its own page, i
2474
2502
 
2475
2503
  The user came to _this_ edit page from the parent's edit page, so we should go back to the parent's edit page.
2476
2504
 
2477
- Use `--list-back-link-to-parent` to tell this build to use a "Back to ____" link at the top of the edit page (where ____ is the name of the parent)
2505
+ Use `--back-link-to-parent` to tell this build to use a "Back to ____" link at the top of the edit page (where ____ is the name of the parent)
2478
2506
 
2479
2507
  Otherwise, the link at the top of the edit page will read "Back to list" and take the user back to the list view of the current build.
2480
2508
 
@@ -0,0 +1,6 @@
1
+ module GeneratorHelpers
2
+
3
+ def parent_resource_name
4
+ @nested_set.last[:singular]
5
+ end
6
+ end
@@ -10,9 +10,12 @@ require_relative './layout_strategy/base'
10
10
  require_relative './layout_strategy/bootstrap'
11
11
  require_relative './layout_strategy/hot_glue'
12
12
  require_relative './layout_strategy/tailwind'
13
+ require_relative './helpers/generator_helpers'
14
+
13
15
 
14
16
  class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
15
17
  include DefaultConfigLoader
18
+ include GeneratorHelpers
16
19
  hook_for :form_builder, :as => :scaffold
17
20
 
18
21
  source_root File.expand_path('templates', __dir__)
@@ -31,7 +34,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
31
34
  :search_clear_button, :search_autosearch, :include_object_names,
32
35
  :stimmify, :stimmify_camel, :hidden_create, :hidden_update,
33
36
  :invisible_create, :invisible_update, :phantom_create_params,
34
- :phantom_update_params, :lazy, :list_back_link_to_parent
37
+ :phantom_update_params, :lazy, :back_link_to_parent
35
38
  # important: using an attr_accessor called :namespace indirectly causes a conflict with Rails class_name method
36
39
  # so we use namespace_value instead
37
40
 
@@ -130,7 +133,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
130
133
  class_option :search_position, default: 'vertical' # choices are vertical or horizontal
131
134
  class_option :search_clear_button, default: false
132
135
  class_option :search_autosearch, default: false
133
- class_option :list_back_link_to_parent, default: nil
136
+ class_option :back_link_to_parent, default: nil
134
137
 
135
138
 
136
139
  # FOR THE PREDICATE SEARCH
@@ -171,7 +174,12 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
171
174
 
172
175
 
173
176
  if Gem::Specification.find_all_by_name('pagy').any?
174
- @pagination_style = 'pagy'
177
+ if Gem::Specification.find_all_by_name('pagy').first.version.to_s.split(".").first.to_i <= 9
178
+ @pagination_style = 'pagy9'
179
+ else
180
+ raise "Pagy version 43 not yet compatible"
181
+ @pagination_style = 'pagy43'
182
+ end
175
183
  elsif Gem::Specification.find_all_by_name('will_paginate').any?
176
184
  @pagination_style = 'will_paginate'
177
185
  elsif Gem::Specification.find_all_by_name('kaminari').any?
@@ -494,7 +502,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
494
502
  @include_object_names = options['include_object_names'] || get_default_from_config(key: :include_object_names)
495
503
 
496
504
 
497
- @list_back_link_to_parent = options['list_back_link_to_parent'] || false
505
+ @back_link_to_parent = options['back_link_to_parent'] || false
498
506
 
499
507
  if @god
500
508
  # @auth = nil
@@ -1154,7 +1162,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
1154
1162
 
1155
1163
  def creation_syntax
1156
1164
  if @factory_creation.nil? && ! @alt_lookups.any?
1157
- ( @hawk_keys.any? ? "modified_params = hawk_params({#{ hawk_to_ruby }}, modified_params)\n " : "") + "@#{singular } = #{ class_name }.new(modified_params)"
1165
+ (@hawk_keys.any? ? "modified_params = hawk_params({#{ hawk_to_ruby(in_controller: true) }}, modified_params)\n " : "") + "@#{singular } = #{ class_name }.new(modified_params)"
1158
1166
  elsif @factory_creation.nil? && @alt_lookups.any?
1159
1167
 
1160
1168
  prelookup_syntax = @alt_lookups.collect{|lookup, data|
@@ -1377,9 +1385,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
1377
1385
  end
1378
1386
  end
1379
1387
 
1380
- def parent_object_name
1381
- @nested_set.last[:singular]
1382
- end
1388
+
1383
1389
 
1384
1390
  def datetime_fields_list
1385
1391
  @columns.each_with_object({}) do |col, hash|
@@ -1998,19 +2004,21 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
1998
2004
  [name, file_format].compact.join(".")
1999
2005
  end
2000
2006
 
2001
- def hawk_to_ruby(in_controller: false) # false for views; true for controller
2002
-
2007
+ def hawk_to_ruby(in_controller: false)
2008
+ # false for views; true for controller
2003
2009
 
2004
2010
  res = @hawk_keys.collect { |k, v|
2005
- bind_to_array = v[:bind_to]
2006
-
2011
+ bind_to_array = v[:bind_to].dup
2007
2012
  bind_to = bind_to_array.collect{|bt|
2008
- bt.gsub!(singular, "@#{singular}") if in_controller
2009
- bt
2013
+ if in_controller
2014
+ bt.gsub(singular, "@#{singular}")
2015
+ else
2016
+ bt
2017
+ end
2010
2018
  }
2011
2019
 
2012
2020
  "#{k.to_s}: [#{bind_to.join(".")}]"
2013
- }.join(", ")
2021
+ }.compact.join(", ")
2014
2022
  res
2015
2023
  end
2016
2024
 
@@ -123,7 +123,6 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
123
123
  <%= controller_attachment_orig_filename_pickup_syntax %>
124
124
  <%= creation_syntax %>
125
125
  <%= @code_after_new ? @code_after_new.gsub(";","\n") + "\n" : "" %>
126
- <% if @hawk_keys.any? %> modified_params = hawk_params({<%= hawk_to_ruby(in_controller: true) %>}, modified_params)<% end %>
127
126
 
128
127
  <% if @pundit %><% @related_sets.each do |key, related_set| %>
129
128
  check_<%= related_set[:association_ids_method].to_s %>_permissions(modified_params, :create)<% end %><% end %>
@@ -6,8 +6,8 @@
6
6
  <div class="row">
7
7
  <div class="col-md-12">
8
8
 
9
- <% if @list_back_link_to_parent %>
10
- <\%= link_to "&#11013;&#65039; Back to <%= parent_object_name %>".html_safe, <%= edit_parent_path_helper(true) %> %>
9
+ <% if @back_link_to_parent %>
10
+ <\%= link_to "&#11013;&#65039; Back to <%= parent_resource_name %>".html_safe, <%= edit_parent_path_helper(true) %> %>
11
11
  <% else %>
12
12
  <\%= link_to "&#11013;&#65039; Back to list".html_safe, <%= path_helper_plural(true) %> %>
13
13
  <% end %>
@@ -1,5 +1,5 @@
1
1
  module HotGlue
2
2
  class Version
3
- CURRENT = '0.7.3'
3
+ CURRENT = '0.7.5'
4
4
  end
5
5
  end
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.7.3
4
+ version: 0.7.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: 2025-12-24 00:00:00.000000000 Z
11
+ date: 2026-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -82,6 +82,7 @@ files:
82
82
  - lib/generators/hot_glue/fields/time_field.rb
83
83
  - lib/generators/hot_glue/fields/uuid_field.rb
84
84
  - lib/generators/hot_glue/flash_notices_install_generator.rb
85
+ - lib/generators/hot_glue/helpers/generator_helpers.rb
85
86
  - lib/generators/hot_glue/hot_glue.rb
86
87
  - lib/generators/hot_glue/install_generator.rb
87
88
  - lib/generators/hot_glue/layout/builder.rb