fistface 1.0.1 → 1.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.
- checksums.yaml +15 -0
- data/Gemfile.lock +16 -16
- data/MIT-LICENSE +1 -1
- data/README.md +16 -8
- data/fistface.gemspec +16 -21
- data/lib/fistface.rb +14 -15
- data/lib/fistface/version.rb +2 -2
- data/spec/fistface_spec.rb +28 -28
- data/spec/spec_helper.rb +1 -1
- metadata +47 -40
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZTUxMWRhZmIyOGY3OGE3YzJmMzVlZTY1MWI0ZmI4ZTc5YzRkYzc2OQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZmJjZjVmMjE5MDhhNzk2MjBlN2JiOGI0NTUzOWY0MTI0MWVhZTk5Zg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MTQ1M2Q3OTJlODFlMzU1NTkyZjBiYzkxYjMxNjk0NGUzNGUyYjgzZWQ1OGM4
|
10
|
+
MDM0ZTVhMGU5YjY3N2M0OGRkZDEwZjEyZWFkN2IyNzc3NDA3ZmEyYmRlOTZm
|
11
|
+
ODBkZjQ4ZWZkZWJiYzkzZGM1NDNlNTBjNTU2MTNjYjc1YzZlYTM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YjBiYzU5NjUyMmQ4YjdkZTgzZDc3OTcyYTlmMzk1NDU1OThmNDY2N2EwNWE0
|
14
|
+
NDRjNTc2ZjBmNmU1YjRmMzkxMTc2NWY2MDE3OWI4OTIzNzVkY2MyMTMwNTc5
|
15
|
+
ZmI2YWEwNDIwODgzYTE4NzQ2ZDQ0MmNkMTEzNjExZjNmMTAyMzI=
|
data/Gemfile.lock
CHANGED
@@ -7,31 +7,31 @@ PATH
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
diff-lcs (1.1
|
10
|
+
diff-lcs (1.2.1)
|
11
11
|
rack (1.3.1)
|
12
12
|
rack-test (0.6.0)
|
13
13
|
rack (>= 1.0)
|
14
|
-
rake (0.
|
15
|
-
rspec (2.
|
16
|
-
rspec-core (~> 2.
|
17
|
-
rspec-expectations (~> 2.
|
18
|
-
rspec-mocks (~> 2.
|
19
|
-
rspec-core (2.
|
20
|
-
rspec-expectations (2.
|
21
|
-
diff-lcs (
|
22
|
-
rspec-mocks (2.
|
14
|
+
rake (10.0.3)
|
15
|
+
rspec (2.13.0)
|
16
|
+
rspec-core (~> 2.13.0)
|
17
|
+
rspec-expectations (~> 2.13.0)
|
18
|
+
rspec-mocks (~> 2.13.0)
|
19
|
+
rspec-core (2.13.1)
|
20
|
+
rspec-expectations (2.13.0)
|
21
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
22
|
+
rspec-mocks (2.13.0)
|
23
23
|
sinatra (1.2.7)
|
24
24
|
rack (~> 1.1)
|
25
|
-
tilt (
|
25
|
+
tilt (>= 1.2.2, < 2.0)
|
26
26
|
tilt (1.3.3)
|
27
|
-
timecop (0.
|
27
|
+
timecop (0.6.1)
|
28
28
|
|
29
29
|
PLATFORMS
|
30
30
|
ruby
|
31
31
|
|
32
32
|
DEPENDENCIES
|
33
33
|
fistface!
|
34
|
-
rack-test
|
35
|
-
rake
|
36
|
-
rspec
|
37
|
-
timecop
|
34
|
+
rack-test (~> 0.6)
|
35
|
+
rake (~> 10.0)
|
36
|
+
rspec (~> 2.13)
|
37
|
+
timecop (~> 0.6)
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -24,24 +24,32 @@ Setup
|
|
24
24
|
|
25
25
|
Create a Gemfile:
|
26
26
|
|
27
|
-
source
|
28
|
-
gem
|
29
|
-
gem
|
27
|
+
source 'http://rubygems.org'
|
28
|
+
gem 'sinatra', '~> 1.1'
|
29
|
+
gem 'fistface', '~> 1.0'
|
30
30
|
|
31
31
|
Create a rackup file (config.ru):
|
32
32
|
|
33
33
|
require 'rubygems'
|
34
34
|
require 'bundler'
|
35
35
|
Bundler.require
|
36
|
-
run FistFace
|
36
|
+
run Sinatra::FistFace
|
37
|
+
run Sinatra::Application
|
37
38
|
|
38
|
-
Prepare the production
|
39
|
+
Prepare the app for production:
|
39
40
|
|
40
41
|
bundle install
|
41
42
|
git init
|
42
43
|
git add .
|
43
|
-
git commit -m
|
44
|
-
|
44
|
+
git commit -m 'Creating a Fist Face instance'
|
45
|
+
|
46
|
+
Create the production environment. Use Heroku's Bamboo stack in order to use
|
47
|
+
[Varnish](https://devcenter.heroku.com/articles/http-caching):
|
48
|
+
|
49
|
+
heroku create your-app-name-here --stack bamboo-mri-1.9.2
|
50
|
+
|
51
|
+
Add your S3 bucket:
|
52
|
+
|
45
53
|
heroku config:add S3_URL=https://your-bucket.s3.amazonaws.com
|
46
54
|
|
47
55
|
Do not include a trailing slash.
|
@@ -106,4 +114,4 @@ The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
|
106
114
|
License
|
107
115
|
-------
|
108
116
|
|
109
|
-
Fist Face is Copyright ©
|
117
|
+
Fist Face is Copyright © 2010-2013 thoughtbot, inc. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
|
data/fistface.gemspec
CHANGED
@@ -1,27 +1,22 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path(
|
3
|
-
require
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'fistface/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
|
7
|
-
# Dependencies
|
8
6
|
s.add_dependency('sinatra', '~> 1.1')
|
9
|
-
s.add_development_dependency(
|
10
|
-
s.add_development_dependency(
|
11
|
-
s.add_development_dependency(
|
12
|
-
s.add_development_dependency(
|
13
|
-
|
14
|
-
#Configuration
|
15
|
-
s.name = 'fistface'
|
16
|
-
s.version = Fistface::VERSION
|
17
|
-
s.authors = ['Dan Croak']
|
18
|
-
s.email = 'support@thoughtbot.com'
|
19
|
-
s.homepage = 'http://github.com/thoughtbot/fistface'
|
20
|
-
s.summary = 'DIY @font-face web service'
|
7
|
+
s.add_development_dependency('rack-test', '~> 0.6')
|
8
|
+
s.add_development_dependency('rake', '~> 10.0')
|
9
|
+
s.add_development_dependency('rspec', '~> 2.13')
|
10
|
+
s.add_development_dependency('timecop', '~> 0.6')
|
11
|
+
s.authors = ['Dan Croak']
|
21
12
|
s.description = 'Pow. Right in the kisser.'
|
22
|
-
|
23
|
-
s.
|
24
|
-
s.
|
25
|
-
s.
|
26
|
-
s.
|
13
|
+
s.email = 'support@thoughtbot.com'
|
14
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.homepage = 'http://github.com/thoughtbot/fistface'
|
17
|
+
s.name = 'fistface'
|
18
|
+
s.require_paths = ['lib']
|
19
|
+
s.summary = 'DIY @font-face web service'
|
20
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
s.version = FistFace::VERSION
|
27
22
|
end
|
data/lib/fistface.rb
CHANGED
@@ -6,30 +6,29 @@ module Sinatra
|
|
6
6
|
|
7
7
|
def self.registered(app)
|
8
8
|
app.before do
|
9
|
-
|
10
|
-
|
11
|
-
headers 'Cache-Control' => "public, max-age=#{one_year_in_seconds}",
|
12
|
-
'Expires' => (Time.now + one_year_in_seconds).httpdate,
|
13
|
-
'Access-Control-Allow-Origin' => '*'
|
9
|
+
expires 31536000, :public
|
10
|
+
headers 'Access-Control-Allow-Origin' => '*'
|
14
11
|
end
|
15
12
|
|
16
13
|
app.get '/:font_face.css' do
|
17
|
-
|
14
|
+
content_type 'text/css'
|
18
15
|
open("#{ENV['S3_URL']}/#{params[:font_face]}.css").read
|
19
16
|
end
|
20
17
|
|
21
18
|
app.get '/:directory/:font_face' do
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
19
|
+
content_type(
|
20
|
+
case params[:font_face]
|
21
|
+
when /\.ttf$/ then 'font/truetype'
|
22
|
+
when /\.otf$/ then 'font/opentype'
|
23
|
+
when /\.woff$/ then 'font/woff'
|
24
|
+
when /\.eot$/ then 'application/vnd.ms-fontobject'
|
25
|
+
when /\.svg$/ then 'image/svg+xml'
|
26
|
+
end
|
27
|
+
)
|
29
28
|
open("#{ENV['S3_URL']}/#{params[:directory]}/#{params[:font_face]}").read
|
30
29
|
end
|
31
|
-
|
32
30
|
end
|
33
31
|
end
|
32
|
+
|
34
33
|
register FistFace
|
35
|
-
end
|
34
|
+
end
|
data/lib/fistface/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION =
|
1
|
+
module FistFace
|
2
|
+
VERSION = '1.0.2'
|
3
3
|
end
|
data/spec/fistface_spec.rb
CHANGED
@@ -1,38 +1,38 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe 'FistFace' do
|
4
4
|
include Rack::Test::Methods
|
5
5
|
|
6
6
|
def app
|
7
7
|
@app ||= Sinatra::Application
|
8
8
|
end
|
9
9
|
|
10
|
-
context
|
10
|
+
context 'when I GET a font stylesheet by convention of font-name.css' do
|
11
11
|
before do
|
12
12
|
Timecop.freeze(first_of_january)
|
13
13
|
|
14
|
-
get
|
14
|
+
get 'chunk.css'
|
15
15
|
end
|
16
16
|
|
17
17
|
after { Timecop.return }
|
18
18
|
|
19
|
-
it
|
19
|
+
it 'responds with HTTP status OK' do
|
20
20
|
last_response.should be_ok
|
21
21
|
end
|
22
22
|
|
23
|
-
it
|
23
|
+
it 'has the @font-face declaration in the CSS body' do
|
24
24
|
last_response.body.should == File.read('spec/fixtures/chunk.css')
|
25
25
|
end
|
26
26
|
|
27
|
-
it
|
28
|
-
last_response.content_type.should == 'text/css'
|
27
|
+
it 'is in the CSS Content-Type' do
|
28
|
+
last_response.content_type.should == 'text/css;charset=utf-8'
|
29
29
|
end
|
30
30
|
|
31
|
-
it
|
31
|
+
it 'wildcards the Access-Control-Allow-Origin header so Firefox can access the file' do
|
32
32
|
last_response.headers['Access-Control-Allow-Origin'].should == '*'
|
33
33
|
end
|
34
34
|
|
35
|
-
it
|
35
|
+
it 'HTTP caches the file for a year in HTTP accelerators like Varnish' do
|
36
36
|
last_response.headers['Cache-Control'].should == 'public, max-age=31536000'
|
37
37
|
end
|
38
38
|
|
@@ -41,28 +41,28 @@ describe "FistFace" do
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
context
|
44
|
+
context 'when I GET a font file by convention of font-name/font-name.ttf' do
|
45
45
|
before do
|
46
46
|
Timecop.freeze(first_of_january)
|
47
47
|
|
48
|
-
get
|
48
|
+
get 'chunk/chunk.ttf'
|
49
49
|
end
|
50
50
|
|
51
51
|
after { Timecop.return }
|
52
52
|
|
53
|
-
it
|
53
|
+
it 'responds with HTTP status OK' do
|
54
54
|
last_response.should be_ok
|
55
55
|
end
|
56
56
|
|
57
|
-
it
|
57
|
+
it 'is in the truetype Content-Type' do
|
58
58
|
last_response.content_type.should == 'font/truetype'
|
59
59
|
end
|
60
60
|
|
61
|
-
it
|
61
|
+
it 'wildcards the Access-Control-Allow-Origin header so Firefox can access the file' do
|
62
62
|
last_response.headers['Access-Control-Allow-Origin'].should == '*'
|
63
63
|
end
|
64
64
|
|
65
|
-
it
|
65
|
+
it 'HTTP caches the file for a year in Varnish' do
|
66
66
|
last_response.headers['Cache-Control'].should == 'public, max-age=31536000'
|
67
67
|
end
|
68
68
|
|
@@ -71,39 +71,39 @@ describe "FistFace" do
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
-
context
|
75
|
-
before { get
|
74
|
+
context 'when I GET an opentype font' do
|
75
|
+
before { get 'chunk/chunk.otf' }
|
76
76
|
|
77
|
-
it
|
77
|
+
it 'is in the opentype Content-Type' do
|
78
78
|
last_response.content_type.should == 'font/opentype'
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
context
|
83
|
-
before { get
|
82
|
+
context 'when I GET a web open font format font' do
|
83
|
+
before { get 'chunk/chunk.woff' }
|
84
84
|
|
85
|
-
it
|
85
|
+
it 'is in the web open font format Content-Type' do
|
86
86
|
last_response.content_type.should == 'font/woff'
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
-
context
|
91
|
-
before { get
|
90
|
+
context 'when I GET an embedded opentype font' do
|
91
|
+
before { get 'chunk/chunk.eot' }
|
92
92
|
|
93
|
-
it
|
93
|
+
it 'is in the embedded opentype Content-Type' do
|
94
94
|
last_response.content_type.should == 'application/vnd.ms-fontobject'
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
-
context
|
99
|
-
before { get
|
98
|
+
context 'when I GET an svg font' do
|
99
|
+
before { get 'chunk/chunk.svg' }
|
100
100
|
|
101
|
-
it
|
101
|
+
it 'is in the svg Content-Type' do
|
102
102
|
last_response.content_type.should == 'image/svg+xml'
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
106
|
def first_of_january
|
107
|
-
Date.parse(
|
107
|
+
Date.parse('January 1, 2011')
|
108
108
|
end
|
109
109
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,71 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fistface
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Dan Croak
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-03-23 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: sinatra
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.1'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.1'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement:
|
28
|
-
none: false
|
28
|
+
name: rack-test
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- -
|
31
|
+
- - ~>
|
31
32
|
- !ruby/object:Gem::Version
|
32
|
-
version: '0'
|
33
|
+
version: '0.6'
|
33
34
|
type: :development
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.6'
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement:
|
39
|
-
none: false
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
40
44
|
requirements:
|
41
|
-
- -
|
45
|
+
- - ~>
|
42
46
|
- !ruby/object:Gem::Version
|
43
|
-
version: '0'
|
47
|
+
version: '10.0'
|
44
48
|
type: :development
|
45
49
|
prerelease: false
|
46
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
47
55
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement:
|
50
|
-
none: false
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
51
58
|
requirements:
|
52
|
-
- -
|
59
|
+
- - ~>
|
53
60
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
61
|
+
version: '2.13'
|
55
62
|
type: :development
|
56
63
|
prerelease: false
|
57
|
-
version_requirements:
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.13'
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
|
-
name:
|
60
|
-
requirement:
|
61
|
-
none: false
|
70
|
+
name: timecop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
62
72
|
requirements:
|
63
|
-
- -
|
73
|
+
- - ~>
|
64
74
|
- !ruby/object:Gem::Version
|
65
|
-
version: '0'
|
75
|
+
version: '0.6'
|
66
76
|
type: :development
|
67
77
|
prerelease: false
|
68
|
-
version_requirements:
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.6'
|
69
83
|
description: Pow. Right in the kisser.
|
70
84
|
email: support@thoughtbot.com
|
71
85
|
executables: []
|
@@ -91,33 +105,26 @@ files:
|
|
91
105
|
- spec/spec_helper.rb
|
92
106
|
homepage: http://github.com/thoughtbot/fistface
|
93
107
|
licenses: []
|
108
|
+
metadata: {}
|
94
109
|
post_install_message:
|
95
110
|
rdoc_options: []
|
96
111
|
require_paths:
|
97
112
|
- lib
|
98
113
|
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
114
|
requirements:
|
101
115
|
- - ! '>='
|
102
116
|
- !ruby/object:Gem::Version
|
103
117
|
version: '0'
|
104
|
-
segments:
|
105
|
-
- 0
|
106
|
-
hash: 1911532667743223418
|
107
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
-
none: false
|
109
119
|
requirements:
|
110
120
|
- - ! '>='
|
111
121
|
- !ruby/object:Gem::Version
|
112
122
|
version: '0'
|
113
|
-
segments:
|
114
|
-
- 0
|
115
|
-
hash: 1911532667743223418
|
116
123
|
requirements: []
|
117
124
|
rubyforge_project:
|
118
|
-
rubygems_version:
|
125
|
+
rubygems_version: 2.0.0
|
119
126
|
signing_key:
|
120
|
-
specification_version:
|
127
|
+
specification_version: 4
|
121
128
|
summary: DIY @font-face web service
|
122
129
|
test_files:
|
123
130
|
- spec/fistface_spec.rb
|