web_font 0.1.1 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a482019fbce41a01da44c56c1a1bf9f47f5f9cd
4
- data.tar.gz: 803ef687fe868e65c5349372e4850d1f0d60b66b
3
+ metadata.gz: 8e82c28cd61268d82e7d3925b5988649d6d102ac
4
+ data.tar.gz: e8767e9107e5b23510a13e66419254210ef7331f
5
5
  SHA512:
6
- metadata.gz: d037243c8047af105ac1fb1ef08b74f515d8d858488991c5fd15d7fd6af7d0fdd11395098e3da84d5f175fb4960b1cf72f2867e2396c072a2a9f6758c6560622
7
- data.tar.gz: ccd9bddc563acf33f002777c30a15ebdb08ccd4cbe85a22de8cc12fa9b275c104d752082f6cf377b1bc95cb4150827ce6e6d692633dbd657414861de5e65230c
6
+ metadata.gz: b6fedf64c46588879edd0de43347a48c031ea8b22b212f0bf1f3026f6508848b6eab60f7a4e028cba1f7bff1a4336b71c47c8e71513405d1c27ec48182bdd644
7
+ data.tar.gz: db6837dd1172c41666544677078d637a36855c3a46f762280e8e4b81a811a096b5fd37a4295b30e96beaf62b31a68446039f3dac79a6cb79ba155c17c53bb977
@@ -4,7 +4,7 @@ module WebFont
4
4
  attr_reader :finder
5
5
 
6
6
  def initialize
7
- @finder = WebFont::Finder.new
7
+ @finder = Finder.new
8
8
  end
9
9
 
10
10
  # Download font from Google and save it locally
@@ -23,7 +23,7 @@ module WebFont
23
23
  FileUtils.copy(cache_path, destination_path)
24
24
  else
25
25
  unless File.exist?(font_path)
26
- WebFont::Command.wget(url, font_path)
26
+ Command.wget(url, font_path)
27
27
  LocalCache.save(font_path)
28
28
  end
29
29
  end
@@ -46,7 +46,7 @@ module WebFont
46
46
  end
47
47
 
48
48
  def read_json(filename)
49
- path = File.join(WebFont::Index.path, filename)
49
+ path = File.join(Index.path, filename)
50
50
  File.open(path) { |file| JSON.parse(file.read) }
51
51
  end
52
52
 
@@ -42,7 +42,7 @@ module WebFont
42
42
 
43
43
  url = "https://www.googleapis.com/webfonts/v1/webfonts?key=#{ENV['GOOGLE_API_KEY']}"
44
44
  output_path = "#{path}/fonts.json"
45
- WebFont::Command.wget(url, output_path)
45
+ Command.wget(url, output_path)
46
46
 
47
47
  index
48
48
  end
@@ -9,8 +9,13 @@ module WebFont
9
9
  end
10
10
 
11
11
  def save(font)
12
+ return nil unless cache_path
13
+
12
14
  filename = File.basename(font)
13
- FileUtils.copy(font, File.join(cache_path, filename))
15
+ path = File.join(cache_path, filename)
16
+ FileUtils.copy(font, path)
17
+
18
+ path
14
19
  end
15
20
 
16
21
  def enable?
@@ -1,3 +1,3 @@
1
1
  module WebFont
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_font
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sophy Eung