Class: NtiReceiptBuilder::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ActiveRecord::Generators::Migration
Defined in:
lib/generators/nti_receipt_builder/install_generator.rb

Overview

rails generate nti_receipt_builder:install

Instance Method Summary collapse

Instance Method Details

#create_initializerObject



17
18
19
# File 'lib/generators/nti_receipt_builder/install_generator.rb', line 17

def create_initializer
  template 'initializer.rb', 'config/initializers/nti_receipt_builder.rb'
end

#create_migration_fileObject



21
22
23
24
# File 'lib/generators/nti_receipt_builder/install_generator.rb', line 21

def create_migration_file
  migration_template 'create_nti_receipt_templates.rb',
                     'db/migrate/create_nti_receipt_templates.rb'
end

#create_turbo_stream_helpersObject

Only for hosts that do not already extend Turbo::Streams::TagBuilder. A host that already defines open_modal has its own conventions; overwriting them would be wrong.



28
29
30
31
32
33
34
35
# File 'lib/generators/nti_receipt_builder/install_generator.rb', line 28

def create_turbo_stream_helpers
  if turbo_stream_helpers_present?
    say_status :skip, 'config/initializers/turbo_stream_tags.rb (host already defines open_modal)', :yellow
    return
  end

  template 'turbo_stream_tags.rb', 'config/initializers/turbo_stream_tags.rb'
end