fontrobot 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ .DS_Store
1
2
  *.gem
2
3
  *.rbc
3
4
  .bundle
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.5 (2/19/2013)
2
+
3
+ * Fixed file cleanup method. Fixed specs
4
+
1
5
  ## 0.1.4 (2/19/2013)
2
6
 
3
7
  * Instructions for stopping watcher ([#46](https://github.com/FontCustom/fontcustom/issues/46))
@@ -49,14 +49,17 @@ module Fontrobot
49
49
  end
50
50
 
51
51
  def cleanup_output_dir
52
+ # simpler: how about we just delete everything in the dir?
53
+ # old_files = Dir[File.join(@output, '*')]
54
+ # old_files.each {|file| remove_file file }
52
55
  old_files = ['fontrobot.css','fontrobot-ie7.css','test.html']
53
56
  old_name = 'fontrobot'
54
57
  css = File.join(@output, old_files[0])
55
- if File.exists?(css)
58
+ if File.file?(css)
56
59
  line = IO.readlines(css)[3]
57
60
  old_name = line.match(/Path:([^-]+)/)[1].downcase
58
61
  end
59
- old_files.concat(Dir[File.join(@output, old_name + '-*.{woff,ttf,eot,svg}')])
62
+ old_files.concat(Dir[File.join(old_name + '-*.{woff,ttf,eot,svg}')])
60
63
  old_files.each { |file| remove_file File.join(@output, file) }
61
64
  end
62
65
 
@@ -1,3 +1,3 @@
1
1
  module Fontrobot
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -5,30 +5,29 @@ describe Fontrobot::Generator do
5
5
  let(:output_dir) { 'tmp' }
6
6
 
7
7
  context 'normally' do
8
- before(:all) { Fontrobot::Generator.start([input_dir, '-o', output_dir]) }
9
8
  after(:all) { cleanup(output_dir) }
10
9
 
11
10
  it 'should create webfonts' do
11
+ Fontrobot::Generator.start([input_dir, '-o', output_dir])
12
12
  exts = %w( .woff .eot .ttf .svg )
13
13
  files = Dir[output_dir + '/*']
14
14
  files.map! { |file| File.extname(file) }
15
-
16
15
  exts.each { |ext| files.should include(ext) }
17
16
  end
18
17
 
19
18
  it 'should print font-face declarations in fontrobot.css' do
19
+ Fontrobot::Generator.start([input_dir, '-o', output_dir])
20
20
  stylesheet = File.read(output_dir + '/fontrobot.css')
21
21
  files = Dir[output_dir + '/*.{woff,eot,ttf,svg}']
22
-
23
22
  files.each do |file|
24
23
  stylesheet.should include(File.basename(file))
25
24
  end
26
25
  end
27
26
 
28
27
  it 'should print icon-* CSS classes in fontrobot.css' do
28
+ Fontrobot::Generator.start([input_dir, '-o', output_dir])
29
29
  stylesheet = File.read(output_dir + '/fontrobot.css')
30
30
  icon_names = Dir[input_dir + '/*'].map { |file| File.basename(file)[0..-5].gsub(/\W/, '-').downcase }
31
-
32
31
  icon_names.each do |name|
33
32
  stylesheet.should include('.icon-' + name)
34
33
  end
@@ -36,6 +35,7 @@ describe Fontrobot::Generator do
36
35
  end
37
36
 
38
37
  context 'when input_dir does not exist' do
38
+ after(:all) { cleanup(output_dir) }
39
39
  let(:fake_input_dir) { 'does/not/exist' }
40
40
 
41
41
  it 'should raise an error' do
@@ -45,6 +45,7 @@ describe Fontrobot::Generator do
45
45
  end
46
46
 
47
47
  context 'when input_dir does not contain vectors' do
48
+ after(:all) { cleanup(output_dir) }
48
49
  let(:empty_input_dir) { 'spec/fixtures/empty' }
49
50
 
50
51
  it 'should raise an error' do
@@ -54,22 +55,59 @@ describe Fontrobot::Generator do
54
55
  end
55
56
 
56
57
  context 'when flags are passed' do
58
+ after(:all) { cleanup(output_dir) }
59
+
57
60
  it 'should save output files with a custom name' do
58
61
  Fontrobot::Generator.start([input_dir, '-o', output_dir, '-n', 'customname'])
59
-
60
62
  file = Dir[File.join(output_dir, 'customname-*.ttf')].first
61
63
  File.exists?(file).should be_true
62
-
63
- cleanup(output_dir)
64
64
  end
65
65
 
66
66
  it 'should exclude the filename hash' do
67
67
  Fontrobot::Generator.start([input_dir, '-o', output_dir, '--nohash'])
68
-
69
68
  file = File.join(output_dir, 'fontrobot.ttf')
70
69
  File.exists?(file).should be_true
70
+ end
71
+
72
+ it 'should output an html test file' do
73
+ Fontrobot::Generator.start([input_dir, '-o', output_dir, '--html'])
74
+ file = File.join(output_dir, 'test.html')
75
+ File.exists?(file).should be_true
76
+ end
77
+
78
+ it 'should output .scss files' do
79
+ Fontrobot::Generator.start([input_dir, '-o', output_dir, '--scss'])
80
+ file = File.join(output_dir, 'fontrobot.scss')
81
+ File.exists?(file).should be_true
82
+ end
83
+
84
+ it 'should reorder the font sources' do
85
+ font_order = 'eot,woff,ttf,svg'
86
+ Fontrobot::Generator.start([input_dir, '-o', output_dir, '-r', font_order])
87
+ stylesheet = File.read(output_dir + '/fontrobot.css')
88
+ fontface = stylesheet.match(/@font-face[^}]+/)
89
+ fonts = fontface[0].scan(/fontrobot-[a-z0-9]+.([a-z]+)/).flatten.join(',')
90
+ fonts.should == font_order
91
+ end
92
+
93
+ it 'should set a custom font path' do
94
+ Fontrobot::Generator.start([input_dir, '-o', output_dir, '-f', 'wiggly'])
95
+ stylesheet = File.read(output_dir + '/fontrobot.css')
96
+ stylesheet.should include('wiggly')
97
+ end
71
98
 
72
- cleanup(output_dir)
99
+ it 'should include a data uri' do
100
+ Fontrobot::Generator.start([input_dir, '-o', output_dir, '-i', 'woff'])
101
+ stylesheet = File.read(output_dir + '/fontrobot.css')
102
+ stylesheet.should include('url(data:')
73
103
  end
104
+
105
+ it 'should include two @font-face declarations if it includes a data-uri' do
106
+ Fontrobot::Generator.start([input_dir, '-o', output_dir, '-i', 'woff'])
107
+ stylesheet = File.read(output_dir + '/fontrobot.css')
108
+ fontfaces = stylesheet.scan(/@font-face/)
109
+ fontfaces.length.should == 2
110
+ end
111
+
74
112
  end
75
113
  end
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fontrobot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Tim Barkow
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-03-21 00:00:00.000000000 Z
12
+ date: 2013-04-12 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: json
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ! '>='
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ! '>='
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: thor
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ! '>='
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ! '>='
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: listen
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ! '>='
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ! '>='
53
60
  - !ruby/object:Gem::Version
@@ -55,6 +62,7 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: rake
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - ! '>='
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - ! '>='
67
76
  - !ruby/object:Gem::Version
@@ -69,6 +78,7 @@ dependencies:
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: bundler
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
83
  - - ! '>='
74
84
  - !ruby/object:Gem::Version
@@ -76,6 +86,7 @@ dependencies:
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
91
  - - ! '>='
81
92
  - !ruby/object:Gem::Version
@@ -83,6 +94,7 @@ dependencies:
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: rspec
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
99
  - - ! '>='
88
100
  - !ruby/object:Gem::Version
@@ -90,6 +102,7 @@ dependencies:
90
102
  type: :development
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
107
  - - ! '>='
95
108
  - !ruby/object:Gem::Version
@@ -97,6 +110,7 @@ dependencies:
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: fakefs
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
115
  - - ! '>='
102
116
  - !ruby/object:Gem::Version
@@ -104,6 +118,7 @@ dependencies:
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
123
  - - ! '>='
109
124
  - !ruby/object:Gem::Version
@@ -111,6 +126,7 @@ dependencies:
111
126
  - !ruby/object:Gem::Dependency
112
127
  name: spork
113
128
  requirement: !ruby/object:Gem::Requirement
129
+ none: false
114
130
  requirements:
115
131
  - - ! '>='
116
132
  - !ruby/object:Gem::Version
@@ -118,6 +134,7 @@ dependencies:
118
134
  type: :development
119
135
  prerelease: false
120
136
  version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
121
138
  requirements:
122
139
  - - ! '>='
123
140
  - !ruby/object:Gem::Version
@@ -125,6 +142,7 @@ dependencies:
125
142
  - !ruby/object:Gem::Dependency
126
143
  name: guard-spork
127
144
  requirement: !ruby/object:Gem::Requirement
145
+ none: false
128
146
  requirements:
129
147
  - - ! '>='
130
148
  - !ruby/object:Gem::Version
@@ -132,6 +150,7 @@ dependencies:
132
150
  type: :development
133
151
  prerelease: false
134
152
  version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
135
154
  requirements:
136
155
  - - ! '>='
137
156
  - !ruby/object:Gem::Version
@@ -139,6 +158,7 @@ dependencies:
139
158
  - !ruby/object:Gem::Dependency
140
159
  name: guard-rspec
141
160
  requirement: !ruby/object:Gem::Requirement
161
+ none: false
142
162
  requirements:
143
163
  - - ! '>='
144
164
  - !ruby/object:Gem::Version
@@ -146,6 +166,7 @@ dependencies:
146
166
  type: :development
147
167
  prerelease: false
148
168
  version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
149
170
  requirements:
150
171
  - - ! '>='
151
172
  - !ruby/object:Gem::Version
@@ -153,6 +174,7 @@ dependencies:
153
174
  - !ruby/object:Gem::Dependency
154
175
  name: rb-fsevent
155
176
  requirement: !ruby/object:Gem::Requirement
177
+ none: false
156
178
  requirements:
157
179
  - - ~>
158
180
  - !ruby/object:Gem::Version
@@ -160,6 +182,7 @@ dependencies:
160
182
  type: :development
161
183
  prerelease: false
162
184
  version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
163
186
  requirements:
164
187
  - - ~>
165
188
  - !ruby/object:Gem::Version
@@ -198,7 +221,7 @@ files:
198
221
  - spec/fixtures/vectors/C.svg
199
222
  - spec/fixtures/vectors/D.svg
200
223
  - spec/fixtures/vectors/a_R3ally-eXotic f1Le Name.svg
201
- - spec/fontrobot/fontcustom_spec.rb
224
+ - spec/fontrobot/fontrobot_spec.rb
202
225
  - spec/fontrobot/generator_spec.rb
203
226
  - spec/fontrobot/watcher_spec.rb.off
204
227
  - spec/spec_helper.rb
@@ -206,33 +229,34 @@ homepage: http://github.com/robotloveskitten/fontrobot/
206
229
  licenses:
207
230
  - MIT
208
231
  - MPL 1.1/GPL 2.0/LGPL 2.1
209
- metadata: {}
210
232
  post_install_message:
211
233
  rdoc_options: []
212
234
  require_paths:
213
235
  - lib
214
236
  required_ruby_version: !ruby/object:Gem::Requirement
237
+ none: false
215
238
  requirements:
216
239
  - - ! '>='
217
240
  - !ruby/object:Gem::Version
218
241
  version: '0'
219
242
  required_rubygems_version: !ruby/object:Gem::Requirement
243
+ none: false
220
244
  requirements:
221
245
  - - ! '>='
222
246
  - !ruby/object:Gem::Version
223
247
  version: '0'
224
248
  requirements: []
225
249
  rubyforge_project:
226
- rubygems_version: 2.0.3
250
+ rubygems_version: 1.8.23
227
251
  signing_key:
228
- specification_version: 4
252
+ specification_version: 3
229
253
  summary: Generate custom icon webfonts from the command line.
230
254
  test_files:
231
255
  - spec/fixtures/empty/no_vectors_here.txt
232
256
  - spec/fixtures/vectors/C.svg
233
257
  - spec/fixtures/vectors/D.svg
234
258
  - spec/fixtures/vectors/a_R3ally-eXotic f1Le Name.svg
235
- - spec/fontrobot/fontcustom_spec.rb
259
+ - spec/fontrobot/fontrobot_spec.rb
236
260
  - spec/fontrobot/generator_spec.rb
237
261
  - spec/fontrobot/watcher_spec.rb.off
238
262
  - spec/spec_helper.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: c0b7c4b28b299073f873fd58d5b28e78017acb87
4
- data.tar.gz: d002ee1ca10d13d129c8a346ae03f77b719078ce
5
- SHA512:
6
- metadata.gz: 89d295c7fd502dead4671d77e2ad6be2d4ab9f245572f46856361346aa7c463c1d3de0a2cdad4a58f433fc9d7e1b3acb2f838600db837e3a2cab792a56c12256
7
- data.tar.gz: 3e50dd1531aafbdf1d730e249270898a8f1f8e8092c77a57c6f2b2c19c5b24af74e0d1dcd7027520939f60a1e2a81680e6aa530ca6bbe65f3978aa5f2b0e0d72