Class: Bootstrap::Generators::InstallGenerator

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) add_coffeescripts



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/generators/bootstrap/install/install_generator.rb', line 23

def add_coffeescripts
  if File.exist?("app/assets/javascripts/application.js.coffee")
    insert_into_file "app/assets/javascripts/application.js.coffee", "//= require twitter/bootstrap\n", :after => "jquery_ujs\n"
  else
    copy_file "application.js.coffee", "app/assets/javascripts/application.js.coffee"
  end

  if File.exist?("app/assets/javascripts/application.js")
    log "Please remove 'app/assets/javascripts/application.js' to make coffee-file work."
  end
end

- (Object) add_stylesheets



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/generators/bootstrap/install/install_generator.rb', line 10

def add_stylesheets
  ext = Rails.application.config.sass.preferred_syntax.to_s
  if File.exist?("app/assets/stylesheets/application.css.#{ext}")
    insert_into_file "app/assets/stylesheets/application.css.#{ext}", %Q{@import "twitter/bootstrap"\n}, :before => "@import"
  else
    copy_file "application.css.#{ext}", "app/assets/stylesheets/application.css.#{ext}"
  end

  if File.exist?("app/assets/stylesheets/application.css")
    log "Please remove 'app/assets/stylesheets/application.css' to make #{ext}-file work."
  end
end