hot-glue 0.0.8 → 0.2.0

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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -1
  3. data/Gemfile.lock +21 -18
  4. data/README.md +84 -50
  5. data/app/helpers/hot_glue/controller_helper.rb +1 -1
  6. data/db/migrate/20210306223305_create_ghis.rb +9 -0
  7. data/db/schema.rb +1 -1
  8. data/lib/generators/hot_glue/install_generator.rb +0 -2
  9. data/lib/generators/hot_glue/markup_templates/base.rb +7 -0
  10. data/lib/generators/hot_glue/markup_templates/erb.rb +228 -0
  11. data/lib/generators/hot_glue/markup_templates/haml.rb +223 -0
  12. data/lib/generators/hot_glue/markup_templates/slim.rb +9 -0
  13. data/lib/generators/hot_glue/scaffold_generator.rb +172 -280
  14. data/lib/generators/hot_glue/templates/controller.rb.erb +12 -10
  15. data/lib/generators/hot_glue/templates/erb/_errors.erb +11 -0
  16. data/lib/generators/hot_glue/templates/erb/_flash_notices.erb +12 -0
  17. data/lib/generators/hot_glue/templates/erb/_form.erb +8 -0
  18. data/lib/generators/hot_glue/templates/erb/_line.erb +10 -0
  19. data/lib/generators/hot_glue/templates/erb/_list.erb +19 -0
  20. data/lib/generators/hot_glue/templates/erb/_new_button.erb +3 -0
  21. data/lib/generators/hot_glue/templates/erb/_new_form.erb +8 -0
  22. data/lib/generators/hot_glue/templates/erb/_show.erb +8 -0
  23. data/lib/generators/hot_glue/templates/erb/create.turbo_stream.erb +18 -0
  24. data/lib/generators/hot_glue/templates/erb/destroy.turbo_stream.erb +3 -0
  25. data/lib/generators/hot_glue/templates/erb/edit.erb +30 -0
  26. data/lib/generators/hot_glue/templates/erb/edit.turbo_stream.erb +3 -0
  27. data/lib/generators/hot_glue/templates/erb/index.erb +10 -0
  28. data/lib/generators/hot_glue/templates/erb/new.erb +1 -0
  29. data/lib/generators/hot_glue/templates/erb/update.turbo_stream.erb +10 -0
  30. data/lib/generators/hot_glue/templates/{_errors.haml → haml/_errors.haml} +0 -0
  31. data/lib/generators/hot_glue/templates/{_flash_notices.haml → haml/_flash_notices.haml} +0 -0
  32. data/lib/generators/hot_glue/templates/{_form.haml → haml/_form.haml} +1 -0
  33. data/lib/generators/hot_glue/templates/{_line.haml → haml/_line.haml} +0 -0
  34. data/lib/generators/hot_glue/templates/{_list.haml → haml/_list.haml} +0 -0
  35. data/lib/generators/hot_glue/templates/{_new_button.haml → haml/_new_button.haml} +0 -0
  36. data/lib/generators/hot_glue/templates/{_new_form.haml → haml/_new_form.haml} +0 -3
  37. data/lib/generators/hot_glue/templates/haml/_show.haml +7 -0
  38. data/lib/generators/hot_glue/templates/{create.turbo_stream.haml → haml/create.turbo_stream.haml} +0 -0
  39. data/lib/generators/hot_glue/templates/{destroy.turbo_stream.haml → haml/destroy.turbo_stream.haml} +0 -0
  40. data/lib/generators/hot_glue/templates/{edit.haml → haml/edit.haml} +0 -0
  41. data/lib/generators/hot_glue/templates/{edit.turbo_stream.haml → haml/edit.turbo_stream.haml} +0 -0
  42. data/lib/generators/hot_glue/templates/{index.haml → haml/index.haml} +0 -0
  43. data/lib/generators/hot_glue/templates/{new.haml → haml/new.haml} +0 -0
  44. data/lib/generators/hot_glue/templates/haml/update.turbo_stream.haml +9 -0
  45. data/lib/generators/hot_glue/templates/system_spec.rb.erb +115 -76
  46. data/lib/hot-glue.rb +6 -20
  47. data/lib/hotglue/version.rb +1 -1
  48. metadata +45 -27
  49. data/db/migrate/20210306223305_create_hgis.rb +0 -9
  50. data/lib/generators/hot_glue/templates/_show.haml +0 -7
  51. data/lib/generators/hot_glue/templates/request_spec.rb.erb +0 -110
  52. data/lib/generators/hot_glue/templates/update.turbo_stream.haml +0 -5
data/lib/hot-glue.rb CHANGED
@@ -3,26 +3,12 @@ require "hotglue/engine"
3
3
  require 'kaminari'
4
4
  require 'haml-rails'
5
5
 
6
-
7
6
  module HotGlue
8
7
 
9
- # module ControllerHelpers
10
- # def modify_date_inputs_on_params(modified_params, authenticated_user = nil)
11
- # use_timezone = authenticated_user.timezone || Time.now.strftime("%z")
12
- #
13
- # modified_params = modified_params.tap do |params|
14
- # params.keys.each{|k|
15
- # if k.ends_with?("_at") || k.ends_with?("_date")
16
- #
17
- # begin
18
- # params[k] = DateTime.strptime("#{params[k]} #{use_timezone}", '%Y-%m-%dT%H:%M %z')
19
- # rescue StandardError
20
- #
21
- # end
22
- # end
23
- # }
24
- # end
25
- # modified_params
26
- # end
27
- # end
8
+
9
+
10
+ module TemplateBuilders
11
+
12
+ end
28
13
  end
14
+
@@ -1,3 +1,3 @@
1
1
  module HotGlue
2
- VERSION = '0.0.8'
2
+ VERSION = '0.2.0'
3
3
  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.0.8
4
+ version: 0.2.0
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: 2021-03-21 00:00:00.000000000 Z
11
+ date: 2021-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -115,32 +115,50 @@ files:
115
115
  - config/database.yml
116
116
  - db/migrate/20210306212711_create_abcs.rb
117
117
  - db/migrate/20210306223300_create_defs.rb
118
- - db/migrate/20210306223305_create_hgis.rb
118
+ - db/migrate/20210306223305_create_ghis.rb
119
119
  - db/migrate/20210306223309_create_jkls.rb
120
120
  - db/migrate/20210306223701_devise_create_users.rb
121
121
  - db/migrate/20210306225506_create_xyzs.rb
122
122
  - db/schema.rb
123
123
  - lib/generators/hot_glue/install_generator.rb
124
+ - lib/generators/hot_glue/markup_templates/base.rb
125
+ - lib/generators/hot_glue/markup_templates/erb.rb
126
+ - lib/generators/hot_glue/markup_templates/haml.rb
127
+ - lib/generators/hot_glue/markup_templates/slim.rb
124
128
  - lib/generators/hot_glue/scaffold_generator.rb
125
- - lib/generators/hot_glue/templates/_errors.haml
126
- - lib/generators/hot_glue/templates/_flash_notices.haml
127
- - lib/generators/hot_glue/templates/_form.haml
128
- - lib/generators/hot_glue/templates/_line.haml
129
- - lib/generators/hot_glue/templates/_list.haml
130
- - lib/generators/hot_glue/templates/_new_button.haml
131
- - lib/generators/hot_glue/templates/_new_form.haml
132
- - lib/generators/hot_glue/templates/_show.haml
133
129
  - lib/generators/hot_glue/templates/base_controller.rb.erb
134
130
  - lib/generators/hot_glue/templates/controller.rb.erb
135
- - lib/generators/hot_glue/templates/create.turbo_stream.haml
136
- - lib/generators/hot_glue/templates/destroy.turbo_stream.haml
137
- - lib/generators/hot_glue/templates/edit.haml
138
- - lib/generators/hot_glue/templates/edit.turbo_stream.haml
139
- - lib/generators/hot_glue/templates/index.haml
140
- - lib/generators/hot_glue/templates/new.haml
141
- - lib/generators/hot_glue/templates/request_spec.rb.erb
131
+ - lib/generators/hot_glue/templates/erb/_errors.erb
132
+ - lib/generators/hot_glue/templates/erb/_flash_notices.erb
133
+ - lib/generators/hot_glue/templates/erb/_form.erb
134
+ - lib/generators/hot_glue/templates/erb/_line.erb
135
+ - lib/generators/hot_glue/templates/erb/_list.erb
136
+ - lib/generators/hot_glue/templates/erb/_new_button.erb
137
+ - lib/generators/hot_glue/templates/erb/_new_form.erb
138
+ - lib/generators/hot_glue/templates/erb/_show.erb
139
+ - lib/generators/hot_glue/templates/erb/create.turbo_stream.erb
140
+ - lib/generators/hot_glue/templates/erb/destroy.turbo_stream.erb
141
+ - lib/generators/hot_glue/templates/erb/edit.erb
142
+ - lib/generators/hot_glue/templates/erb/edit.turbo_stream.erb
143
+ - lib/generators/hot_glue/templates/erb/index.erb
144
+ - lib/generators/hot_glue/templates/erb/new.erb
145
+ - lib/generators/hot_glue/templates/erb/update.turbo_stream.erb
146
+ - lib/generators/hot_glue/templates/haml/_errors.haml
147
+ - lib/generators/hot_glue/templates/haml/_flash_notices.haml
148
+ - lib/generators/hot_glue/templates/haml/_form.haml
149
+ - lib/generators/hot_glue/templates/haml/_line.haml
150
+ - lib/generators/hot_glue/templates/haml/_list.haml
151
+ - lib/generators/hot_glue/templates/haml/_new_button.haml
152
+ - lib/generators/hot_glue/templates/haml/_new_form.haml
153
+ - lib/generators/hot_glue/templates/haml/_show.haml
154
+ - lib/generators/hot_glue/templates/haml/create.turbo_stream.haml
155
+ - lib/generators/hot_glue/templates/haml/destroy.turbo_stream.haml
156
+ - lib/generators/hot_glue/templates/haml/edit.haml
157
+ - lib/generators/hot_glue/templates/haml/edit.turbo_stream.haml
158
+ - lib/generators/hot_glue/templates/haml/index.haml
159
+ - lib/generators/hot_glue/templates/haml/new.haml
160
+ - lib/generators/hot_glue/templates/haml/update.turbo_stream.haml
142
161
  - lib/generators/hot_glue/templates/system_spec.rb.erb
143
- - lib/generators/hot_glue/templates/update.turbo_stream.haml
144
162
  - lib/hot-glue.rb
145
163
  - lib/hotglue/engine.rb
146
164
  - lib/hotglue/version.rb
@@ -149,8 +167,8 @@ licenses:
149
167
  - Nonstandard
150
168
  metadata:
151
169
  source_code_uri: https://github.com/jasonfb/hot-glue
152
- documentation_uri: https://jfb.teachable.com/p/gems-by-jason
153
- homepage_uri: https://blog.jasonfleetwoodboldt.com/hot-glue/
170
+ documentation_uri: https://www.instagram.com/jfbcodes/
171
+ homepage_uri: https://jasonfleetwoodboldt.com/hot-glue/
154
172
  post_install_message: |
155
173
  ---------------------------------------------
156
174
  Welcome to Hot Glue - A Scaffold Building Companion for Hotwire + Turbo-Rails
@@ -159,11 +177,11 @@ post_install_message: |
159
177
 
160
178
  * Build plug-and-play scaffolding mixing HAML with the power of Hotwire and Turbo-Rails
161
179
  * Automatically Reads Your Models (make them before building your scaffolding!)
162
- * Excellent for CRUD, lists with pagination, searching, sorting.
163
- * Great for prototyping very.
164
- * Plays nicely with Devise, Kaminari, Haml-Rails, Rspec.
165
- * Create specs automatically along with the controllers.
166
- * Nest your routes model-by-model for built-in poor man's authentication
180
+ * Excellent for CRUD, lists with pagination (coming soon: searching & sorting)
181
+ * Great for prototyping.
182
+ * Plays nicely with Devise, Kaminari, Haml-Rails, Rspec, FontAwesome
183
+ * Create specs automatically along with the generated controllers.
184
+ * Nest your routes model-by-model for built-in poor man's authentication.
167
185
  * Throw the scaffolding away when your app is ready to graduate to its next phase.
168
186
 
169
187
  see README for complete instructions.
@@ -182,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
200
  - !ruby/object:Gem::Version
183
201
  version: '0'
184
202
  requirements: []
185
- rubygems_version: 3.2.11
203
+ rubygems_version: 3.0.9
186
204
  signing_key:
187
205
  specification_version: 4
188
206
  summary: A gem build scaffolding.
@@ -1,9 +0,0 @@
1
- class CreateHgis < ActiveRecord::Migration[6.1]
2
- def change
3
- create_table :hgis do |t|
4
- t.integer :def_id
5
-
6
- t.timestamps
7
- end
8
- end
9
- end
@@ -1,7 +0,0 @@
1
- <%= all_line_fields %>
2
- .col
3
- <% if destroy_action %>
4
- = link_to "Delete <i class='fa fa-1x fa-remove'></i>".html_safe, <%= path_helper_full %>(<%= path_helper_args %>), method: :delete, data: {confirm: 'Are you sure?'}, disable_with: "Loading...", class: "delete-<%= singular %>-button btn btn-primary "
5
- <% end %>
6
- &nbsp;
7
- = link_to "Edit <i class='fa fa-1x fa-list-alt'></i>".html_safe, edit_<%= path_helper_full %>(<%= path_helper_args %>), <% if @big_edit %>'data-turbo' => 'false', <% end %>disable_with: "Loading...", class: "edit-<%= singular %>-button btn btn-primary "
@@ -1,110 +0,0 @@
1
- require 'rails_helper'
2
-
3
- describe <%= controller_class_name %> do
4
- render_views
5
- <% unless @auth.nil? %> let(:<%= @auth %>) {create(:<%= @auth.gsub('current_', '') %>)}<%end%>
6
- let(:<%= singular %>) {create(:<%= singular %><%= object_parent_mapping_as_argument_for_specs %> )}
7
-
8
- <%= objest_nest_factory_setup %>
9
-
10
- before(:each) do
11
- @request.env["devise.mapping"] = Devise.mappings[:account]
12
-
13
- sign_in <%= @auth %>, scope: :<%= @auth %>
14
- end
15
-
16
- describe "index" do
17
- it "should respond" do
18
- get :index, xhr: true, format: 'js', params: {
19
- <%= objest_nest_params_by_id_for_specs %>
20
- }
21
- end
22
- end
23
-
24
- describe "new" do
25
- it "should show form" do
26
- get :new, xhr: true, format: 'js', params: {
27
- <%= objest_nest_params_by_id_for_specs %>
28
- }
29
- end
30
- end
31
-
32
- describe "create" do
33
- it "should create a new <%= singular %>" do
34
- expect {
35
- post :create, xhr: true, format: 'js', params: {
36
- <%= (@nested_args.empty? ? "" : objest_nest_params_by_id_for_specs + ",") %>
37
- <%= singular %>: {
38
- <%= columns_spec_with_sample_data %>
39
- }}
40
- }.to change { <%= @singular_class %>.all.count }.by(1)
41
- assert_response :ok
42
- end
43
-
44
- # it "should not create if there are errors" do
45
- # post :create, xhr: true, format: 'js', params: {id: <%= singular %>.id,
46
- # <%= singular %>: {skin_id: nil}}
47
- #
48
- # expect(controller).to set_flash.now[:alert].to(/Oops, your <%= singular %> could not be saved/)
49
- # end
50
- end
51
-
52
- describe "edit" do
53
- it "should return an editable form" do
54
- get :edit, xhr: true, format: 'js', params: {
55
- <%= (@nested_args.empty? ? "" : objest_nest_params_by_id_for_specs + ",") %>
56
- id: <%= singular %>.id
57
- }
58
- assert_response :ok
59
- end
60
- end
61
-
62
- describe "show" do
63
- it "should return a view form" do
64
- get :show, xhr: true, format: 'js', params: {
65
- <%= (@nested_args.empty? ? "" : objest_nest_params_by_id_for_specs + ",") %>
66
- id: <%= singular %>.id
67
- }
68
- assert_response :ok
69
- end
70
- end
71
-
72
- describe "update" do
73
- it "should update" do
74
- put :update, xhr: true, format: 'js',
75
- params: {
76
- <%= (@nested_args.empty? ? "" : objest_nest_params_by_id_for_specs + ",") %>
77
- id: <%= singular %>.id,
78
- <%= singular %>: {
79
- <%= columns_spec_with_sample_data %>
80
- }}
81
-
82
- assert_response :ok
83
- end
84
-
85
- # it "should not update if invalid" do
86
- # put :update, xhr: true, format: 'js',
87
- # params: {
88
- # id: <%= singular %>.id,
89
- # <%= singular %>: {
90
- # <%= columns_spec_with_sample_data %>
91
- # }}
92
- #
93
- # assert_response :ok
94
- #
95
- # expect(controller).to set_flash.now[:alert].to(/Oops, your <%= singular %> could not be saved/)
96
- # end
97
- end
98
-
99
- describe "#destroy" do
100
- it "should destroy" do
101
- post :destroy, format: 'js', params: {
102
- <%= (@nested_args.empty? ? "" : objest_nest_params_by_id_for_specs + ",") %>
103
- id: <%= singular %>.id
104
- }
105
- assert_response :ok
106
- expect(<%= @singular_class %>.count).to be(0)
107
- end
108
- end
109
- end
110
-
@@ -1,5 +0,0 @@
1
-
2
- = turbo_stream.replace "<%= singular%>__#{@<%= singular %>.id}" do
3
- = render partial: 'line', locals: {<%= singular %>: @<%= singular %> <%= nested_assignments_with_leading_comma %> }
4
-
5
-