Class: Bootsy::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_assetsObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/generators/bootsy/install_generator.rb', line 14

def add_assets

  [{original: 'app/assets/javascripts/application.js',
    skip_if: 'require bootsy',
    content: "\n//= require bootsy",
    position: {after: '//= require jquery_ujs'}},
   {original: 'app/assets/stylesheets/application.css',
    skip_if: 'require bootsy',
    content: "\n *= require bootsy",
    position: {after: '*= require_self'}}]. each do |params|

    if File.binread(params[:original]).include?(params[:skip_if])
      say_status 'skipped', "insert into #{params[:original]}", :yellow
    else
      insert_into_file params[:original], params[:content], params[:position]
    end
  end

end

#add_routesObject



6
7
8
# File 'lib/generators/bootsy/install_generator.rb', line 6

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

#copy_configObject



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

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

#copy_localeObject



10
11
12
# File 'lib/generators/bootsy/install_generator.rb', line 10

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