Module: ViteRails::CLI::Build

Defined in:
lib/vite_rails/cli.rb

Instance Method Summary collapse

Instance Method Details

#call(**options) ⇒ Object



9
10
11
12
# File 'lib/vite_rails/cli.rb', line 9

def call(**options)
  ensure_rails_init
  super
end

#ensure_rails_initObject

Internal: Attempts to initialize the Rails application.



15
16
17
18
19
# File 'lib/vite_rails/cli.rb', line 15

def ensure_rails_init
  require File.expand_path('config/environment', Dir.pwd)
rescue StandardError, LoadError => error
  $stderr << "Unable to initialize Rails application before Vite build:\n\n\t#{ error.message }\n\n"
end