Class: BootstrapGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_gemsObject



7
8
9
# File 'lib/generators/bootstrap/bootstrap_generator.rb', line 7

def add_gems
  gem 'bootstrap-sass'
end

#create_coffee_manifestObject



20
21
22
# File 'lib/generators/bootstrap/bootstrap_generator.rb', line 20

def create_coffee_manifest
  template 'application.js', "app/assets/javascripts/#{resource_name}.js"
end

#create_layoutObject



24
25
26
27
28
29
30
# File 'lib/generators/bootstrap/bootstrap_generator.rb', line 24

def create_layout
  if options[:haml]
    template 'application.html.haml', "app/views/layouts/#{resource_name}.html.haml"
  else
    template 'application.html.erb', "app/views/layouts/#{resource_name}.html.erb"
  end
end

#create_scss_filesObject



11
12
13
14
# File 'lib/generators/bootstrap/bootstrap_generator.rb', line 11

def create_scss_files
  copy_file '_variables.css.scss', "app/assets/stylesheets/#{resource_name}/_variables.css.scss"
  copy_file '_application.css.scss', "app/assets/stylesheets/#{resource_name}/_#{resource_name}.css.scss"
end

#create_scss_manifestObject



16
17
18
# File 'lib/generators/bootstrap/bootstrap_generator.rb', line 16

def create_scss_manifest
  template 'application.scss', "app/assets/stylesheets/#{resource_name}.scss"
end