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



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

def add_assets

  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



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

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



27
28
29
30
31
32
# File 'lib/generators/bootstrapped/install/install_generator.rb', line 27

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

#add_javascriptObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/generators/bootstrapped/install/install_generator.rb', line 41

def add_javascript
  if options.javascripts?
    insert_into_file "app/assets/javascripts/application.js","//= require bootstrap-transition.js\n", :before => "//= require_tree ."
    insert_into_file "app/assets/javascripts/application.js","//= require bootstrap-alert.js\n", :before => "//= require_tree ."
    insert_into_file "app/assets/javascripts/application.js","//= require bootstrap-modal.js\n", :before => "//= require_tree ."
    insert_into_file "app/assets/javascripts/application.js","//= require bootstrap-dropdown.js\n", :before => "//= require_tree ."
    insert_into_file "app/assets/javascripts/application.js","//= require bootstrap-scrollspy.js\n", :before => "//= require_tree ."
    insert_into_file "app/assets/javascripts/application.js","//= require bootstrap-tab.js\n", :before => "//= require_tree ."
    insert_into_file "app/assets/javascripts/application.js","//= require bootstrap-tooltip.js\n", :before => "//= require_tree ."
    insert_into_file "app/assets/javascripts/application.js","//= require bootstrap-popover.js\n", :before => "//= require_tree ."
    insert_into_file "app/assets/javascripts/application.js","//= require bootstrap-button.js\n", :before => "//= require_tree ."
    insert_into_file "app/assets/javascripts/application.js","//= require bootstrap-collapse.js\n", :before => "//= require_tree ."
    insert_into_file "app/assets/javascripts/application.js","//= require bootstrap-carousel.js\n", :before => "//= require_tree ."
    insert_into_file "app/assets/javascripts/application.js","//= require bootstrap-typeahead.js\n", :before => "//= require_tree ."
    insert_into_file "app/assets/javascripts/application.js", "//= require bootstrap\n", :before => "//= require_tree ."
  end
end