Class: Bootsy::Generators::InstallGenerator

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

Overview

Public: A Rails Generator to copy translations, assets and routes to the host app.

Instance Method Summary collapse

Instance Method Details

#add_javascriptObject



17
18
19
20
21
22
23
# File 'lib/generators/bootsy/install_generator.rb', line 17

def add_javascript
  require_asset(
    'app/assets/javascripts/application.js',
    "\n//= require bootsy",
    '//= require jquery_ujs'
  )
end

#add_routesObject



8
9
10
# File 'lib/generators/bootsy/install_generator.rb', line 8

def add_routes
  route "mount Bootsy::Engine => '/bootsy', as: 'bootsy'"
end

#add_stylesheetObject



25
26
27
28
29
30
31
# File 'lib/generators/bootsy/install_generator.rb', line 25

def add_stylesheet
  require_asset(
    'app/assets/stylesheets/application.css',
    "\n *= require bootsy",
    '*= require_self'
  )
end

#copy_configObject



33
34
35
# File 'lib/generators/bootsy/install_generator.rb', line 33

def copy_config
  template 'bootsy.rb', 'config/initializers/bootsy.rb'
end

#copy_localeObject



12
13
14
15
# File 'lib/generators/bootsy/install_generator.rb', line 12

def copy_locale
  copy_file '../../../../config/locales/bootsy.en.yml',
            'config/locales/bootsy.en.yml'
end