lib/vite_ruby.rb in vite_ruby-1.2.13 vs lib/vite_ruby.rb in vite_ruby-1.2.14
- old
+ new
@@ -19,12 +19,20 @@
# Internal: Versions used by default when running `vite install`.
DEFAULT_VITE_VERSION = '^2.2.3'
DEFAULT_PLUGIN_VERSION = '^2.0.2'
- # Internal: Ruby Frameworks that have a companion library for Vite Ruby.
- SUPPORTED_FRAMEWORKS = %w[rails hanami roda padrino sinatra].freeze
+ # Internal: Companion libraries for Vite Ruby, and their target framework.
+ COMPANION_LIBRARIES = {
+ 'vite_rails' => 'rails',
+ 'vite_hanami' => 'hanami',
+ 'vite_roda' => 'roda',
+ 'vite_padrino' => 'padrino',
+ 'vite_sinatra' => 'sinatra',
+ 'jekyll-vite' => 'jekyll',
+ 'vite_rails_legacy' => 'rails',
+ }
class << self
extend Forwardable
def_delegators :instance, :config, :commands, :run_proxy?
@@ -70,11 +78,11 @@
end
# Internal: Detects if the application has installed a framework-specific
# variant of Vite Ruby.
def framework_libraries
- SUPPORTED_FRAMEWORKS.map { |framework|
- if library = (Gem.loaded_specs["vite_#{ framework }"] || Gem.loaded_specs["vite_#{ framework }_legacy"])
+ COMPANION_LIBRARIES.map { |name, framework|
+ if library = Gem.loaded_specs[name]
[framework, library]
end
}.compact
end
end