Class: Railsui::Generators::UpdateGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ThemeSetup
Defined in:
lib/generators/railsui/update/update_generator.rb

Instance Method Summary collapse

Methods included from ThemeSetup

#action_text_installed?, #add_yarn_packages, #copy_bin_dev, #copy_procfile, #copy_railsui_head, #copy_railsui_images, #copy_railsui_launcher, #copy_railsui_page_controller, #copy_railsui_pages, #copy_railsui_pages_routes, #copy_railsui_routes, #copy_sample_mailers, #copy_theme_javascript, #copy_theme_javascript_build, #copy_theme_javascript_nobuild, #copy_theme_stylesheets, #detect_and_warn_about_setup, #detect_js_bundler, #detect_package_manager, #fix_application_js_for_bundler, #gem_controllers_dependencies, #gem_installed?, #generate_sample_mailers, #humanize_theme, #importmap_theme_dependencies, #install_css_dependencies, #install_gems, #install_js_dependencies_build, #install_js_dependencies_nobuild, #install_theme_dependencies, #js_theme_dependencies, #pin_importmap_dependencies, #remove_action_text_defaults, #theme_dependencies, #update_application_helper, #update_railsui_mailer_layout

Instance Method Details

#setup_themeObject



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
# File 'lib/generators/railsui/update/update_generator.rb', line 10

def setup_theme
  @config = Railsui::Configuration.load!
  @build_mode = @config.build_mode

  say "Updating theme: #{@config.theme} (#{@build_mode} mode)", :yellow

  # Migrate old CSS path to new tailwindcss-rails v4 location if needed
  migrate_css_path_if_needed

  say "Updating Rails UI config", :yellow
  # mailers
  update_railsui_mailer_layout(@config.theme)
  copy_sample_mailers(@config.theme)

  # Install dependencies based on build mode
  if @build_mode == "nobuild"
    install_js_dependencies_nobuild(@config.theme)
  else
    install_js_dependencies_build(@config.theme)
  end

  # CSS dependencies (unified for both modes)
  install_css_dependencies

  # themed assets
  copy_theme_javascript(@config.theme)
  copy_theme_stylesheets(@config.theme)

  # Update Procfile for current mode
  copy_procfile

  # update body classes
  update_railsui_theme_classes

  # sync pages
  sync_pages

  Railsui::Configuration.synchronize_pages

  # Run bundle install to ensure all gems are available
  say "Running bundle install...", :yellow
  run "bundle install"

  @config.save
  say "✅ Configuration updated successfully for #{@build_mode} mode", :green
end