web_font 0.1.14 → 0.2.0
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 +4 -4
- data/README.md +2 -11
- data/Rakefile +2 -2
- data/lib/web_font.rb +2 -1
- data/lib/web_font/downloader.rb +1 -1
- data/lib/web_font/http.rb +8 -0
- data/lib/web_font/index.rb +4 -2
- data/lib/web_font/version.rb +1 -1
- metadata +3 -3
- data/lib/web_font/command.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5aed946344dcdee1067007706303701cdfc09e48
|
4
|
+
data.tar.gz: a6e6e750732d54b41c00a0649464f1d5f5946131
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb4143e2072560d356fe76b470394032c5fe1246c4a7064168a8fd1b5b05351e52bb0f0dd2736fa61c6ca028e4c5420ffffa8a01b959c85bdd29db4f9ba01fff
|
7
|
+
data.tar.gz: d052082c7400f5b1bc5649d0dc867c4a55140f61219ca9eac7c481b863a32532f78b05b15b8067db26354d07888d42cc54f242c279b659f4858846ec4f39ee38
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# WebFont
|
2
2
|
|
3
|
-
WebFont is a Ruby library that will help you download fonts from
|
3
|
+
WebFont is a Ruby library that will help you download fonts from the web. For now, we support only [Google Font](http://www.google.com/fonts).
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -16,19 +16,10 @@ Or install it yourself as:
|
|
16
16
|
|
17
17
|
$ gem install web_font
|
18
18
|
|
19
|
-
##
|
20
|
-
|
21
|
-
WebFont depends on [wget](http://en.wikipedia.org/wiki/Wget). Make sure you have it installed first.
|
22
|
-
|
23
|
-
For Ubuntu:
|
24
|
-
```
|
25
|
-
sudo apt-get install wget
|
26
|
-
```
|
19
|
+
## Usage
|
27
20
|
|
28
21
|
To download font from Google, you need to have [Google API Key](https://www.google.com/search?q=google+api+key), then set ``GOOGLE_API_KEY`` environment variable.
|
29
22
|
|
30
|
-
## Usage
|
31
|
-
|
32
23
|
```ruby
|
33
24
|
require 'web_font'
|
34
25
|
|
data/Rakefile
CHANGED
@@ -8,9 +8,9 @@ end
|
|
8
8
|
task default: :test
|
9
9
|
|
10
10
|
# ENV['GOOGLE_API_KEY'] ||= ''
|
11
|
-
WebFont::Index.path = File.
|
11
|
+
WebFont::Index.path = File.join(__dir__, 'cache', 'index')
|
12
12
|
|
13
13
|
WebFont::LocalCache.cache = true
|
14
|
-
WebFont::LocalCache.cache_path = File.
|
14
|
+
WebFont::LocalCache.cache_path = File.join(__dir__, 'cache', 'fonts')
|
15
15
|
|
16
16
|
WebFont::CacheTask.define_tasks!
|
data/lib/web_font.rb
CHANGED
data/lib/web_font/downloader.rb
CHANGED
data/lib/web_font/index.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module WebFont
|
2
2
|
module Index
|
3
3
|
|
4
|
+
INDEX_URL = 'https://www.googleapis.com/webfonts/v1/webfonts'
|
5
|
+
|
4
6
|
class << self
|
5
7
|
attr_accessor :path
|
6
8
|
end
|
@@ -40,9 +42,9 @@ module WebFont
|
|
40
42
|
|
41
43
|
FileUtils.mkdir_p(path) unless Dir.exist?(path)
|
42
44
|
|
43
|
-
|
45
|
+
uri = "#{INDEX_URL}?key=#{ENV['GOOGLE_API_KEY']}"
|
44
46
|
output_path = "#{path}/fonts.json"
|
45
|
-
|
47
|
+
HTTP.get(uri, output_path)
|
46
48
|
|
47
49
|
index
|
48
50
|
end
|
data/lib/web_font/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web_font
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sophy Eung
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,9 +80,9 @@ files:
|
|
80
80
|
- Rakefile
|
81
81
|
- lib/web_font.rb
|
82
82
|
- lib/web_font/cache_task.rb
|
83
|
-
- lib/web_font/command.rb
|
84
83
|
- lib/web_font/downloader.rb
|
85
84
|
- lib/web_font/finder.rb
|
85
|
+
- lib/web_font/http.rb
|
86
86
|
- lib/web_font/index.rb
|
87
87
|
- lib/web_font/local_cache.rb
|
88
88
|
- lib/web_font/version.rb
|