Class: Bootstrapped::Generators::InstallGenerator

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

Instance Method Summary collapse

Methods inherited from Base

banner, source_root

Instance Method Details

#add_assetsObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/generators/bootstrapped/install/install_generator.rb', line 10

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

  unless css_engine.eql?('static')        
    if File.exist?('app/assets/stylesheets/application.css')
      style_require_block = " *= require bootstrap_and_overrides\n"
      insert_into_file "app/assets/stylesheets/application.css", style_require_block, :after => "require_self\n"
    else
      copy_file "application.css", "app/assets/stylesheets/application.css"
    end
  else
    style_require_block = " *= require twitter/bootstrap/static/bootstrap\n"
    insert_into_file "app/assets/stylesheets/application.css", style_require_block, :after => "require_self\n"
  end

end

#add_bootstrapObject



39
40
41
42
43
44
# File 'lib/generators/bootstrapped/install/install_generator.rb', line 39

def add_bootstrap
  copy_file "bootstrap.coffee", "app/assets/javascripts/bootstrap.js.coffee"
  unless css_engine.eql?('static')
    copy_file "bootstrap_and_overrides.less", "app/assets/stylesheets/bootstrap_and_overrides.css.less"
  end
end

#add_gemsObject



32
33
34
35
36
37
# File 'lib/generators/bootstrapped/install/install_generator.rb', line 32

def add_gems
  unless css_engine.eql?('static')
    add_gem 'less'
    add_gem 'less-rails'
  end
end