font_awesome_rails 0.0.1 → 0.0.2

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.
@@ -6,7 +6,6 @@
6
6
  }
7
7
 
8
8
  @mixin icon-before($name) {
9
- @extend %icon-before;
10
9
  @include icon-before-style {
11
10
  @include icon-content($name);
12
11
  @content;
@@ -14,7 +13,6 @@
14
13
  }
15
14
 
16
15
  @mixin icon-after($name) {
17
- @extend %icon-after;
18
16
  @include icon-after-style {
19
17
  @include icon-content($name);
20
18
  @content;
@@ -23,7 +21,7 @@
23
21
 
24
22
  @mixin icon-content($name) {
25
23
  @extend %icon-content;
26
- @extend %icon-#{$name};
24
+ content: icon-character($name);
27
25
  }
28
26
 
29
27
  @mixin icon-image($args...) {
@@ -43,16 +41,15 @@
43
41
  }
44
42
 
45
43
  @mixin icon-before-style {
46
- &%icon-before:before {
44
+ &:before {
47
45
  @content;
48
46
  }
49
47
  }
50
48
 
51
49
  @mixin icon-after-style {
52
- &%icon-after:after {
50
+ &:after {
53
51
  @content;
54
52
  }
55
53
  }
56
54
 
57
55
  @import "styles";
58
- @import "icons";
@@ -32,14 +32,6 @@
32
32
  }
33
33
  }
34
34
 
35
- li {
36
- @include icon-style {
37
- display: inline-block;
38
- width: 1.25em;
39
- text-align: center;
40
- }
41
- }
42
-
43
35
  %icon-list {
44
36
  list-style-type: none;
45
37
  margin-left: 2em;
@@ -8,6 +8,8 @@ module FontAwesome
8
8
  included do
9
9
  declare :icon_image, [:name]
10
10
  declare :icon_image, [:name, :style]
11
+
12
+ declare :icon_character, [:name]
11
13
  end
12
14
 
13
15
  def icon_image(name, style=nil)
@@ -21,6 +23,12 @@ module FontAwesome
21
23
 
22
24
  Sass::Script::String.new icon.to_uri, :string
23
25
  end
26
+
27
+ def icon_character(name)
28
+ assert_type name, :String
29
+
30
+ Sass::Script::String.new HexCode.new(name.value).to_css, :string
31
+ end
24
32
  end
25
33
  end
26
34
  end
@@ -1,3 +1,3 @@
1
1
  module FontAwesomeRails
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -41,6 +41,10 @@ describe FontAwesome::SassExtensions::Functions do
41
41
  it "returns a data-uri representation of the icon" do
42
42
  icon_image.should == Sass::Script::String.new("uri")
43
43
  end
44
+
45
+ it "quotes the returned string" do
46
+ icon_image.type.should == :string
47
+ end
44
48
  end
45
49
 
46
50
  describe "icon-image($name, $style)" do
@@ -65,5 +69,34 @@ describe FontAwesome::SassExtensions::Functions do
65
69
  it "returns a data-uri representation of the icon" do
66
70
  icon_image.should == Sass::Script::String.new("uri")
67
71
  end
72
+
73
+ it "quotes the returned string" do
74
+ icon_image.type.should == :string
75
+ end
76
+ end
77
+
78
+ it "declares icon-character($name)" do
79
+ EvaluationContext.declarations.should include [:icon_character, [:name]]
80
+ end
81
+
82
+ describe "icon-character($name)" do
83
+ subject(:icon_character) { functions.icon_character(name) }
84
+ let(:name) { Sass::Script::String.new("pizza") }
85
+ let(:hex_code) { stub("HexCode", to_css: "\\f00d") }
86
+
87
+ before { FontAwesome::HexCode.stubs(:new).with("pizza").returns(hex_code) }
88
+
89
+ it "requires that $name be a string" do
90
+ functions.expects(:assert_type).with(name, :String)
91
+ icon_character
92
+ end
93
+
94
+ it "returns the css-formatted hex code for the icon" do
95
+ icon_character.should == Sass::Script::String.new("\\f00d")
96
+ end
97
+
98
+ it "quotes the returned string" do
99
+ icon_character.type.should == :string
100
+ end
68
101
  end
69
102
  end
@@ -4,5 +4,5 @@ desc "Update Font Awesome and generate code"
4
4
  task :update => "update:all"
5
5
 
6
6
  namespace :update do
7
- task :all => [:font_awesome, :font, :hex_codes, :metrics, :sass, :classic]
7
+ task :all => [:font_awesome, :font, :hex_codes, :metrics, :classic]
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: font_awesome_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-21 00:00:00.000000000 Z
12
+ date: 2012-08-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sass
@@ -138,7 +138,6 @@ files:
138
138
  - Rakefile
139
139
  - app/assets/stylesheets/_font-awesome.scss
140
140
  - app/assets/stylesheets/font-awesome/_font.scss
141
- - app/assets/stylesheets/font-awesome/_icons.scss
142
141
  - app/assets/stylesheets/font-awesome/_mixins.scss
143
142
  - app/assets/stylesheets/font-awesome/_styles.scss
144
143
  - font_awesome_rails.gemspec
@@ -160,7 +159,6 @@ files:
160
159
  - spec/tasks/update_classic_sass_task_spec.rb
161
160
  - spec/tasks/update_hex_codes_task_spec.rb
162
161
  - spec/tasks/update_metrics_task_spec.rb
163
- - spec/tasks/update_sass_task_spec.rb
164
162
  - tasks/gem_dir.rb
165
163
  - tasks/spec.rake
166
164
  - tasks/task.rb
@@ -171,11 +169,9 @@ files:
171
169
  - tasks/update/hex_codes.rake
172
170
  - tasks/update/metrics.rake
173
171
  - tasks/update/metrics.rb
174
- - tasks/update/sass.rake
175
172
  - tasks/update/update_classic_sass_task.rb
176
173
  - tasks/update/update_hex_codes_task.rb
177
174
  - tasks/update/update_metrics_task.rb
178
- - tasks/update/update_sass_task.rb
179
175
  - vendor/assets/font/fontawesome-webfont.eot
180
176
  - vendor/assets/font/fontawesome-webfont.svg
181
177
  - vendor/assets/font/fontawesome-webfont.ttf
@@ -196,7 +192,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
196
192
  version: '0'
197
193
  segments:
198
194
  - 0
199
- hash: 185411375
195
+ hash: -24075267
200
196
  required_rubygems_version: !ruby/object:Gem::Requirement
201
197
  none: false
202
198
  requirements:
@@ -205,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
201
  version: '0'
206
202
  segments:
207
203
  - 0
208
- hash: 185411375
204
+ hash: -24075267
209
205
  requirements: []
210
206
  rubyforge_project:
211
207
  rubygems_version: 1.8.24
@@ -222,4 +218,3 @@ test_files:
222
218
  - spec/tasks/update_classic_sass_task_spec.rb
223
219
  - spec/tasks/update_hex_codes_task_spec.rb
224
220
  - spec/tasks/update_metrics_task_spec.rb
225
- - spec/tasks/update_sass_task_spec.rb
@@ -1,210 +0,0 @@
1
- %icon-glass { content: '\f000'; }
2
- %icon-music { content: '\f001'; }
3
- %icon-search { content: '\f002'; }
4
- %icon-envelope { content: '\f003'; }
5
- %icon-heart { content: '\f004'; }
6
- %icon-star { content: '\f005'; }
7
- %icon-star-empty { content: '\f006'; }
8
- %icon-user { content: '\f007'; }
9
- %icon-film { content: '\f008'; }
10
- %icon-th-large { content: '\f009'; }
11
- %icon-th { content: '\f00a'; }
12
- %icon-th-list { content: '\f00b'; }
13
- %icon-ok { content: '\f00c'; }
14
- %icon-remove { content: '\f00d'; }
15
- %icon-zoom-in { content: '\f00e'; }
16
- %icon-zoom-out { content: '\f010'; }
17
- %icon-off { content: '\f011'; }
18
- %icon-signal { content: '\f012'; }
19
- %icon-cog { content: '\f013'; }
20
- %icon-trash { content: '\f014'; }
21
- %icon-home { content: '\f015'; }
22
- %icon-file { content: '\f016'; }
23
- %icon-time { content: '\f017'; }
24
- %icon-road { content: '\f018'; }
25
- %icon-download-alt { content: '\f019'; }
26
- %icon-download { content: '\f01a'; }
27
- %icon-upload { content: '\f01b'; }
28
- %icon-inbox { content: '\f01c'; }
29
- %icon-play-circle { content: '\f01d'; }
30
- %icon-repeat { content: '\f01e'; }
31
- %icon-refresh { content: '\f021'; }
32
- %icon-list-alt { content: '\f022'; }
33
- %icon-lock { content: '\f023'; }
34
- %icon-flag { content: '\f024'; }
35
- %icon-headphones { content: '\f025'; }
36
- %icon-volume-off { content: '\f026'; }
37
- %icon-volume-down { content: '\f027'; }
38
- %icon-volume-up { content: '\f028'; }
39
- %icon-qrcode { content: '\f029'; }
40
- %icon-barcode { content: '\f02a'; }
41
- %icon-tag { content: '\f02b'; }
42
- %icon-tags { content: '\f02c'; }
43
- %icon-book { content: '\f02d'; }
44
- %icon-bookmark { content: '\f02e'; }
45
- %icon-print { content: '\f02f'; }
46
- %icon-camera { content: '\f030'; }
47
- %icon-font { content: '\f031'; }
48
- %icon-bold { content: '\f032'; }
49
- %icon-italic { content: '\f033'; }
50
- %icon-text-height { content: '\f034'; }
51
- %icon-text-width { content: '\f035'; }
52
- %icon-align-left { content: '\f036'; }
53
- %icon-align-center { content: '\f037'; }
54
- %icon-align-right { content: '\f038'; }
55
- %icon-align-justify { content: '\f039'; }
56
- %icon-list { content: '\f03a'; }
57
- %icon-indent-left { content: '\f03b'; }
58
- %icon-indent-right { content: '\f03c'; }
59
- %icon-facetime-video { content: '\f03d'; }
60
- %icon-picture { content: '\f03e'; }
61
- %icon-pencil { content: '\f040'; }
62
- %icon-map-marker { content: '\f041'; }
63
- %icon-adjust { content: '\f042'; }
64
- %icon-tint { content: '\f043'; }
65
- %icon-edit { content: '\f044'; }
66
- %icon-share { content: '\f045'; }
67
- %icon-check { content: '\f046'; }
68
- %icon-move { content: '\f047'; }
69
- %icon-step-backward { content: '\f048'; }
70
- %icon-fast-backward { content: '\f049'; }
71
- %icon-backward { content: '\f04a'; }
72
- %icon-play { content: '\f04b'; }
73
- %icon-pause { content: '\f04c'; }
74
- %icon-stop { content: '\f04d'; }
75
- %icon-forward { content: '\f04e'; }
76
- %icon-fast-forward { content: '\f050'; }
77
- %icon-step-forward { content: '\f051'; }
78
- %icon-eject { content: '\f052'; }
79
- %icon-chevron-left { content: '\f053'; }
80
- %icon-chevron-right { content: '\f054'; }
81
- %icon-plus-sign { content: '\f055'; }
82
- %icon-minus-sign { content: '\f056'; }
83
- %icon-remove-sign { content: '\f057'; }
84
- %icon-ok-sign { content: '\f058'; }
85
- %icon-question-sign { content: '\f059'; }
86
- %icon-info-sign { content: '\f05a'; }
87
- %icon-screenshot { content: '\f05b'; }
88
- %icon-remove-circle { content: '\f05c'; }
89
- %icon-ok-circle { content: '\f05d'; }
90
- %icon-ban-circle { content: '\f05e'; }
91
- %icon-arrow-left { content: '\f060'; }
92
- %icon-arrow-right { content: '\f061'; }
93
- %icon-arrow-up { content: '\f062'; }
94
- %icon-arrow-down { content: '\f063'; }
95
- %icon-share-alt { content: '\f064'; }
96
- %icon-resize-full { content: '\f065'; }
97
- %icon-resize-small { content: '\f066'; }
98
- %icon-plus { content: '\f067'; }
99
- %icon-minus { content: '\f068'; }
100
- %icon-asterisk { content: '\f069'; }
101
- %icon-exclamation-sign { content: '\f06a'; }
102
- %icon-gift { content: '\f06b'; }
103
- %icon-leaf { content: '\f06c'; }
104
- %icon-fire { content: '\f06d'; }
105
- %icon-eye-open { content: '\f06e'; }
106
- %icon-eye-close { content: '\f070'; }
107
- %icon-warning-sign { content: '\f071'; }
108
- %icon-plane { content: '\f072'; }
109
- %icon-calendar { content: '\f073'; }
110
- %icon-random { content: '\f074'; }
111
- %icon-comment { content: '\f075'; }
112
- %icon-magnet { content: '\f076'; }
113
- %icon-chevron-up { content: '\f077'; }
114
- %icon-chevron-down { content: '\f078'; }
115
- %icon-retweet { content: '\f079'; }
116
- %icon-shopping-cart { content: '\f07a'; }
117
- %icon-folder-close { content: '\f07b'; }
118
- %icon-folder-open { content: '\f07c'; }
119
- %icon-resize-vertical { content: '\f07d'; }
120
- %icon-resize-horizontal { content: '\f07e'; }
121
- %icon-bar-chart { content: '\f080'; }
122
- %icon-twitter-sign { content: '\f081'; }
123
- %icon-facebook-sign { content: '\f082'; }
124
- %icon-camera-retro { content: '\f083'; }
125
- %icon-key { content: '\f084'; }
126
- %icon-cogs { content: '\f085'; }
127
- %icon-comments { content: '\f086'; }
128
- %icon-thumbs-up { content: '\f087'; }
129
- %icon-thumbs-down { content: '\f088'; }
130
- %icon-star-half { content: '\f089'; }
131
- %icon-heart-empty { content: '\f08a'; }
132
- %icon-signout { content: '\f08b'; }
133
- %icon-linkedin-sign { content: '\f08c'; }
134
- %icon-pushpin { content: '\f08d'; }
135
- %icon-external-link { content: '\f08e'; }
136
- %icon-signin { content: '\f090'; }
137
- %icon-trophy { content: '\f091'; }
138
- %icon-github-sign { content: '\f092'; }
139
- %icon-upload-alt { content: '\f093'; }
140
- %icon-lemon { content: '\f094'; }
141
- %icon-phone { content: '\f095'; }
142
- %icon-check-empty { content: '\f096'; }
143
- %icon-bookmark-empty { content: '\f097'; }
144
- %icon-phone-sign { content: '\f098'; }
145
- %icon-twitter { content: '\f099'; }
146
- %icon-facebook { content: '\f09a'; }
147
- %icon-github { content: '\f09b'; }
148
- %icon-unlock { content: '\f09c'; }
149
- %icon-credit-card { content: '\f09d'; }
150
- %icon-rss { content: '\f09e'; }
151
- %icon-hdd { content: '\f0a0'; }
152
- %icon-bullhorn { content: '\f0a1'; }
153
- %icon-bell { content: '\f0a2'; }
154
- %icon-certificate { content: '\f0a3'; }
155
- %icon-hand-right { content: '\f0a4'; }
156
- %icon-hand-left { content: '\f0a5'; }
157
- %icon-hand-up { content: '\f0a6'; }
158
- %icon-hand-down { content: '\f0a7'; }
159
- %icon-circle-arrow-left { content: '\f0a8'; }
160
- %icon-circle-arrow-right { content: '\f0a9'; }
161
- %icon-circle-arrow-up { content: '\f0aa'; }
162
- %icon-circle-arrow-down { content: '\f0ab'; }
163
- %icon-globe { content: '\f0ac'; }
164
- %icon-wrench { content: '\f0ad'; }
165
- %icon-tasks { content: '\f0ae'; }
166
- %icon-filter { content: '\f0b0'; }
167
- %icon-briefcase { content: '\f0b1'; }
168
- %icon-fullscreen { content: '\f0b2'; }
169
- %icon-group { content: '\f0c0'; }
170
- %icon-link { content: '\f0c1'; }
171
- %icon-cloud { content: '\f0c2'; }
172
- %icon-beaker { content: '\f0c3'; }
173
- %icon-cut { content: '\f0c4'; }
174
- %icon-copy { content: '\f0c5'; }
175
- %icon-paper-clip { content: '\f0c6'; }
176
- %icon-save { content: '\f0c7'; }
177
- %icon-sign-blank { content: '\f0c8'; }
178
- %icon-reorder { content: '\f0c9'; }
179
- %icon-list-ul { content: '\f0ca'; }
180
- %icon-list-ol { content: '\f0cb'; }
181
- %icon-strikethrough { content: '\f0cc'; }
182
- %icon-underline { content: '\f0cd'; }
183
- %icon-table { content: '\f0ce'; }
184
- %icon-magic { content: '\f0d0'; }
185
- %icon-truck { content: '\f0d1'; }
186
- %icon-pinterest { content: '\f0d2'; }
187
- %icon-pinterest-sign { content: '\f0d3'; }
188
- %icon-google-plus-sign { content: '\f0d4'; }
189
- %icon-google-plus { content: '\f0d5'; }
190
- %icon-money { content: '\f0d6'; }
191
- %icon-caret-down { content: '\f0d7'; }
192
- %icon-caret-up { content: '\f0d8'; }
193
- %icon-caret-left { content: '\f0d9'; }
194
- %icon-caret-right { content: '\f0da'; }
195
- %icon-columns { content: '\f0db'; }
196
- %icon-sort { content: '\f0dc'; }
197
- %icon-sort-down { content: '\f0dd'; }
198
- %icon-sort-up { content: '\f0de'; }
199
- %icon-envelope-alt { content: '\f0e0'; }
200
- %icon-linkedin { content: '\f0e1'; }
201
- %icon-undo { content: '\f0e2'; }
202
- %icon-legal { content: '\f0e3'; }
203
- %icon-dashboard { content: '\f0e4'; }
204
- %icon-comment-alt { content: '\f0e5'; }
205
- %icon-comments-alt { content: '\f0e6'; }
206
- %icon-bolt { content: '\f0e7'; }
207
- %icon-sitemap { content: '\f0e8'; }
208
- %icon-umbrella { content: '\f0e9'; }
209
- %icon-paste { content: '\f0ea'; }
210
- %icon-user-md { content: '\f200'; }
@@ -1,20 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe UpdateSassTask do
4
- subject(:task) { UpdateSassTask.new }
5
-
6
- def mock_icon(name, hex_code)
7
- stub(name: name, hex_code: stub(to_css: "\\#{hex_code}"))
8
- end
9
-
10
- describe "#run" do
11
- it "writes scss placeholders for icon content" do
12
- task.stubs(:puts)
13
- FontAwesome::Icon.stubs(:all).returns([mock_icon("pizza", "f00d"), mock_icon("linux", "f055")])
14
- task.expects(:open_file).with("app/assets/stylesheets/font-awesome/_icons.scss", "w").yields(mock{
15
- expects(:write).with("%icon-pizza { content: '\\f00d'; }\n%icon-linux { content: '\\f055'; }\n")
16
- })
17
- task.run
18
- end
19
- end
20
- end
@@ -1,6 +0,0 @@
1
- namespace :update do
2
- task :sass do
3
- require_relative "update_sass_task"
4
- UpdateSassTask.new.run
5
- end
6
- end
@@ -1,20 +0,0 @@
1
- require_relative "../task"
2
- require "font_awesome/icon"
3
-
4
- class UpdateSassTask < Task
5
- def run
6
- puts "* Updating #{path}"
7
-
8
- open_file(path, "w") {|file| file.write contents }
9
- end
10
-
11
- def contents
12
- FontAwesome::Icon.all.map do |icon|
13
- "%icon-#{icon.name} { content: '#{icon.hex_code.to_css}'; }\n"
14
- end.join
15
- end
16
-
17
- def path
18
- "app/assets/stylesheets/font-awesome/_icons.scss"
19
- end
20
- end