Sha256: f05bae1d0df028c5151f7bff2c81c563220c985c5b517ed848f3320035f731eb
Contents?: true
Size: 824 Bytes
Versions: 35
Compression:
Stored size: 824 Bytes
Contents
require "bundler" class Superform::InstallGenerator < Rails::Generators::Base source_root File.expand_path("templates", __dir__) APPLICATION_CONFIGURATION_PATH = Rails.root.join("config/application.rb") def install_phlex_rails return if gem_in_bundle? "phlex-rails" gem "phlex-rails" generate "phlex:install" end def autoload_components return unless APPLICATION_CONFIGURATION_PATH.exist? inject_into_class( APPLICATION_CONFIGURATION_PATH, "Application", %( config.autoload_paths << "\#{root}/app/views/forms"\n) ) end def create_application_form template "application_form.rb", Rails.root.join("app/views/forms/application_form.rb") end private def gem_in_bundle?(gem_name) Bundler.load.specs.any? { |spec| spec.name == gem_name } end end
Version data entries
35 entries across 35 versions & 1 rubygems