Sha256: 4f630676d4f65fa05ca990631b31b499642d69cc312e55159b5f5b49636e8277
Contents?: true
Size: 854 Bytes
Versions: 15
Compression:
Stored size: 854 Bytes
Contents
# frozen_string_literal: true require "rails/generators" class StimulusReflexGenerator < Rails::Generators::NamedBase source_root File.expand_path("templates", __dir__) def initialize_reflexes copy_reflex_files end def initialize_controllers copy_controller_files end private CONTROLLER_BASE_PATH = "app/javascript/controllers" REFLEX_BASE_PATH = "app/reflexes" def copy_reflex_files template "application_reflex.rb", File.join(REFLEX_BASE_PATH, "application_reflex.rb") template "custom_reflex.rb", File.join(REFLEX_BASE_PATH, "#{name.underscore}_reflex.rb") end def copy_controller_files template "application_controller.js", File.join(CONTROLLER_BASE_PATH, "application_controller.js") template "custom_controller.js", File.join(CONTROLLER_BASE_PATH, "#{name.underscore}_controller.js") end end
Version data entries
15 entries across 15 versions & 1 rubygems