bootstrapped 0.0.6 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. data/.gitignore +1 -0
  2. data/README.rdoc +36 -66
  3. data/Rakefile +10 -0
  4. data/bootstrapped.gemspec +10 -5
  5. data/features/Installation.feature +26 -0
  6. data/features/bootstrap_layout.feature +30 -1
  7. data/features/bootstrap_scaffold.feature +4 -5
  8. data/lib/bootstrapped.rb +5 -1
  9. data/lib/bootstrapped/engine.rb +14 -2
  10. data/lib/bootstrapped/version.rb +1 -1
  11. data/lib/generators/bootstrapped.rb +6 -2
  12. data/lib/generators/bootstrapped/install/install_generator.rb +36 -14
  13. data/lib/generators/bootstrapped/install/templates/application.css +8 -0
  14. data/lib/generators/bootstrapped/install/templates/application.js +10 -0
  15. data/lib/generators/bootstrapped/install/templates/bootstrap.coffee +3 -0
  16. data/lib/generators/bootstrapped/install/templates/bootstrap_and_overrides.less +17 -0
  17. data/lib/generators/bootstrapped/layout/layout_generator.rb +14 -8
  18. data/lib/generators/bootstrapped/layout/templates/layout.html.erb +94 -24
  19. data/lib/generators/bootstrapped/scaffold/scaffold_generator.rb +0 -7
  20. data/lib/generators/bootstrapped/scaffold/templates/views/erb/_form.html.erb +16 -15
  21. data/lib/generators/bootstrapped/scaffold/templates/views/erb/edit.html.erb +1 -14
  22. data/lib/generators/bootstrapped/scaffold/templates/views/erb/index.html.erb +36 -32
  23. data/lib/generators/bootstrapped/scaffold/templates/views/erb/new.html.erb +1 -7
  24. data/lib/generators/bootstrapped/scaffold/templates/views/erb/show.html.erb +4 -6
  25. data/vendor/assets/images/glyphicons-halflings-white.png +0 -0
  26. data/vendor/assets/images/glyphicons-halflings.png +0 -0
  27. data/vendor/assets/javascripts/bootstrap-alert.js +91 -0
  28. data/vendor/assets/javascripts/bootstrap-button.js +98 -0
  29. data/vendor/assets/javascripts/bootstrap-carousel.js +154 -0
  30. data/vendor/assets/javascripts/bootstrap-collapse.js +136 -0
  31. data/vendor/assets/javascripts/bootstrap-dropdown.js +92 -0
  32. data/vendor/assets/javascripts/bootstrap-modal.js +210 -0
  33. data/vendor/assets/javascripts/bootstrap-popover.js +95 -0
  34. data/vendor/assets/javascripts/bootstrap-scrollspy.js +125 -0
  35. data/vendor/assets/javascripts/bootstrap-tab.js +130 -0
  36. data/vendor/assets/javascripts/bootstrap-tooltip.js +270 -0
  37. data/vendor/assets/javascripts/bootstrap-transition.js +51 -0
  38. data/vendor/assets/javascripts/bootstrap-typeahead.js +271 -0
  39. data/vendor/assets/javascripts/modernizr.js +1270 -0
  40. data/vendor/assets/stylesheets/twitter/bootstrap/less/accordion.less +28 -0
  41. data/vendor/assets/stylesheets/twitter/bootstrap/less/alerts.less +70 -0
  42. data/vendor/assets/stylesheets/twitter/bootstrap/less/bootstrap.less +62 -0
  43. data/vendor/assets/stylesheets/twitter/bootstrap/less/bootstrap_base.less +2 -0
  44. data/vendor/assets/stylesheets/twitter/bootstrap/less/breadcrumbs.less +22 -0
  45. data/vendor/assets/stylesheets/twitter/bootstrap/less/button-groups.less +147 -0
  46. data/vendor/assets/stylesheets/twitter/bootstrap/less/buttons.less +165 -0
  47. data/vendor/assets/stylesheets/twitter/bootstrap/less/carousel.less +121 -0
  48. data/vendor/assets/stylesheets/twitter/bootstrap/less/close.less +18 -0
  49. data/vendor/assets/stylesheets/twitter/bootstrap/less/code.less +44 -0
  50. data/vendor/assets/stylesheets/twitter/bootstrap/less/component-animations.less +18 -0
  51. data/vendor/assets/stylesheets/twitter/bootstrap/less/dropdowns.less +131 -0
  52. data/vendor/assets/stylesheets/twitter/bootstrap/less/forms.less +515 -0
  53. data/vendor/assets/stylesheets/twitter/bootstrap/less/grid.less +8 -0
  54. data/vendor/assets/stylesheets/twitter/bootstrap/less/hero-unit.less +20 -0
  55. data/vendor/assets/stylesheets/twitter/bootstrap/less/labels.less +16 -0
  56. data/vendor/assets/stylesheets/twitter/bootstrap/less/layouts.less +17 -0
  57. data/vendor/assets/stylesheets/twitter/bootstrap/less/mixins.less +537 -0
  58. data/vendor/assets/stylesheets/twitter/bootstrap/less/modals.less +72 -0
  59. data/vendor/assets/stylesheets/twitter/bootstrap/less/navbar.less +292 -0
  60. data/vendor/assets/stylesheets/twitter/bootstrap/less/navs.less +344 -0
  61. data/vendor/assets/stylesheets/twitter/bootstrap/less/pager.less +30 -0
  62. data/vendor/assets/stylesheets/twitter/bootstrap/less/pagination.less +55 -0
  63. data/vendor/assets/stylesheets/twitter/bootstrap/less/popovers.less +49 -0
  64. data/vendor/assets/stylesheets/twitter/bootstrap/less/progress-bars.less +95 -0
  65. data/vendor/{framework → assets/stylesheets/twitter/bootstrap/less}/reset.less +37 -52
  66. data/vendor/assets/stylesheets/twitter/bootstrap/less/responsive.less +323 -0
  67. data/vendor/assets/stylesheets/twitter/bootstrap/less/scaffolding.less +29 -0
  68. data/vendor/assets/stylesheets/twitter/bootstrap/less/sprites.less +156 -0
  69. data/vendor/assets/stylesheets/twitter/bootstrap/less/tables.less +139 -0
  70. data/vendor/assets/stylesheets/twitter/bootstrap/less/thumbnails.less +35 -0
  71. data/vendor/assets/stylesheets/twitter/bootstrap/less/tooltip.less +35 -0
  72. data/vendor/assets/stylesheets/twitter/bootstrap/less/type.less +217 -0
  73. data/vendor/assets/stylesheets/twitter/bootstrap/less/utilities.less +23 -0
  74. data/vendor/assets/stylesheets/twitter/bootstrap/less/variables.less +99 -0
  75. data/vendor/assets/stylesheets/twitter/bootstrap/less/wells.less +17 -0
  76. data/vendor/assets/stylesheets/twitter/bootstrap/static/bootstrap.css +3496 -0
  77. metadata +114 -68
  78. data/Gemfile.lock +0 -133
  79. data/lib/generators/bootstrapped/install/templates/bootstrap.less +0 -26
  80. data/lib/generators/bootstrapped/install/templates/forms.less +0 -479
  81. data/lib/generators/bootstrapped/install/templates/mixins.less +0 -222
  82. data/lib/generators/bootstrapped/install/templates/patterns.less +0 -1060
  83. data/lib/generators/bootstrapped/install/templates/reset.less +0 -141
  84. data/lib/generators/bootstrapped/install/templates/scaffolding.less +0 -137
  85. data/lib/generators/bootstrapped/install/templates/tables.less +0 -224
  86. data/lib/generators/bootstrapped/install/templates/type.less +0 -187
  87. data/lib/generators/bootstrapped/install/templates/variables.less +0 -60
  88. data/lib/generators/bootstrapped/scaffold/templates/tests/shoulda/actions/create.rb +0 -13
  89. data/lib/generators/bootstrapped/scaffold/templates/tests/shoulda/actions/destroy.rb +0 -8
  90. data/lib/generators/bootstrapped/scaffold/templates/tests/shoulda/actions/edit.rb +0 -6
  91. data/lib/generators/bootstrapped/scaffold/templates/tests/shoulda/actions/index.rb +0 -6
  92. data/lib/generators/bootstrapped/scaffold/templates/tests/shoulda/actions/new.rb +0 -6
  93. data/lib/generators/bootstrapped/scaffold/templates/tests/shoulda/actions/show.rb +0 -6
  94. data/lib/generators/bootstrapped/scaffold/templates/tests/shoulda/actions/update.rb +0 -13
  95. data/lib/generators/bootstrapped/scaffold/templates/tests/shoulda/controller.rb +0 -5
  96. data/lib/generators/bootstrapped/scaffold/templates/tests/shoulda/model.rb +0 -7
  97. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-alerts.js +0 -113
  98. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-buttons.js +0 -62
  99. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +0 -55
  100. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +0 -260
  101. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +0 -90
  102. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +0 -107
  103. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tabs.js +0 -80
  104. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-twipsy.js +0 -321
  105. data/vendor/assets/stylesheets/twitter/bootstrap/bootstrap.css +0 -2467
  106. data/vendor/framework/bootstrap.less +0 -26
  107. data/vendor/framework/forms.less +0 -479
  108. data/vendor/framework/mixins.less +0 -222
  109. data/vendor/framework/patterns.less +0 -1060
  110. data/vendor/framework/scaffolding.less +0 -137
  111. data/vendor/framework/tables.less +0 -224
  112. data/vendor/framework/type.less +0 -187
  113. data/vendor/framework/variables.less +0 -60
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  *.gem
3
3
  .bundle
4
4
  pkg/*
5
+ tmp/*
@@ -1,101 +1,71 @@
1
1
  = Bootstrapped
2
2
 
3
- A gem containing Twitter's Bootstrap CSS Project, a JQuery Plugin to simply user interface interactivity, and generators to make scaffolds sexy.
3
+ Bootstrapped is a gem that helps you quickly integrate Twitter's Bootstrap in to your project to enable you to build user interfaces rapidly.
4
4
 
5
- In addition, it as generators based off of Ryan Bates nifty-generators https://github.com/ryanb/nifty-generators/. enables you to create fully styled user interfaces using Bootstrap CSS with very little effort. There is one difference though, HAML generators are not included.
5
+ Bootstrapped also contains generators based off of Ryan Bates's nifty-generators https://github.com/ryanb/nifty-generators/ to help you rapidly scaffold. Unlike generators nifty-generators, Bootstrapped generators do not support HAML.
6
6
 
7
7
  == Setup
8
8
 
9
- === Rails 3
9
+ Bootstrapped was specifically developed for Rails 3 and above applications. To install, include bootstrapped in your Gemfile.
10
10
 
11
- Add the gem to your Gemfile.
11
+ gem "bootstrapped", :git => 'https://github.com/entropillc/bootstrapped.git'
12
12
 
13
- gem "bootstrapped"
13
+ After running bundle install to install the gem, you need to run the bootstrapped install generator. The generator gives you the ability to install Bootstrapped with Less support or plain CSS. The default is Less support * NOTE: If you are using JRuby, you must use the static version at this time due to compatibility issues with the less.rb gem.
14
14
 
15
- Add the following to the application.css in the Rails 3.1 pipeline pipeline
15
+ rails g bootstrapped:install [less or static]
16
+
17
+ To install with Less Support
18
+
19
+ rails g bootstrapped:install
16
20
 
17
- *= require bootstrap
18
-
19
- Include any of the BootStrap JavaScript files as necessary
21
+ To install with static CSS Support
20
22
 
21
- //= require bootstrap-alerts
22
- //= require bootstrap-dropdown
23
- //= require bootstrap-modal
24
- //= require bootstrap-popover
25
- //= require bootstrap-scrollspy
26
- //= require bootstrap-tabs
27
- //= require bootstrap-twipsy
28
- //= require jquery.tablesorter
29
-
30
- The Table Sorter JQuery plugin (jquery.tablesorter, not included) is only required if you want tables that allow you to order on the column headings.
31
-
32
- Then you can run any of the included generators.
33
-
34
- rails g bootstrapped:scaffold Recipe name:string index new
23
+ rails g bootstrapped:install static
35
24
 
36
25
  == Included Generators
37
26
 
27
+ Bootstrapped contains layout and scaffold generators that have been modified to output HTML in Twitter Bootstrap markup. Currently, the following generators are implemented.
28
+
38
29
  * bootstrapped:layout: generates generic layout, stylesheet, and helper files.
39
30
  * bootstrapped:scaffold: generates a controller and optional model/migration.
40
31
 
41
- To view the README for each generator, run it with the +help+ option.
42
-
43
- rails g bootstrapped:layout --help
44
-
45
- == Troubleshooting and FAQs
46
-
47
- <b>What is the difference between bootstrapped:scaffold and built-in scaffold?</b>
48
-
49
- One of the primary differences is that bootstrapped:scaffold allows you to choose which controller actions to generate.
50
-
51
- rails g bootstrapped:scaffold post name:string index new edit
52
-
53
- There are a few changes to the generated code as well, such as no XML format by default.
54
-
55
- It also offers support for Shoulda, and RSpec.
56
-
57
-
58
- <b>I get "undefined method 'title'" error.</b>
32
+ === The Layout Generator
59
33
 
60
- Try running bootstrapped:layout, that will generate this helper method. Or you can just change the templates to whatever approach you prefer for setting the title.
34
+ The layout generator allows you to quickly generate a fixed Twitter Bootstrap layout by running the following command:
61
35
 
36
+ rails g bootstrapped:layout
37
+
38
+ You can change the name of the layout by specifying the layout name. For example, the following command will generate a layout called photos
62
39
 
63
- <b>I can't set new attributes in my model.</b>
40
+ rails g bootstrapped:layout photos
41
+
42
+ You can also specify if you want a fixed for fluid layout. If you choose to specify the layout, you must specify the layout name as well. The options are fluid and fixed
64
43
 
65
- Add the attribute to the attr_accessible line in the model.
44
+ rails g boostrapped:layout [layout_name] [fixed or fluid]
66
45
 
46
+ An example command:
67
47
 
68
- <b>I get "undefined method 'root_url'" error.</b>
48
+ rails g bootstrapped:layout application fluid
69
49
 
70
- Some generators default redirecting to the root_url. Set this in your routes.rb file like this (substituting your controller name).
50
+ === The Scaffold Generator
71
51
 
72
- root :to => "home#index"
52
+ The layout generator allows you to quickly scaffold applications.
73
53
 
74
54
 
75
- <b>I get a missing database error.</b>
55
+ == Tests
76
56
 
77
- Run <tt>rake db:migrate</tt>.
57
+ Bootstrapped has been tested using Cucumber. To run the tests, run the following command
78
58
 
79
-
80
- <b>I get a routing error when I try to submit a form.</b>
81
-
82
- Try restarting your development server. Sometimes it doesn't detect the change in the routing.
83
-
84
-
85
- <b>The tests/specs don't work.</b>
86
-
87
- Make sure you have mocha installed and require it in your spec/test helper.
88
-
89
- gem install mocha
90
-
91
- # in spec_helper.rb
92
- config.mock_with :mocha
93
-
94
- # in test_helper.rb
95
- require 'mocha'
59
+ cucumber
96
60
 
97
61
  == Found a bug?
98
62
 
99
63
  If you are having a problem with Bootstrapped, first look at the FAQs above. If you still cannot resolve it, please submit an issue here.
100
64
 
101
65
  http://github.com/entropillc/bootstrapped/issues
66
+
67
+ == License
68
+
69
+ Copyright 2011 Entropi Software, LLC.
70
+
71
+ Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
data/Rakefile CHANGED
@@ -1 +1,11 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rubygems'
3
+ require 'rake'
4
+ require 'cucumber'
5
+ require 'cucumber/rake/task'
6
+
7
+ Cucumber::Rake::Task.new(:features) do |t|
8
+ t.cucumber_opts = "features --format progress"
9
+ end
10
+
11
+ task :default => :features
@@ -4,19 +4,24 @@ require "bootstrapped/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "bootstrapped"
7
- s.version = Bootstrapped::VERSION
7
+ s.version ='0.9.0'
8
8
  s.authors = ["Nicholas Watson"]
9
9
  s.email = ["nwwatson@gmail.com"]
10
- s.homepage = ""
10
+ s.homepage = "http://github.com/entropillc/bootstrapped"
11
11
  s.summary = %q{Twitters Bootstrap CSS in a gem}
12
12
  s.description = %q{Twitters Bootstrap CSS and JS files all in one nice little gem}
13
13
 
14
14
  s.rubyforge_project = "bootstrapped"
15
+ s.files = Dir["lib/**/*"] + Dir["vendor/**/*"] + ["Rakefile", "README.rdoc"]
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.require_paths = ["lib"]
15
18
 
16
- s.add_dependency "railties", "~> 3.1"
17
- s.add_dependency "thor", "~> 0.14"
18
- s.add_runtime_dependency "less-rails", "~> 2.1.0"
19
+ s.add_dependency 'railties', '>= 3.1'
20
+ s.add_dependency 'actionpack', '>= 3.1'
21
+ s.add_dependency 'less-rails' unless RUBY_PLATFORM == 'java'
22
+ s.add_development_dependency 'rails', '>= 3.1'
19
23
  s.add_development_dependency 'rspec-rails', '~> 2.6.1'
24
+ s.add_development_dependency 'mocha', '~> 0.9.12'
20
25
  s.add_development_dependency 'cucumber', '~> 1.0.6'
21
26
  s.add_development_dependency "bundler", "~> 1.0.0"
22
27
  s.add_development_dependency "rails", "~> 3.1"
@@ -0,0 +1,26 @@
1
+ Feature: Bootstrapped Installation Generator
2
+ In order to install Bootstrapped
3
+ As a rails developer
4
+ I want to install Bootstrapped
5
+
6
+ Scenario: Generate Installation with LESS CSS support
7
+ Given a new Rails app
8
+ When I run "rails g bootstrapped:install"
9
+ Then I should see the following files
10
+ | app/assets/javascripts/application.js |
11
+ | app/assets/stylesheets/application.css |
12
+ | app/assets/javascripts/bootstrap.js.coffee |
13
+ | app/assets/stylesheets/bootstrap_and_overrides.css.less |
14
+ And I should see "//= require bootstrap" in file "app/assets/javascripts/application.js"
15
+ And I should not see "*= require twitter/bootstrap/static/bootstrap" in file "app/assets/stylesheets/application.css"
16
+
17
+ Scenario: Generate Installation with Static CSS Files
18
+ Given a new Rails app
19
+ When I run "rails g bootstrapped:install static"
20
+ Then I should see the following files
21
+ | app/assets/javascripts/application.js |
22
+ | app/assets/stylesheets/application.css |
23
+ And I should see "//= require bootstrap" in file "app/assets/javascripts/application.js"
24
+ And I should see "*= require twitter/bootstrap/static/bootstrap" in file "app/assets/stylesheets/application.css"
25
+ And I should not see "*= bootstrap_and_overrides" in file "app/assets/stylesheets/application.css"
26
+
@@ -7,7 +7,36 @@ Feature: Bootstrapped Layout Generator
7
7
  Given a new Rails app
8
8
  When I run "rails g bootstrapped:layout -f"
9
9
  Then I should see "stylesheet_link_tag "application"" in file "app/views/layouts/application.html.erb"
10
- Then I should see "h(page_title" in file "app/helpers/layout_helper.rb"
10
+ And I should see "h(page_title" in file "app/helpers/layout_helper.rb"
11
+ And I should see file "app/helpers/layout_helper.rb"
12
+ And I should see file "app/helpers/error_messages_helper.rb"
13
+ And I should see file "app/views/share/_flash.html.erb"
14
+
15
+ Scenario: Generate application layout with the name photos
16
+ Given a new Rails app
17
+ When I run "rails g bootstrapped:layout photos -f"
18
+ Then I should see "stylesheet_link_tag "application"" in file "app/views/layouts/photos.html.erb"
19
+ And I should see "h(page_title" in file "app/helpers/layout_helper.rb"
20
+ And I should see file "app/helpers/layout_helper.rb"
21
+ And I should see file "app/helpers/error_messages_helper.rb"
22
+ And I should see file "app/views/share/_flash.html.erb"
23
+
24
+ Scenario: Generate application layout with fixed layout
25
+ Given a new Rails app
26
+ When I run "rails g bootstrapped:layout application fixed -f"
27
+ Then I should see "stylesheet_link_tag "application"" in file "app/views/layouts/application.html.erb"
28
+ And I should see "h(page_title" in file "app/helpers/layout_helper.rb"
29
+ And I should not see "container-fluid" in file "app/views/layouts/application.html.erb"
30
+ And I should see file "app/helpers/layout_helper.rb"
31
+ And I should see file "app/helpers/error_messages_helper.rb"
32
+ And I should see file "app/views/share/_flash.html.erb"
33
+
34
+ Scenario: Generate application layout with fluid layout
35
+ Given a new Rails app
36
+ When I run "rails g bootstrapped:layout application fluid -f"
37
+ Then I should see "stylesheet_link_tag "application"" in file "app/views/layouts/application.html.erb"
38
+ And I should see "h(page_title" in file "app/helpers/layout_helper.rb"
39
+ And I should see "container-fluid" in file "app/views/layouts/application.html.erb"
11
40
  And I should see file "app/helpers/layout_helper.rb"
12
41
  And I should see file "app/helpers/error_messages_helper.rb"
13
42
  And I should see file "app/views/share/_flash.html.erb"
@@ -16,11 +16,10 @@ Feature: Bootstrapped Scaffold Generator
16
16
  | app/views/projects/edit.html.erb |
17
17
  | db/migrate |
18
18
  And I should see "resources :projects" in file "config/routes.rb"
19
- And I should see "gem "mocha", :group => :test" in file "Gemfile"
20
19
  When I run "rails g bootstrapped:layout -f"
21
20
  And I run "rake db:migrate"
22
21
  And I should successfully run "rails g bootstrapped:scaffold Project -f"
23
- Then I should successfully run "rake test"
22
+ #Then I should successfully run "rake test"
24
23
 
25
24
  Scenario: Generate scaffold with rspec tests
26
25
  Given a new Rails app
@@ -61,7 +60,7 @@ Feature: Bootstrapped Scaffold Generator
61
60
  When I run "rails g bootstrapped:layout -f"
62
61
  And I run "rake db:migrate"
63
62
  And I should successfully run "rails g bootstrapped:scaffold Admin::User -f"
64
- Then I should successfully run "rake test"
63
+ #Then I should successfully run "rake test"
65
64
 
66
65
  Scenario: Generate scaffold with a namespaced model
67
66
  Given a new Rails app
@@ -71,10 +70,10 @@ Feature: Bootstrapped Scaffold Generator
71
70
  When I run "rails g bootstrapped:layout -f"
72
71
  And I run "rake db:migrate"
73
72
  And I should successfully run "rails g bootstrapped:scaffold Admin::User -f --namespace_model"
74
- Then I should successfully run "rake test"
73
+ #Then I should successfully run "rake test"
75
74
 
76
75
  Scenario: Given scaffold with a new and index action
77
76
  Given a new Rails app
78
77
  When I run "rails g bootstrapped:scaffold Project name:string index new"
79
78
  Then I should see "class Project" in file "app/models/project.rb"
80
- And I should see "<%= form_for @project do |f| %>" in file "app/views/projects/new.html.erb"
79
+ And I should see "<%= render :partial => 'form', :locals => { :form_action_title => 'New' } %>" in file "app/views/projects/new.html.erb"
@@ -1,4 +1,8 @@
1
- require 'less-rails'
1
+ unless RUBY_PLATFORM.eql?('java')
2
+ require 'less'
3
+ require 'less-rails'
4
+ end
5
+
2
6
  require 'bootstrapped/version'
3
7
  require 'bootstrapped/engine'
4
8
 
@@ -1,7 +1,19 @@
1
+ require 'rails'
2
+
1
3
  module Bootstrapped
2
4
  class Engine < ::Rails::Engine
3
- initializer 'bootstrapped-less.setup', :after => 'less-rails.after.load_config_initializers', :group => :all do |app|
4
- app.config.less.paths << File.join(app.root, 'app', 'assets', 'stylesheets','bootstrap','less')
5
+ unless RUBY_PLATFORM.eql?('java')
6
+ initializer 'bootstrapped.setup',
7
+ :after => 'less-rails.after.load_config_initializers',
8
+ :group => :all do |app|
9
+ app.config.less.paths << File.join(config.root, 'vendor', 'less')
10
+ end
5
11
  end
12
+
13
+ #initializer 'bootstrapped-less.setup', :after => 'less-rails.after.load_config_initializers', :group => :all do |app|
14
+ # app.config.less.paths << File.join(app.root, 'app', 'assets', 'stylesheets','bootstrap','less')
15
+ #end
16
+
17
+
6
18
  end
7
19
  end
@@ -1,3 +1,3 @@
1
1
  module Bootstrapped
2
- VERSION = "0.0.6"
2
+ #VERSION = "0.9.0"
3
3
  end
@@ -4,7 +4,7 @@ module Bootstrapped
4
4
  module Generators
5
5
  class Base < ::Rails::Generators::Base
6
6
  def self.source_root
7
- @_bootstrapped_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'bootstrapped', generator_name, 'templates'))
7
+ @source ||= File.expand_path(File.join(File.dirname(__FILE__), 'bootstrapped', generator_name, 'templates'))
8
8
  end
9
9
 
10
10
  def self.banner
@@ -18,7 +18,11 @@ module Bootstrapped
18
18
  File.open(destination_path("Gemfile"), 'a') { |f| f.write("\n") } unless gemfile_content =~ /\n\Z/
19
19
  gem name, options unless gemfile_content.include? name
20
20
  end
21
-
21
+
22
+ def destination_path(path)
23
+ File.join(destination_root, path)
24
+ end
25
+
22
26
  def print_usage
23
27
  self.class.help(Thor::Base.shell.new)
24
28
  exit
@@ -1,26 +1,48 @@
1
+ require 'rails/generators/base'
1
2
  require 'generators/bootstrapped'
2
3
 
3
4
  module Bootstrapped
4
5
  module Generators
5
- class InstallGenerator < Base
6
- argument :less, :type => :string, :default => true, :banner => 'less'
6
+ class InstallGenerator < ::Bootstrapped::Generators::Base
7
+ desc "This generator installs Twitter Bootstrap to Asset Pipeline"
8
+ argument :css_engine, :type => :string, :default => 'less'
7
9
 
8
- def self.source_root
9
- @source_root ||= File.expand_path("../../../../../vendor/framework", __FILE__)
10
+ def add_assets
11
+
12
+ if File.exist?('app/assets/javascripts/application.js')
13
+ insert_into_file "app/assets/javascripts/application.js", "//= require bootstrap\n", :after => "jquery_ujs\n"
14
+ else
15
+ copy_file "application.js", "app/assets/javascripts/application.js"
16
+ end
17
+
18
+ unless css_engine.eql?('static')
19
+ if File.exist?('app/assets/stylesheets/application.css')
20
+ style_require_block = " *= require bootstrap_and_overrides\n"
21
+ insert_into_file "app/assets/stylesheets/application.css", style_require_block, :after => "require_self\n"
22
+ else
23
+ copy_file "application.css", "app/assets/stylesheets/application.css"
24
+ end
25
+ else
26
+ style_require_block = " *= require twitter/bootstrap/static/bootstrap\n"
27
+ insert_into_file "app/assets/stylesheets/application.css", style_require_block, :after => "require_self\n"
28
+ end
29
+
10
30
  end
11
31
 
12
- def copy_less_files
13
- copy_file 'bootstrap.less', "app/assets/stylesheets/bootstrap/less/bootstrap.less"
14
- copy_file 'forms.less', "app/assets/stylesheets/bootstrap/less/forms.less"
15
- copy_file 'mixins.less', "app/assets/stylesheets/bootstrap/less/mixins.less"
16
- copy_file 'patterns.less', "app/assets/stylesheets/bootstrap/less/patterns.less"
17
- copy_file 'reset.less', "app/assets/stylesheets/bootstrap/less/reset.less"
18
- copy_file 'scaffolding.less', "app/assets/stylesheets/bootstrap/less/scaffolding.less"
19
- copy_file 'tables.less', "app/assets/stylesheets/bootstrap/less/tables.less"
20
- copy_file 'type.less', "app/assets/stylesheets/bootstrap/less/type.less"
21
- copy_file 'variables.less', "app/assets/stylesheets/bootstrap/less/variables.less"
32
+ def add_gems
33
+ unless css_engine.eql?('static')
34
+ add_gem 'less'
35
+ add_gem 'less-rails'
36
+ end
22
37
  end
23
38
 
39
+ def add_bootstrap
40
+ copy_file "bootstrap.coffee", "app/assets/javascripts/bootstrap.js.coffee"
41
+ unless css_engine.eql?('static')
42
+ copy_file "bootstrap_and_overrides.less", "app/assets/stylesheets/bootstrap_and_overrides.css.less"
43
+ end
44
+ end
45
+
24
46
  end
25
47
  end
26
48
  end
@@ -0,0 +1,8 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *= require_self
6
+ *= require bootstrap_and_overrides
7
+ *= require_tree .
8
+ */
@@ -0,0 +1,10 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require jquery_ujs
9
+ //= require twitter/bootstrap
10
+ //= require_tree .
@@ -0,0 +1,3 @@
1
+ jQuery ->
2
+ $("a[rel=popover]").popover()
3
+ $('.tooltip, a[rel="tooltip"]').tooltip()
@@ -0,0 +1,17 @@
1
+ @import "twitter/bootstrap/less/bootstrap";
2
+ @import "twitter/bootstrap/less/responsive";
3
+
4
+ // Set the correct sprite paths
5
+ @iconSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings.png');
6
+ @iconWhiteSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings-white.png');
7
+
8
+ // Your custom LESS stylesheets goes here
9
+ //
10
+ // Since bootstrap was imported above you have access to its mixins which
11
+ // you may use and inherit here
12
+ //
13
+ // If you'd like to override bootstrap's own variables, you can do so here as well
14
+ // See http://twitter.github.com/bootstrap/less.html for their names and documentation
15
+ //
16
+ // Example:
17
+ // @linkColor: #ff0000;