jitai 0.2.21 → 0.2.22
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/jitai.gemspec +1 -1
- data/lib/jitai.rb +25 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.22
|
data/jitai.gemspec
CHANGED
data/lib/jitai.rb
CHANGED
@@ -2,15 +2,38 @@ module Jitai
|
|
2
2
|
require 'jitai/railtie.rb' if defined?(Rails)
|
3
3
|
|
4
4
|
class FontManager
|
5
|
-
attr_accessor :moz_path, :ie_path
|
5
|
+
attr_accessor :moz_path, :ie_path, :cwd
|
6
6
|
|
7
7
|
def initialize(path= "public")
|
8
8
|
@moz_path = "#{path}/stylesheets/fonts_moz.css"
|
9
9
|
@ie_path = "#{path}/stylesheets/fonts_ie.css"
|
10
|
+
@cwd = "public/fonts"
|
10
11
|
end
|
11
12
|
|
12
13
|
def refresh
|
13
|
-
|
14
|
+
Dir.mkdir(@cwd) if !(File.directory? @cwd)
|
15
|
+
Dir.foreach(@cwd) do |font_file|
|
16
|
+
if !(File.directory?(font_file))
|
17
|
+
# Search for two different formats
|
18
|
+
conversion_type = (File.extname(font_file).downcase.eql? ".ttf")? ".eot" : ".ttf"
|
19
|
+
other_basename = font_file.split(".")[0] + conversion_type
|
20
|
+
other_file = "./#{@cwd}#{other_basename}"
|
21
|
+
file = "./#{@cwd}#{font_file}"
|
22
|
+
|
23
|
+
# TODO edit ttf2eot so that it's actually installed in the system
|
24
|
+
if !File.exists?(other_file)
|
25
|
+
puts "===== #{conversion_type.upcase} format not found. Attempting to convert... ====="
|
26
|
+
%x{cd ttf2eot && ./ttf2eot < #{'../' + @cwd + font_file} > #{'../' + @cwd + font_file.split(".")[0] + conversion_type}}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Rename files, account for conventions.
|
30
|
+
%x{mv #{other_file} #{other_file.downcase}} if !(File.exists?(other_file.downcase))
|
31
|
+
%x{mv #{file} #{file.downcase}} if !(File.exists?(file.downcase))
|
32
|
+
|
33
|
+
font = Jitai::Font.new(font_file)
|
34
|
+
font.to_css
|
35
|
+
end
|
36
|
+
end
|
14
37
|
end
|
15
38
|
end
|
16
39
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jitai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 59
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 22
|
10
|
+
version: 0.2.22
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- kellydunn
|