Class: Bootstrap::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Bootstrap::Generators::InstallGenerator
- Defined in:
- lib/generators/bootstrap/install/install_generator.rb
Instance Method Summary collapse
- #copy_form_builder ⇒ Object
- #copy_lib ⇒ Object
- #create_layout ⇒ Object
- #create_stylesheets ⇒ Object
- #inject_backbone ⇒ Object
Instance Method Details
#copy_form_builder ⇒ Object
16 17 18 |
# File 'lib/generators/bootstrap/install/install_generator.rb', line 16 def copy_form_builder copy_file "form_builders/form_builder/_form.html.#{[:template_engine]}", "lib/templates/#{[:template_engine]}/scaffold/_form.html.#{[:template_engine]}" end |
#copy_lib ⇒ Object
12 13 14 |
# File 'lib/generators/bootstrap/install/install_generator.rb', line 12 def copy_lib directory "lib/templates/#{[:template_engine]}" end |
#create_layout ⇒ Object
20 21 22 |
# File 'lib/generators/bootstrap/install/install_generator.rb', line 20 def create_layout template "layouts/starter.html.#{[:template_engine]}", "app/views/layouts/application.html.#{[:template_engine]}" end |
#create_stylesheets ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/generators/bootstrap/install/install_generator.rb', line 24 def create_stylesheets stylesheet_extension = [:stylesheet_engine] || 'css' copy_file "assets/stylesheets/starter.#{stylesheet_extension}", "app/assets/stylesheets/bootstrap-generators.#{stylesheet_extension}" if [:less, :scss].include?([:stylesheet_engine].to_sym) copy_file "assets/stylesheets/bootstrap-variables.#{stylesheet_extension}", "app/assets/stylesheets/bootstrap-variables.#{stylesheet_extension}" end end |
#inject_backbone ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/generators/bootstrap/install/install_generator.rb', line 34 def inject_backbone application_js_path = "app/assets/javascripts/application.js" if ::File.exists?(::File.join(destination_root, application_js_path)) inject_into_file application_js_path, :before => "//= require_tree" do "//= require bootstrap\n" end end end |