Class: SunSword::FrontendGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/sun_sword/frontend_generator.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/generators/sun_sword/frontend_generator.rb', line 24

def setup
  validate_no_engine
  copy_assets_from_template

  add_to_gemfile
  install_vite
  configure_vite

  modify_application_js
  generate_default_frontend
  generate_controllers_tests
  generate_components
  modify_layout_for_vite
end

#validate_no_engineObject



16
17
18
19
20
# File 'lib/generators/sun_sword/frontend_generator.rb', line 16

def validate_no_engine
  if options[:engine]
    raise Thor::Error, 'Frontend generator does not support --engine option. Frontend setup must be done in the main app only. Use "rails generate sun_sword:frontend --setup" without engine option.'
  end
end

#validate_setup_optionObject



10
11
12
13
14
# File 'lib/generators/sun_sword/frontend_generator.rb', line 10

def validate_setup_option
  unless options.setup
    raise Thor::Error, 'The --setup option must be specified to create the domain structure.'
  end
end