anjlab-bootstrap-rails 1.4.0.12 → 1.4.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -38,4 +38,12 @@ task "update-twitter" do
38
38
  f.write "//= require #{js}\n"
39
39
  end
40
40
  end
41
- end
41
+ end
42
+
43
+ require 'rake/testtask'
44
+
45
+ Rake::TestTask.new do |t|
46
+ t.libs << "test"
47
+ t.test_files = FileList['test/*_test.rb']
48
+ t.verbose = true
49
+ end
@@ -18,6 +18,7 @@ Gem::Specification.new do |gem|
18
18
 
19
19
  gem.add_dependency "railties", "~> 3.0"
20
20
  gem.add_dependency "thor", "~> 0.14"
21
+ gem.add_dependency "sass"
21
22
  gem.add_development_dependency "bundler", ">= 1.0.0"
22
23
  gem.add_development_dependency "rails", "~> 3.0"
23
24
  end
@@ -1,3 +1,4 @@
1
+ require "rails"
1
2
  require "bootstrap-rails/version"
2
3
 
3
4
  module Bootstrap
@@ -8,13 +8,8 @@ module Sass::Script::Functions
8
8
  assert_type color, :Color
9
9
  alpha = (color.alpha * 255).round
10
10
  alpha = alpha.to_s(16).rjust(2, '0')
11
- color_string = color.to_s.tr('#','')
12
- color_values = color_string.split('')
13
-
14
- r, g, b = *color_values
15
- if color_values.size == 3
16
- color_string = "#{r}#{r}#{g}#{g}#{b}#{b}"
17
- end
11
+ color_string = color.rgb.map {|num| num.to_s(16).rjust(2, '0')} .join
12
+
18
13
  Sass::Script::String.new("##{alpha}#{color_string}")
19
14
  end
20
15
  declare :ie_hex_str, :args => [:color]
@@ -1,5 +1,5 @@
1
1
  module Bootstrap
2
2
  module Rails
3
- VERSION = "1.4.0.12"
3
+ VERSION = "1.4.0.13"
4
4
  end
5
5
  end
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+ require 'sass/script'
3
+
4
+ class IeHexStrText < Test::Unit::TestCase
5
+ def test_named_color
6
+ assert_equal("#ffffffff", evaluate("ie_hex_str(#ffffff)"))
7
+ end
8
+
9
+ def test_rgba_color
10
+ assert_equal("#1affffff", evaluate("ie_hex_str(rgba(255, 255, 255, 0.1))"))
11
+ end
12
+
13
+ def test_rgb_color
14
+ assert_equal("#ffffffff", evaluate("ie_hex_str(rgb(255, 255, 255))"))
15
+ end
16
+
17
+ def test_hsl_color
18
+ assert_equal("#ffffffff", evaluate("ie_hex_str(hsl(100%, 100%, 100%))"))
19
+ end
20
+
21
+ private
22
+
23
+ def evaluate(value)
24
+ Sass::Script::Parser.parse(value, 0, 0).perform(Sass::Environment.new).to_s
25
+ end
26
+ end
@@ -0,0 +1,2 @@
1
+ require "bootstrap-rails"
2
+ require 'test/unit'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anjlab-bootstrap-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0.12
4
+ version: 1.4.0.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-11 00:00:00.000000000 Z
12
+ date: 2011-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &70106579303860 !ruby/object:Gem::Requirement
16
+ requirement: &70291325873160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70106579303860
24
+ version_requirements: *70291325873160
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: thor
27
- requirement: &70106579302700 !ruby/object:Gem::Requirement
27
+ requirement: &70291325872240 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,21 @@ dependencies:
32
32
  version: '0.14'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70106579302700
35
+ version_requirements: *70291325872240
36
+ - !ruby/object:Gem::Dependency
37
+ name: sass
38
+ requirement: &70291325871500 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70291325871500
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: bundler
38
- requirement: &70106579302240 !ruby/object:Gem::Requirement
49
+ requirement: &70291325870820 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ! '>='
@@ -43,10 +54,10 @@ dependencies:
43
54
  version: 1.0.0
44
55
  type: :development
45
56
  prerelease: false
46
- version_requirements: *70106579302240
57
+ version_requirements: *70291325870820
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: rails
49
- requirement: &70106579301660 !ruby/object:Gem::Requirement
60
+ requirement: &70291325870220 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ~>
@@ -54,7 +65,7 @@ dependencies:
54
65
  version: '3.0'
55
66
  type: :development
56
67
  prerelease: false
57
- version_requirements: *70106579301660
68
+ version_requirements: *70291325870220
58
69
  description: Twitter Bootstrap CSS (with SASS flavour) and JS toolkits for Rails 3
59
70
  projects
60
71
  email:
@@ -73,6 +84,8 @@ files:
73
84
  - lib/bootstrap-rails/ie_hex_str.rb
74
85
  - lib/bootstrap-rails/railtie.rb
75
86
  - lib/bootstrap-rails/version.rb
87
+ - test/ie_hex_str_test.rb
88
+ - test/test_helper.rb
76
89
  - vendor/assets/javascripts/bootstrap-alerts.js
77
90
  - vendor/assets/javascripts/bootstrap-buttons.js
78
91
  - vendor/assets/javascripts/bootstrap-dropdown.js
@@ -115,4 +128,6 @@ rubygems_version: 1.8.10
115
128
  signing_key:
116
129
  specification_version: 3
117
130
  summary: Bootstrap CSS (with SASS flavour) and JS toolkits for Rails 3 projects
118
- test_files: []
131
+ test_files:
132
+ - test/ie_hex_str_test.rb
133
+ - test/test_helper.rb