bootstrap-sass-rails 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. data/LICENSE +14 -0
  2. data/README.md +109 -0
  3. data/Rakefile +37 -0
  4. data/lib/bootstrap-sass-rails.rb +8 -0
  5. data/lib/bootstrap/sass/rails.rb +2 -0
  6. data/lib/bootstrap/sass/rails/engine.rb +9 -0
  7. data/lib/bootstrap/sass/rails/version.rb +7 -0
  8. data/test/cases/usage_css_spec.rb +70 -0
  9. data/test/cases/usage_js_spec.rb +35 -0
  10. data/test/dummy/Rakefile +7 -0
  11. data/test/dummy/app/assets/javascripts/application.js +3 -0
  12. data/test/dummy/app/assets/javascripts/individual.js +1 -0
  13. data/test/dummy/app/assets/stylesheets/application.css.scss +3 -0
  14. data/test/dummy/app/assets/stylesheets/individual.css.scss +10 -0
  15. data/test/dummy/app/assets/stylesheets/sprockets.css +3 -0
  16. data/test/dummy/app/controllers/application_controller.rb +3 -0
  17. data/test/dummy/app/helpers/application_helper.rb +2 -0
  18. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  19. data/test/dummy/config.ru +4 -0
  20. data/test/dummy/config/application.rb +49 -0
  21. data/test/dummy/config/boot.rb +10 -0
  22. data/test/dummy/config/database.yml +25 -0
  23. data/test/dummy/config/environment.rb +5 -0
  24. data/test/dummy/config/environments/development.rb +30 -0
  25. data/test/dummy/config/environments/production.rb +60 -0
  26. data/test/dummy/config/environments/test.rb +39 -0
  27. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  28. data/test/dummy/config/initializers/inflections.rb +10 -0
  29. data/test/dummy/config/initializers/mime_types.rb +5 -0
  30. data/test/dummy/config/initializers/secret_token.rb +7 -0
  31. data/test/dummy/config/initializers/session_store.rb +8 -0
  32. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  33. data/test/dummy/config/locales/en.yml +5 -0
  34. data/test/dummy/config/routes.rb +58 -0
  35. data/test/dummy/log/test.log +462 -0
  36. data/test/dummy/public/404.html +26 -0
  37. data/test/dummy/public/422.html +26 -0
  38. data/test/dummy/public/500.html +26 -0
  39. data/test/dummy/public/favicon.ico +0 -0
  40. data/test/dummy/script/rails +6 -0
  41. data/test/dummy/tmp/cache/assets/C29/E80/sprockets%2F8f076727207424919c7170c7157bbe37 +1102 -0
  42. data/test/dummy/tmp/cache/assets/D3F/FA0/sprockets%2F22c8366fdbaaa2872b202dfe7376629f +0 -0
  43. data/test/dummy/tmp/cache/assets/E5F/300/sprockets%2F243a2fff0dbb8aeec3dd579b4ff7c81b +1048 -0
  44. data/test/dummy/tmp/cache/sass/367107abe8cc7204b7df467455e0644864892d9f/_forms.scssc +0 -0
  45. data/test/dummy/tmp/cache/sass/367107abe8cc7204b7df467455e0644864892d9f/_mixins.scssc +0 -0
  46. data/test/dummy/tmp/cache/sass/367107abe8cc7204b7df467455e0644864892d9f/_patterns.scssc +0 -0
  47. data/test/dummy/tmp/cache/sass/367107abe8cc7204b7df467455e0644864892d9f/_reset.scssc +0 -0
  48. data/test/dummy/tmp/cache/sass/367107abe8cc7204b7df467455e0644864892d9f/_scaffolding.scssc +0 -0
  49. data/test/dummy/tmp/cache/sass/367107abe8cc7204b7df467455e0644864892d9f/_tables.scssc +0 -0
  50. data/test/dummy/tmp/cache/sass/367107abe8cc7204b7df467455e0644864892d9f/_type.scssc +0 -0
  51. data/test/dummy/tmp/cache/sass/367107abe8cc7204b7df467455e0644864892d9f/_variables.scssc +0 -0
  52. data/test/dummy/tmp/cache/sass/766526f7d87ffdf0401dde0ec8d49f976470392d/_bootstrap.scssc +0 -0
  53. data/test/dummy/tmp/cache/sass/766526f7d87ffdf0401dde0ec8d49f976470392d/bootstrap.css.scssc +0 -0
  54. data/test/dummy/tmp/cache/sass/766526f7d87ffdf0401dde0ec8d49f976470392d/bootstrap.cssc +0 -0
  55. data/test/dummy/tmp/cache/sass/8f44dddc3cc4868f43c2a4153ce3876663527256/_bootstrap.scssc +0 -0
  56. data/test/dummy/tmp/cache/sass/8f44dddc3cc4868f43c2a4153ce3876663527256/bootstrap.css.scssc +0 -0
  57. data/test/dummy/tmp/cache/sass/95eca8acb76bbb914a4c6988012b73e61e9bcc23/application.css.scssc +0 -0
  58. data/test/dummy/tmp/cache/sass/95eca8acb76bbb914a4c6988012b73e61e9bcc23/individual.css.scssc +0 -0
  59. data/test/dummy/tmp/cache/sass/cd2e949d41af4ab87fc8c5c6e94e4e802032bd18/_forms.scssc +0 -0
  60. data/test/dummy/tmp/cache/sass/cd2e949d41af4ab87fc8c5c6e94e4e802032bd18/_mixins.scssc +0 -0
  61. data/test/dummy/tmp/cache/sass/cd2e949d41af4ab87fc8c5c6e94e4e802032bd18/_patterns.scssc +0 -0
  62. data/test/dummy/tmp/cache/sass/cd2e949d41af4ab87fc8c5c6e94e4e802032bd18/_reset.scssc +0 -0
  63. data/test/dummy/tmp/cache/sass/cd2e949d41af4ab87fc8c5c6e94e4e802032bd18/_scaffolding.scssc +0 -0
  64. data/test/dummy/tmp/cache/sass/cd2e949d41af4ab87fc8c5c6e94e4e802032bd18/_tables.scssc +0 -0
  65. data/test/dummy/tmp/cache/sass/cd2e949d41af4ab87fc8c5c6e94e4e802032bd18/_type.scssc +0 -0
  66. data/test/dummy/tmp/cache/sass/cd2e949d41af4ab87fc8c5c6e94e4e802032bd18/_variables.scssc +0 -0
  67. data/test/dummy/tmp/cache/sass/cd2e949d41af4ab87fc8c5c6e94e4e802032bd18/mixins.scssc +0 -0
  68. data/test/dummy/tmp/cache/sass/cd2e949d41af4ab87fc8c5c6e94e4e802032bd18/variables.css.scssc +0 -0
  69. data/test/spec_helper.rb +13 -0
  70. data/test/support/helpers.rb +35 -0
  71. metadata +220 -0
data/LICENSE ADDED
@@ -0,0 +1,14 @@
1
+ Copyright 2011 Morton Jonuschat
2
+ Twitter Bootstrap Copyright 2011 Twitter, Inc.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,109 @@
1
+ # Bootstrap::Sass::Rails
2
+
3
+ Bootstrap is Twitter's toolkit for kickstarting CSS for websites, apps, and more.
4
+ It includes base CSS styles for typography, forms, buttons, tables, grids, navigation, alerts, and more.
5
+
6
+ Twitter Bootstrap has been converted to Sass which makes it possible to use the default Rails Asset Pipeline
7
+
8
+ * All assets have been namespaced within twitter/bootstrap to avoid naming conflicts
9
+ * Top level requires for sprockets to get the complete bundle with a
10
+ simple = require twitter/bootstrap
11
+ * Ability to import individually namespaced stylesheets or javascripts.
12
+
13
+ ## Usage
14
+
15
+ ### Stylesheets
16
+
17
+ The easiest way to use Twitter Bootstrap is to require it in your `application.css` file.
18
+
19
+ ```css
20
+ /*
21
+ *= require twitter/bootstrap
22
+ */
23
+
24
+ #example {
25
+ /* Your styles... */
26
+ }
27
+ ```
28
+
29
+ If you need access to the variables within the Twitter Bootstrap framework or want to use the mixins you
30
+ will need to import it within an `.css.scss` file. This will still include the complete framework.
31
+
32
+ ```css
33
+ @import "twitter/bootstrap";
34
+
35
+ #foo {
36
+ @include border-radius(4px);
37
+ }
38
+ ```
39
+
40
+ Using only parts of the framework like variables and mixin you can import all of these individually from
41
+ within `.css.scss` files.
42
+
43
+ ```css
44
+ @import "twitter/bootstrap/variables";
45
+ @import "twitter/bootstrap/mixins";
46
+
47
+ @mixin myButton($radius: 5px) {
48
+ @include border-radius($radius);
49
+ }
50
+
51
+ #foo {
52
+ @include myButton(10px);
53
+ }
54
+ ```
55
+
56
+ ### Javascripts
57
+
58
+ Using the JavaScript works the same way. You can include them all with a
59
+ single require directive from your `application.js`.
60
+
61
+ ```javascript
62
+ //= require twitter/bootstrap
63
+
64
+ $(document).ready(function(){
65
+ });
66
+ ```
67
+
68
+ If you only want a part of the javascripts require the individual files
69
+ from your `.js` file.
70
+
71
+ ```javascript
72
+ //= require twitter/bootstrap/modal
73
+
74
+ $(document).ready(function(){
75
+ });
76
+ ```
77
+
78
+ ## Versioning
79
+
80
+ This gem will directly track the semantic versioning releases of the Twitter Bootstrap project.
81
+ If it should be necessary a build number will be added to the version to
82
+ mark releases specific to this gem.
83
+
84
+ ## Note on Patches / Pull Requests
85
+
86
+ * Fork the project.
87
+ * Make your feature addition or bug fix.
88
+ * Add tests for it. This is important so I don't break it in a future version unintentionally.
89
+ * Commit, do not mess with rakefile, version, or history.
90
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
91
+ * Send me a pull request. Bonus points for topic branches.
92
+
93
+ ## Credits
94
+
95
+ This work incorporates [Twitter Bootstrap](https://github.com/twitter/bootstrap) by Twitter, Inc.
96
+ This gem has been inspired by [less-rails-bootstrap](https://github.com/metaskills/less-rails-bootstrap) by Ken Collins
97
+
98
+ ## Maintainers
99
+
100
+ * [Morton Jonuschat](https://github.com/yabawock)
101
+
102
+ ## License
103
+
104
+ Apache License, Version 2.0
105
+
106
+ ## Copyright
107
+
108
+ Copyright 2011 Morton Jonuschat
109
+ Twitter Bootstrap copyright 2011 Twitter, Inc
data/Rakefile ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'BootstrapSassRails'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
27
+ require 'rake/testtask'
28
+
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'lib'
31
+ t.libs << 'test'
32
+ t.pattern = 'test/**/*_spec.rb'
33
+ t.verbose = false
34
+ end
35
+
36
+
37
+ task :default => :test
@@ -0,0 +1,8 @@
1
+ module Bootstrap
2
+ module Sass
3
+ module Rails
4
+ end
5
+ end
6
+ end
7
+
8
+ require 'bootstrap/sass/rails'
@@ -0,0 +1,2 @@
1
+ require 'bootstrap/sass/rails/version'
2
+ require 'bootstrap/sass/rails/engine'
@@ -0,0 +1,9 @@
1
+ module Bootstrap
2
+ module Sass
3
+ module Rails
4
+ class Engine < ::Rails::Engine
5
+ # Make rails look at the vendored assets
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module Bootstrap
2
+ module Sass
3
+ module Rails
4
+ VERSION = '1.4.0'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,70 @@
1
+ require 'spec_helper'
2
+
3
+ class UsageCssSpec < Bootstrap::Sass::Rails::Spec
4
+
5
+ describe 'application.css' do
6
+
7
+ let(:app_css) { dummy_asset('application.css') }
8
+
9
+ it 'will render main bootstrap.less file and all included modules' do
10
+ app_css.must_include 'Bootstrap @VERSION', 'From bootstrap.css.scss'
11
+ app_css.must_include 'Forms.scss', 'From forms.scss'
12
+ app_css.must_include 'Snippets of reusable CSS', 'From mixins.scss'
13
+ app_css.must_include 'Patterns.scss', 'From patterns.scss'
14
+ app_css.must_include 'Scaffolding', 'From scaffolding.scss'
15
+ app_css.must_include 'Tables.scss', 'From tables.scss'
16
+ app_css.must_include 'Typography.scss', 'From type.scss'
17
+ app_css.must_include 'Variables.scss', 'From variables.scss'
18
+ end
19
+
20
+ it 'must include basic css afterward' do
21
+ app_css.must_include '#other-css { color: red; }', 'From our code afterward.'
22
+ end
23
+
24
+ end
25
+
26
+ describe 'individual.scss' do
27
+
28
+ let(:individual_css) { dummy_asset('individual.css') }
29
+
30
+ it 'will render bootstrap variables and mixins' do
31
+ my_button_line = line_for_individual_css('individual-my-button')
32
+ my_button_line.must_include '-webkit-border-radius: 10px'
33
+ my_button_line.must_include '-moz-border-radius: 10px'
34
+ my_button_line.must_include 'border-radius: 10px'
35
+ end
36
+
37
+ end
38
+
39
+ describe 'sprockets.css' do
40
+
41
+ let(:sprockets_css) { dummy_asset('sprockets.css') }
42
+
43
+ it 'will render main bootstrap.css file and all included modules' do
44
+ sprockets_css.must_include 'Bootstrap @VERSION', 'From boostrap.css.scss'
45
+ sprockets_css.must_include 'Forms.scss', 'From forms.scss'
46
+ sprockets_css.must_include 'Snippets of reusable CSS', 'From mixins.scss'
47
+ sprockets_css.must_include 'Patterns.scss', 'From patterns.scss'
48
+ sprockets_css.must_include 'Scaffolding', 'From scaffolding.scss'
49
+ sprockets_css.must_include 'Tables.scss', 'From tables.scss'
50
+ sprockets_css.must_include 'Typography.scss', 'From type.scss'
51
+ sprockets_css.must_include 'Variables.scss', 'From variables.scss'
52
+ end
53
+
54
+ it 'must include basic css afterward' do
55
+ sprockets_css.must_include '#other-css { color: red; }', 'From our code afterward.'
56
+ end
57
+
58
+ end
59
+
60
+ private
61
+
62
+ def line_for_framework_css(name)
63
+ framework_css.each_line.detect{ |line| line.include? name }.strip
64
+ end
65
+
66
+ def line_for_individual_css(name)
67
+ individual_css.each_line.detect{ |line| line.include? name }.strip
68
+ end
69
+
70
+ end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ class UsageJsSpec < Bootstrap::Sass::Rails::Spec
4
+
5
+ describe 'application.js' do
6
+
7
+ let(:app_js) { dummy_asset('application.js') }
8
+
9
+ it 'will render main bootstrap.js file and all included modules' do
10
+ app_js.must_include 'bootstrap-alerts.js'
11
+ app_js.must_include 'bootstrap-dropdown.js'
12
+ app_js.must_include 'bootstrap-modal.js'
13
+ app_js.must_include 'bootstrap-popover.js'
14
+ app_js.must_include 'bootstrap-scrollspy.js'
15
+ app_js.must_include 'bootstrap-tabs.js'
16
+ app_js.must_include 'bootstrap-twipsy.js'
17
+ end
18
+
19
+ it 'must include basic js afterward' do
20
+ app_js.must_include '$(document).ready(function(){...});'
21
+ end
22
+
23
+ end
24
+
25
+ describe 'individual.css.less' do
26
+
27
+ let(:individual_js) { dummy_asset('individual.js') }
28
+
29
+ it 'will render bootstrap variables and mixins' do
30
+ individual_js.must_include 'bootstrap-modal.js'
31
+ end
32
+
33
+ end
34
+
35
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,3 @@
1
+ //= require twitter/bootstrap
2
+
3
+ $(document).ready(function(){...});:
@@ -0,0 +1 @@
1
+ //= require twitter/bootstrap/modal
@@ -0,0 +1,3 @@
1
+ @import "twitter/bootstrap";
2
+
3
+ #other-css { color: red; }
@@ -0,0 +1,10 @@
1
+ @import "twitter/bootstrap/variables";
2
+ @import "twitter/bootstrap/mixins";
3
+
4
+ @mixin myButton($radius: 5px) {
5
+ @include border-radius($radius);
6
+ }
7
+
8
+ #individual-my-button {
9
+ @include myButton(10px);
10
+ }
@@ -0,0 +1,3 @@
1
+ //= require twitter/bootstrap
2
+
3
+ #other-css { color: red; }
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,49 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require
6
+ require "bootstrap-sass-rails"
7
+ require "sass-rails"
8
+
9
+ module Dummy
10
+ class Application < Rails::Application
11
+ # Settings in config/environments/* take precedence over those specified here.
12
+ # Application configuration should go into files in config/initializers
13
+ # -- all .rb files in that directory are automatically loaded.
14
+
15
+ # Custom directories with classes and modules you want to be autoloadable.
16
+ # config.autoload_paths += %W(#{config.root}/extras)
17
+
18
+ # Only load the plugins named here, in the order given (default is alphabetical).
19
+ # :all can be used as a placeholder for all plugins not explicitly named.
20
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
21
+
22
+ # Activate observers that should always be running.
23
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
24
+
25
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
26
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
27
+ # config.time_zone = 'Central Time (US & Canada)'
28
+
29
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
30
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
31
+ # config.i18n.default_locale = :de
32
+
33
+ # Configure the default encoding used in templates for Ruby 1.9.
34
+ config.encoding = "utf-8"
35
+
36
+ # Configure sensitive parameters which will be filtered from the log file.
37
+ config.filter_parameters += [:password]
38
+
39
+ # Enable the asset pipeline
40
+ config.assets.enabled = true
41
+
42
+ # Version of your assets, change this if you want to expire all your assets
43
+ config.assets.version = '1.0'
44
+
45
+ # Set an easier to test css style
46
+ config.sass.style = :compact
47
+ end
48
+ end
49
+
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000