less-rails-bootstrap 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data/.gitignore +2 -0
  2. data/CHANGELOG.md +13 -6
  3. data/Gemfile +3 -0
  4. data/Guardfile +5 -0
  5. data/Rakefile +14 -1
  6. data/less-rails-bootstrap.gemspec +3 -0
  7. data/lib/less-rails-bootstrap.rb +2 -2
  8. data/lib/less/rails/bootstrap/engine.rb +2 -3
  9. data/lib/less/rails/bootstrap/version.rb +1 -1
  10. data/test/cases/engine_spec.rb +15 -0
  11. data/test/cases/usage_css_spec.rb +72 -0
  12. data/test/cases/usage_js_spec.rb +36 -0
  13. data/test/dummy_app/app/assets/javascripts/application.js +3 -0
  14. data/test/dummy_app/app/assets/javascripts/individual.js +2 -0
  15. data/test/dummy_app/app/assets/stylesheets/application.css +6 -0
  16. data/test/dummy_app/app/assets/stylesheets/framework.css.less +6 -0
  17. data/test/dummy_app/app/assets/stylesheets/individual.css.less +10 -0
  18. data/test/dummy_app/init.rb +21 -0
  19. data/test/spec_helper.rb +54 -0
  20. data/vendor/frameworks/twitter/bootstrap.less +1 -0
  21. data/vendor/{assets/stylesheets → frameworks}/twitter/bootstrap/bootstrap.less +0 -0
  22. data/vendor/{assets/stylesheets → frameworks}/twitter/bootstrap/forms.less +0 -0
  23. data/vendor/{assets/stylesheets → frameworks}/twitter/bootstrap/mixins.less +0 -0
  24. data/vendor/{assets/stylesheets → frameworks}/twitter/bootstrap/patterns.less +0 -0
  25. data/vendor/{assets/stylesheets → frameworks}/twitter/bootstrap/reset.less +0 -0
  26. data/vendor/{assets/stylesheets → frameworks}/twitter/bootstrap/scaffolding.less +0 -0
  27. data/vendor/{assets/stylesheets → frameworks}/twitter/bootstrap/tables.less +0 -0
  28. data/vendor/{assets/stylesheets → frameworks}/twitter/bootstrap/type.less +0 -0
  29. data/vendor/{assets/stylesheets → frameworks}/twitter/bootstrap/variables.less +0 -0
  30. metadata +80 -16
  31. data/vendor/assets/stylesheets/twitter/bootstrap.less +0 -1
data/.gitignore CHANGED
@@ -2,3 +2,5 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ test/dummy_app/log/*
6
+ tmp/*
data/CHANGELOG.md CHANGED
@@ -1,20 +1,27 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
- 1.3.2 (Sept 28, 2011)
5
- ---------------------
4
+ 1.3.3 - 10/09/2011
5
+ ------------------
6
+
7
+ * Move bootstrap LESS files to vendor/frameworks. Should fix assets:precompile bugs.
8
+ * New test setup and hopefully a more sane engine initializer.
9
+
10
+
11
+ 1.3.2 - 09/28/2011
12
+ ------------------
6
13
 
7
14
  * Require less-rails properly. Thanks Benoit Bénézech (bbenezech).
8
15
 
9
16
 
10
- 1.3.1 (Sept 26, 2011)
11
- ---------------------
17
+ 1.3.1 - 09/26/2011
18
+ ------------------
12
19
 
13
20
  * Require twipsy before popover [stratequip]
14
21
 
15
22
 
16
- 1.3.0 (Sept 25, 2011)
17
- ---------------------
23
+ 1.3.0 - 09/25/2011
24
+ ------------------
18
25
 
19
26
  * Initial 1.3.0 release (68605bdd51760a929cc661607f06f479c53b0bee)
20
27
 
data/Gemfile CHANGED
@@ -1,2 +1,5 @@
1
1
  source :rubygems
2
2
  gemspec
3
+
4
+ gem 'less-rails', :path => ENV['LESS_RAILS_PATH'] if ENV['LESS_RAILS_PATH']
5
+
data/Guardfile ADDED
@@ -0,0 +1,5 @@
1
+ guard 'minitest' do
2
+ watch(%r|^lib/less/rails/bootstrap/(.*)\.rb|) { |m| "test/cases/#{m[1]}_spec.rb" }
3
+ watch(%r|^test/spec_helper\.rb|) { "test/cases" }
4
+ watch(%r|^test/cases/(.*)_spec\.rb|)
5
+ end
data/Rakefile CHANGED
@@ -1 +1,14 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler'
2
+ require 'rake/testtask'
3
+
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ Rake::TestTask.new do |t|
7
+ t.libs = ['lib','test']
8
+ t.test_files = Dir.glob("test/**/*_spec.rb").sort
9
+ t.verbose = true
10
+ end
11
+
12
+ task :default => [:test]
13
+ task :spec => [:test]
14
+
@@ -15,4 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
16
  s.require_paths = ["lib"]
17
17
  s.add_runtime_dependency "less-rails", "~> 2.0.0"
18
+ s.add_development_dependency 'minitest'
19
+ s.add_development_dependency 'guard-minitest'
20
+ s.add_development_dependency 'rails', '~> 3.1.1'
18
21
  end
@@ -5,5 +5,5 @@ module Less
5
5
  end
6
6
  end
7
7
 
8
- require 'less/rails'
9
- require "less/rails/bootstrap"
8
+ require 'less-rails'
9
+ require 'less/rails/bootstrap'
@@ -3,9 +3,8 @@ module Less
3
3
  module Bootstrap
4
4
  class Engine < ::Rails::Engine
5
5
 
6
- config.after_initialize do |app|
7
- bootstrap_less_files = config.root + 'vendor/stylesheets/twitter/bootstrap'
8
- app.config.less.paths << bootstrap_less_files
6
+ initializer 'less-rails-bootstrap.setup', :after => 'less-rails.after.load_config_initializers', :group => :all do |app|
7
+ app.config.less.paths << File.join(config.root, 'vendor', 'frameworks')
9
8
  end
10
9
 
11
10
  end
@@ -1,7 +1,7 @@
1
1
  module Less
2
2
  module Rails
3
3
  module Bootstrap
4
- VERSION = "1.3.2"
4
+ VERSION = "1.3.3"
5
5
  end
6
6
  end
7
7
  end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ class EngineSpec < Less::Rails::Bootstrap::Spec
4
+
5
+ it 'must be able to hook into a less-rails config' do
6
+ dummy_config.less.must_be_instance_of ActiveSupport::OrderedOptions
7
+ end
8
+
9
+ it 'must append engines assets stylesheets to less-rails load paths' do
10
+ dummy_config.less.paths.must_be_instance_of Array
11
+ dummy_config.less.paths.must_include project_vendor_twitter_bootstrap
12
+ end
13
+
14
+
15
+ end
@@ -0,0 +1,72 @@
1
+ require 'spec_helper'
2
+
3
+ class UsageCssSpec < Less::Rails::Bootstrap::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 boostrap.less'
11
+ app_css.must_include 'Forms.less', 'From forms.less'
12
+ app_css.must_include 'Snippets of reusable CSS', 'From mixins.less'
13
+ app_css.must_include 'Patterns.less', 'From patterns.less'
14
+ app_css.must_include 'Scaffolding', 'From scaffolding.less'
15
+ app_css.must_include 'Tables.less', 'From tables.less'
16
+ app_css.must_include 'Typography.less', 'From type.less'
17
+ app_css.must_include 'Variables.less', 'From variables.less'
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 'framework.css.less' do
27
+
28
+ before { dummy_config.less.compress = true }
29
+
30
+ let(:framework_css) { dummy_asset('framework.css') }
31
+
32
+ it 'will render bootstrap functions' do
33
+ border_radius_line = line_for_framework_css('framework-border-radius')
34
+ border_radius_line.must_include '-webkit-border-radius:4px'
35
+ border_radius_line.must_include '-moz-border-radius:4px'
36
+ border_radius_line.must_include 'border-radius:4px'
37
+ end
38
+
39
+ it 'will render bootstrap variables' do
40
+ link_color_line = line_for_framework_css('framework-linkColor')
41
+ link_color_line.must_include 'color:#0069d6;'
42
+ end
43
+
44
+ end
45
+
46
+ describe 'individual.css.less' do
47
+
48
+ before { dummy_config.less.compress = true }
49
+
50
+ let(:individual_css) { dummy_asset('individual.css') }
51
+
52
+ it 'will render bootstrap variables and mixins' do
53
+ my_button_line = line_for_individual_css('individual-my-button')
54
+ my_button_line.must_include '-webkit-border-radius:10px'
55
+ my_button_line.must_include '-moz-border-radius:10px'
56
+ my_button_line.must_include 'border-radius:10px'
57
+ end
58
+
59
+ end
60
+
61
+
62
+ private
63
+
64
+ def line_for_framework_css(name)
65
+ framework_css.each_line.detect{ |line| line.include? name }.strip
66
+ end
67
+
68
+ def line_for_individual_css(name)
69
+ individual_css.each_line.detect{ |line| line.include? name }.strip
70
+ end
71
+
72
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ class UsageJsSpec < Less::Rails::Bootstrap::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
+
36
+ end
@@ -0,0 +1,3 @@
1
+ //= require twitter/bootstrap
2
+
3
+ $(document).ready(function(){...});
@@ -0,0 +1,2 @@
1
+ //= require twitter/bootstrap/modal
2
+
@@ -0,0 +1,6 @@
1
+ /*
2
+ *= require twitter/bootstrap
3
+ */
4
+
5
+ #other-css { color: red; }
6
+
@@ -0,0 +1,6 @@
1
+ @import "twitter/bootstrap";
2
+
3
+ #framework-start{color:red;}
4
+
5
+ #framework-border-radius { .border-radius(4px); }
6
+ #framework-linkColor { color: @linkColor; }
@@ -0,0 +1,10 @@
1
+ @import "twitter/bootstrap/variables";
2
+ @import "twitter/bootstrap/mixins";
3
+
4
+ .myButton(@radius: 5px) {
5
+ .border-radius(@radius);
6
+ }
7
+
8
+ #individual-my-button {
9
+ .myButton(10px);
10
+ }
@@ -0,0 +1,21 @@
1
+ require 'sprockets/railtie'
2
+ require 'action_controller/railtie'
3
+ require 'action_view/railtie'
4
+ require 'action_view/base'
5
+ require 'action_controller/base'
6
+
7
+ module Dummy
8
+ class Application < ::Rails::Application
9
+
10
+ config.root = File.join __FILE__, '..'
11
+ config.active_support.deprecation = :stderr
12
+ config.cache_store = :memory_store
13
+ config.consider_all_requests_local = true
14
+
15
+ config.assets.enabled = true
16
+ config.assets.cache_store = config.cache_store
17
+
18
+ end
19
+ end
20
+
21
+ Dummy::Application.initialize!
@@ -0,0 +1,54 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ Bundler.require
4
+ require 'less-rails-bootstrap'
5
+ require 'minitest/spec'
6
+ require 'minitest/autorun'
7
+ require 'dummy_app/init'
8
+
9
+ module Less
10
+ module Rails
11
+ module Bootstrap
12
+ class Spec < MiniTest::Spec
13
+
14
+ before do
15
+ reset_caches
16
+ end
17
+
18
+
19
+ private
20
+
21
+ def dummy_app
22
+ Dummy::Application
23
+ end
24
+
25
+ def dummy_config
26
+ dummy_app.config
27
+ end
28
+
29
+ def dummy_assets
30
+ dummy_app.assets
31
+ end
32
+
33
+ def dummy_asset(name)
34
+ dummy_assets[name].to_s.strip
35
+ end
36
+
37
+ def reset_caches
38
+ dummy_assets.version = SecureRandom.hex(32)
39
+ dummy_assets.cache.clear
40
+ end
41
+
42
+ def project_root
43
+ File.expand_path File.join(File.dirname(__FILE__), '..')
44
+ end
45
+
46
+ def project_vendor_twitter_bootstrap
47
+ File.join project_root, 'vendor', 'frameworks'
48
+ end
49
+
50
+ end
51
+ end
52
+ end
53
+ end
54
+
@@ -0,0 +1 @@
1
+ @import "bootstrap/bootstrap.less";
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: less-rails-bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 2
10
- version: 1.3.2
9
+ - 3
10
+ version: 1.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ken Collins
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-28 00:00:00 -04:00
18
+ date: 2011-10-09 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -34,6 +34,50 @@ dependencies:
34
34
  version: 2.0.0
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: minitest
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ type: :development
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: guard-minitest
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ type: :development
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: rails
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ~>
72
+ - !ruby/object:Gem::Version
73
+ hash: 1
74
+ segments:
75
+ - 3
76
+ - 1
77
+ - 1
78
+ version: 3.1.1
79
+ type: :development
80
+ version_requirements: *id004
37
81
  description: CSS toolkit from Twitter For Rails 3.1 Asset Pipeline
38
82
  email:
39
83
  - ken@metaskills.net
@@ -47,6 +91,7 @@ files:
47
91
  - .gitignore
48
92
  - CHANGELOG.md
49
93
  - Gemfile
94
+ - Guardfile
50
95
  - README.md
51
96
  - Rakefile
52
97
  - less-rails-bootstrap.gemspec
@@ -54,6 +99,16 @@ files:
54
99
  - lib/less/rails/bootstrap.rb
55
100
  - lib/less/rails/bootstrap/engine.rb
56
101
  - lib/less/rails/bootstrap/version.rb
102
+ - test/cases/engine_spec.rb
103
+ - test/cases/usage_css_spec.rb
104
+ - test/cases/usage_js_spec.rb
105
+ - test/dummy_app/app/assets/javascripts/application.js
106
+ - test/dummy_app/app/assets/javascripts/individual.js
107
+ - test/dummy_app/app/assets/stylesheets/application.css
108
+ - test/dummy_app/app/assets/stylesheets/framework.css.less
109
+ - test/dummy_app/app/assets/stylesheets/individual.css.less
110
+ - test/dummy_app/init.rb
111
+ - test/spec_helper.rb
57
112
  - vendor/assets/javascripts/twitter/bootstrap.js
58
113
  - vendor/assets/javascripts/twitter/bootstrap/alerts.js
59
114
  - vendor/assets/javascripts/twitter/bootstrap/dropdown.js
@@ -63,16 +118,16 @@ files:
63
118
  - vendor/assets/javascripts/twitter/bootstrap/tabs.js
64
119
  - vendor/assets/javascripts/twitter/bootstrap/twipsy.js
65
120
  - vendor/assets/stylesheets/twitter/bootstrap.css.less
66
- - vendor/assets/stylesheets/twitter/bootstrap.less
67
- - vendor/assets/stylesheets/twitter/bootstrap/bootstrap.less
68
- - vendor/assets/stylesheets/twitter/bootstrap/forms.less
69
- - vendor/assets/stylesheets/twitter/bootstrap/mixins.less
70
- - vendor/assets/stylesheets/twitter/bootstrap/patterns.less
71
- - vendor/assets/stylesheets/twitter/bootstrap/reset.less
72
- - vendor/assets/stylesheets/twitter/bootstrap/scaffolding.less
73
- - vendor/assets/stylesheets/twitter/bootstrap/tables.less
74
- - vendor/assets/stylesheets/twitter/bootstrap/type.less
75
- - vendor/assets/stylesheets/twitter/bootstrap/variables.less
121
+ - vendor/frameworks/twitter/bootstrap.less
122
+ - vendor/frameworks/twitter/bootstrap/bootstrap.less
123
+ - vendor/frameworks/twitter/bootstrap/forms.less
124
+ - vendor/frameworks/twitter/bootstrap/mixins.less
125
+ - vendor/frameworks/twitter/bootstrap/patterns.less
126
+ - vendor/frameworks/twitter/bootstrap/reset.less
127
+ - vendor/frameworks/twitter/bootstrap/scaffolding.less
128
+ - vendor/frameworks/twitter/bootstrap/tables.less
129
+ - vendor/frameworks/twitter/bootstrap/type.less
130
+ - vendor/frameworks/twitter/bootstrap/variables.less
76
131
  has_rdoc: true
77
132
  homepage: http://github.com/metaskills/less-rails-bootstrap
78
133
  licenses: []
@@ -107,5 +162,14 @@ rubygems_version: 1.6.2
107
162
  signing_key:
108
163
  specification_version: 3
109
164
  summary: CSS toolkit from Twitter For Rails 3.1 Asset Pipeline
110
- test_files: []
111
-
165
+ test_files:
166
+ - test/cases/engine_spec.rb
167
+ - test/cases/usage_css_spec.rb
168
+ - test/cases/usage_js_spec.rb
169
+ - test/dummy_app/app/assets/javascripts/application.js
170
+ - test/dummy_app/app/assets/javascripts/individual.js
171
+ - test/dummy_app/app/assets/stylesheets/application.css
172
+ - test/dummy_app/app/assets/stylesheets/framework.css.less
173
+ - test/dummy_app/app/assets/stylesheets/individual.css.less
174
+ - test/dummy_app/init.rb
175
+ - test/spec_helper.rb
@@ -1 +0,0 @@
1
- @import "bootstrap/bootstrap";