Skip to content

Commit 4e47b97

Browse files
committed
Generalize EnsureRailsInit
1 parent 6df6c96 commit 4e47b97

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • vite_rails/lib/vite_rails

vite_rails/lib/vite_rails/cli.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
module ViteRails::CLI
66
end
77

8-
module ViteRails::CLI::Build
8+
module ViteRails::CLI::EnsureRailsInit
99
def call(**options)
1010
ensure_rails_init
1111
super
@@ -15,7 +15,7 @@ def call(**options)
1515
def ensure_rails_init
1616
require File.expand_path("config/environment", Dir.pwd)
1717
rescue StandardError, LoadError => error
18-
$stderr << "Unable to initialize Rails application before Vite build:\n\n\t#{error.message}\n\n"
18+
$stderr << "Unable to initialize Rails application before Vite:\n\n\t#{error.message}\n\n"
1919
end
2020
end
2121

@@ -80,5 +80,6 @@ def install_sample_files
8080
end
8181
end
8282

83-
ViteRuby::CLI::Build.prepend(ViteRails::CLI::Build)
83+
ViteRuby::CLI::Build.prepend(ViteRails::CLI::EnsureRailsInit)
84+
ViteRuby::CLI::Dev.prepend(ViteRails::CLI::EnsureRailsInit)
8485
ViteRuby::CLI::Install.prepend(ViteRails::CLI::Install)

0 commit comments

Comments
 (0)