2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/kaze/commands/app/hotwire_stack.rb', line 2
def install
return unless remove_gems([ 'sprockets-rails', 'stimulus-rails' ])
return unless install_gems([ 'propshaft', 'view_component', 'tailwindcss-rails', 'turbo-rails', 'dotenv', 'bcrypt' ])
return unless install_gems([ 'hotwire-livereload' ], 'development')
return unless install_gems([ 'factory_bot_rails', 'faker' ], 'development, test')
FileUtils.copy_entry("#{stubs_path}/hotwire/app/controllers", "#{Dir.pwd}/app/controllers")
FileUtils.copy_entry("#{stubs_path}/default/app/models", "#{Dir.pwd}/app/models")
ensure_directory_exists("#{Dir.pwd}/app/forms")
FileUtils.copy_entry("#{stubs_path}/default/app/forms", "#{Dir.pwd}/app/forms")
ensure_directory_exists("#{Dir.pwd}/app/validators")
FileUtils.copy_entry("#{stubs_path}/default/app/validators", "#{Dir.pwd}/app/validators")
ensure_directory_exists("#{Dir.pwd}/app/mailers")
FileUtils.copy_entry("#{stubs_path}/default/app/mailers", "#{Dir.pwd}/app/mailers")
ensure_directory_exists("#{Dir.pwd}/app/views/layouts")
ensure_directory_exists("#{Dir.pwd}/app/views/user_mailer")
FileUtils.copy_entry("#{stubs_path}/hotwire/app/views", "#{Dir.pwd}/app/views")
FileUtils.copy_file("#{stubs_path}/default/app/views/layouts/mailer.html.erb", "#{Dir.pwd}/app/views/layouts/mailer.html.erb")
FileUtils.copy_file("#{stubs_path}/default/app/views/layouts/mailer.text.erb", "#{Dir.pwd}/app/views/layouts/mailer.text.erb")
FileUtils.copy_entry("#{stubs_path}/default/app/views/user_mailer", "#{Dir.pwd}/app/views/user_mailer")
ensure_directory_exists("#{Dir.pwd}/app/components")
FileUtils.copy_entry("#{stubs_path}/hotwire/app/components", "#{Dir.pwd}/app/components")
ensure_directory_exists("#{Dir.pwd}/app/javascript")
FileUtils.copy_file("#{stubs_path}/hotwire/app/javascript/application.js", "#{Dir.pwd}/app/javascript/application.js")
FileUtils.copy_file("#{stubs_path}/hotwire/app/javascript/alpinejs.stub", "#{Dir.pwd}/app/javascript/alpinejs.js")
FileUtils.copy_file("#{stubs_path}/hotwire/config/importmap.rb", "#{Dir.pwd}/config/importmap.rb")
install_tests
FileUtils.copy_file("#{stubs_path}/default/config/routes.rb", "#{Dir.pwd}/config/routes.rb")
install_migrations
FileUtils.copy_file("#{stubs_path}/default/app/assets/stylesheets/application.css", "#{Dir.pwd}/app/assets/stylesheets/application.css")
FileUtils.copy_file("#{stubs_path}/default/app/assets/stylesheets/application.tailwind.css", "#{Dir.pwd}/app/assets/stylesheets/application.tailwind.css")
FileUtils.copy_file("#{stubs_path}/hotwire/config/tailwind.config.js", "#{Dir.pwd}/config/tailwind.config.js")
FileUtils.copy_file("#{stubs_path}/default/bin/dev", "#{Dir.pwd}/bin/dev")
FileUtils.copy_file("#{stubs_path}/default/Procfile.dev", "#{Dir.pwd}/Procfile.dev")
run_command("#{Dir.pwd}/bin/rails tailwindcss:build")
say ''
say 'Kaze scaffolding installed successfully.', :green
end
|