Class: Blacklight::LocalePicker::Install

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

Overview

Blacklight::LocalePicker install generator

Instance Method Summary collapse

Instance Method Details

#add_locale_picker_helpersObject



17
18
19
20
21
# File 'lib/generators/blacklight/locale_picker/install_generator.rb', line 17

def add_locale_picker_helpers
  inject_into_file 'app/helpers/application_helper.rb', after: 'module ApplicationHelper' do
    "\n  include Blacklight::LocalePicker::LocaleHelper"
  end
end

#add_locale_picker_to_controllerObject



11
12
13
14
15
# File 'lib/generators/blacklight/locale_picker/install_generator.rb', line 11

def add_locale_picker_to_controller
  inject_into_file 'app/controllers/application_controller.rb', after: 'include Blacklight::Controller' do
    "\n  include Blacklight::LocalePicker::Concern"
  end
end

#install_webpackerObject



23
24
25
26
27
# File 'lib/generators/blacklight/locale_picker/install_generator.rb', line 23

def install_webpacker
  return unless Rails.version.to_i == 6

  rake 'webpacker:install'
end