Class: ReActionView::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/reactionview/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_initializerObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/generators/reactionview/install_generator.rb', line 13

def create_initializer
  say "Creating ReActionView initializer...", :green

  create_file "config/initializers/reactionview.rb", <<~RUBY
    # frozen_string_literal: true

    ReActionView.configure do |config|
      # Intercept .html.erb templates and process them with `Herb::Engine` for enhanced features
      # config.intercept_erb = true

      # Enable debug mode in development (adds debug attributes to HTML)
      config.debug_mode = Rails.env.development?

      # Path used for editor "open in editor" links (optional, defaults to Rails.root)
      # config.project_path = ENV.fetch('PROJECT_PATH', Rails.root.to_s)

      # Validation mode (:raise, :overlay, or :none) — defaults to :raise in test, :overlay otherwise
      # config.validation_mode = :overlay

      # How to handle templates that come from gems (:fallback, :skip, or :compile), defaults to :fallback
      # config.external_template_mode = :skip

      # Add custom transform visitors to process templates before compilation
      # config.transform_visitors = [
      #   Herb::Visitor::new
      # ]
    end
  RUBY
end

#show_installation_completeObject



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/generators/reactionview/install_generator.rb', line 43

def show_installation_complete
  say "\nReActionView has been successfully installed! šŸŽ‰", :green
  say "\nNext steps:", :blue
  say "  1. Review config/initializers/reactionview.rb"
  say "  2. Enable `config.intercept_erb = true` to process all `*.html.erb` templates using `Herb::Engine`."
  say "  3. Create `*.html.herb` templates for explicit Herb usage."

  say "\nLearn more:", :yellow
  say "  GitHub:  https://github.com/marcoroth/reactionview"
  say "  Website: https://reactionview.dev"

  say "\n✨ Thanks for riding the bleeding edge with Herb 🌿 and ReActionView! šŸš€", :cyan
end