rails_app_generator 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -69,23 +69,25 @@ module RailsAppGenerator
69
69
  end
70
70
  end
71
71
 
72
- # def initialize(*args)
73
- # super
74
-
75
- # # puts '----------------------------------------------------'
76
- # # puts options
77
- # # puts '----------------------------------------------------'
78
-
79
- # # return unless options[:api]
80
-
81
- # # self.options = options.merge(
82
- # # skip_errors: true,
83
- # # skip_high_voltage: true,
84
- # # skip_stimulus: true,
85
- # # skip_tailwind: true,
86
- # # skip_views: true
87
- # # ).freeze
88
- # end
72
+ def initialize(*args)
73
+ super
74
+
75
+ @force_copy = false
76
+
77
+ # puts '----------------------------------------------------'
78
+ # puts options
79
+ # puts '----------------------------------------------------'
80
+
81
+ # return unless options[:api]
82
+
83
+ # self.options = options.merge(
84
+ # skip_errors: true,
85
+ # skip_high_voltage: true,
86
+ # skip_stimulus: true,
87
+ # skip_tailwind: true,
88
+ # skip_views: true
89
+ # ).freeze
90
+ end
89
91
 
90
92
  # def rails_customization
91
93
  # puts 'rails customizations'
@@ -176,7 +178,7 @@ module RailsAppGenerator
176
178
  # add_controller('home', 'index')
177
179
  # add_scaffold('people', 'first_name', 'last_name', 'age:integer', 'address:text')
178
180
  # route("root 'home#index'")
179
- # gem "cssbundling-rails"
181
+ # css_install('tailwind')
180
182
  # rails_command('db:migrate')
181
183
  # bundle_add('hotwire-rails')
182
184
  # rails_command('hotwire:install')
@@ -188,6 +190,18 @@ module RailsAppGenerator
188
190
  # gsub_file 'app/views/layouts/application.html.erb', %(container mx-auto mt-28 px-5 flex), 'container mx-auto px-5'
189
191
  # template 'home.css', 'app/assets/stylesheets/home.css'
190
192
 
193
+ # force_copy? # defaults to false
194
+ # force_copy(true) # set to true
195
+ # force_copy(false) # set to false
196
+ # force_copy # aka force_copy(true)
197
+ def force_copy?
198
+ @force_copy ||= options[:force_copy] || false
199
+ end
200
+
201
+ def force_copy(value: true)
202
+ @force_copy = value
203
+ end
204
+
191
205
  # USED BY AFTER_TEMPLATE
192
206
  def gac(message)
193
207
  return unless active?(:git)
@@ -220,6 +234,13 @@ module RailsAppGenerator
220
234
  run("bundle add #{name}")
221
235
  end
222
236
 
237
+ # If you need to manually install tailwind (instead of using the --template option)
238
+ # you can use css_install('tailwind')
239
+ def css_install(name)
240
+ gem 'cssbundling-rails'
241
+ rails_command("css:install:#{name}")
242
+ end
243
+
223
244
  def pin(name, *args)
224
245
  run("bin/importmap pin #{name} #{args.join(' ')}")
225
246
  end
@@ -229,6 +250,12 @@ module RailsAppGenerator
229
250
  pin(name, *args)
230
251
  end
231
252
 
253
+ def copy_file(source, destination, **args)
254
+ args = { force: true }.merge(args) if force_copy?
255
+
256
+ super(source, destination, **args)
257
+ end
258
+
232
259
  def read_template(template_file)
233
260
  path = find_in_source_paths(template_file)
234
261
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAppGenerator
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.6'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "rails_app_generator",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "rails_app_generator",
9
- "version": "0.1.5",
9
+ "version": "0.1.6",
10
10
  "dependencies": {
11
11
  "daisyui": "^2.20.0"
12
12
  },
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rails_app_generator",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Create new Rails Application with custom opinions",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
@@ -0,0 +1,12 @@
1
+ {
2
+ "args": {
3
+ "app_path": "tailwind_emulating_bootstrap",
4
+ "destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/rag"
5
+ },
6
+ "opts": {
7
+ "skip_test": true,
8
+ "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/rag_tailwind_emulating_bootstrap.rb",
9
+ "note": "tailwind needs to be installed manually because of style reuse",
10
+ "XXX-css": "tailwind"
11
+ }
12
+ }
@@ -4,7 +4,6 @@
4
4
  "destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/rag"
5
5
  },
6
6
  "opts": {
7
- "skip_git": true,
8
7
  "skip_test": true,
9
8
  "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/rag_tailwind_hotwire_flash.rb",
10
9
  "css": "tailwind"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_app_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-29 00:00:00.000000000 Z
11
+ date: 2022-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootsnap
@@ -177,6 +177,16 @@ files:
177
177
  - after_templates/rag_tailwind/component-section-end.html
178
178
  - after_templates/rag_tailwind_daisyui.rb
179
179
  - after_templates/rag_tailwind_daisyui/index.html.erb
180
+ - after_templates/rag_tailwind_emulating_bootstrap.rb
181
+ - after_templates/rag_tailwind_emulating_bootstrap/Procfile.dev
182
+ - after_templates/rag_tailwind_emulating_bootstrap/application.html.erb
183
+ - after_templates/rag_tailwind_emulating_bootstrap/application.tailwind.css
184
+ - after_templates/rag_tailwind_emulating_bootstrap/application_controller.rb
185
+ - after_templates/rag_tailwind_emulating_bootstrap/home/_example.html.erb
186
+ - after_templates/rag_tailwind_emulating_bootstrap/home/bootstrap.html.erb
187
+ - after_templates/rag_tailwind_emulating_bootstrap/home/home_controller.rb
188
+ - after_templates/rag_tailwind_emulating_bootstrap/home/index.html.erb
189
+ - after_templates/rag_tailwind_emulating_bootstrap/home/tailwind.html.erb
180
190
  - after_templates/rag_tailwind_hotwire.rb
181
191
  - after_templates/rag_tailwind_hotwire/home/controller.rb
182
192
  - after_templates/rag_tailwind_hotwire/home/helper.rb
@@ -222,7 +232,6 @@ files:
222
232
  - after_templates/rag_tailwind_hotwire_form_search/show.html.erb
223
233
  - after_templates/rag_tailwind_hotwire_form_search/theme_changer_controller.js
224
234
  - after_templates/rag_tailwind_hotwire_form_search/update.turbo_stream.erb
225
- - after_templates/rag_tailwind_style_reuse.rb
226
235
  - bin/console
227
236
  - bin/setup
228
237
  - docs/project-plan.md
@@ -298,11 +307,11 @@ files:
298
307
  - profiles/rag-import-map.json
299
308
  - profiles/rag-simple.json
300
309
  - profiles/rag-tailwind-daisyui.json
310
+ - profiles/rag-tailwind-emulating-bootstrap.json
301
311
  - profiles/rag-tailwind-hotwire-flash.json
302
312
  - profiles/rag-tailwind-hotwire-form-search.json
303
313
  - profiles/rag-tailwind-hotwire-form.json
304
314
  - profiles/rag-tailwind-hotwire.json
305
- - profiles/rag-tailwind-style-reuse.json
306
315
  - profiles/rag-tailwind.json
307
316
  - sig/rails_app_generator.rbs
308
317
  - templates/README.md.erb
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Rails 7 hotwire and flash messages
4
-
5
- require 'pry'
6
-
7
- self.local_template_path = File.join(File.dirname(__FILE__), File.basename(__FILE__, '.*'))
8
-
9
- gac 'base rails 7 image created'
10
-
11
- add_controller('home', 'index', 'about')
12
- route("root 'home#index'")
13
-
14
- after_bundle do
15
- setup_db
16
- end
17
-
18
- def setup_db
19
- add_scaffold('title', 'body:text')
20
- db_migrate
21
- end
22
-
23
-
@@ -1,12 +0,0 @@
1
- {
2
- "args": {
3
- "app_path": "tailwind_hotwire_flash",
4
- "destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/rag"
5
- },
6
- "opts": {
7
- "skip_git": true,
8
- "skip_test": true,
9
- "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/rag_tailwind_hotwire_flash.rb",
10
- "css": "tailwind"
11
- }
12
- }