Class: Inertia::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Helpers
Defined in:
lib/generators/inertia/install/install_generator.rb

Constant Summary collapse

FRAMEWORKS =
YAML.load_file(File.expand_path('./frameworks.yml', __dir__))

Instance Method Summary collapse

Methods included from Helpers

#ask, #file?, #file_path, #js_destination_path, #js_destination_root, #js_file_path, #yes?

Instance Method Details

#installObject



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/generators/inertia/install/install_generator.rb', line 49

def install
  say "Installing Inertia's Rails adapter"

  if inertia_resolved_version.version == '0'
    say_error "Could not find the Inertia.js package version #{options[:inertia_version]}.", :red
    exit(false)
  end

  install_vite unless ruby_vite_installed?

  install_typescript if typescript?

  install_tailwind if install_tailwind?

  install_inertia

  install_example_page if options[:example_page]

  say 'Copying bin/dev'
  copy_file "#{__dir__}/templates/dev", 'bin/dev'
  chmod 'bin/dev', 0o755, verbose: verbose?

  say "Inertia's Rails adapter successfully installed", :green
end