fistface 1.0.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.
Files changed (2) hide show
  1. data/lib/fistface.rb +30 -0
  2. metadata +81 -0
data/lib/fistface.rb ADDED
@@ -0,0 +1,30 @@
1
+ require 'sinatra/base'
2
+ require 'open-uri'
3
+
4
+ class FistFace < Sinatra::Base
5
+ set :app_file, __FILE__
6
+
7
+ before do
8
+ one_year_in_seconds = 31536000
9
+
10
+ headers 'Cache-Control' => "public, max-age=#{one_year_in_seconds}",
11
+ 'Expires' => (Time.now + one_year_in_seconds).httpdate,
12
+ 'Access-Control-Allow-Origin' => '*'
13
+ end
14
+
15
+ get '/:font_face.css' do
16
+ headers['Content-Type'] = 'text/css'
17
+ open("#{ENV['S3_URL']}/#{params[:font_face]}.css").read
18
+ end
19
+
20
+ get '/:directory/:font_face' do
21
+ headers['Content-Type'] = case params[:font_face]
22
+ when /\.ttf$/ then 'font/truetype'
23
+ when /\.otf$/ then 'font/opentype'
24
+ when /\.woff$/ then 'font/woff'
25
+ when /\.eot$/ then 'application/vnd.ms-fontobject'
26
+ when /\.svg$/ then 'image/svg+xml'
27
+ end
28
+ open("#{ENV['S3_URL']}/#{params[:directory]}/#{params[:font_face]}").read
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fistface
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Dan Croak
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-12 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: sinatra
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 13
30
+ segments:
31
+ - 1
32
+ - 1
33
+ version: "1.1"
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ description: Pow. Right in the kisser.
37
+ email: support@thoughtbot.com
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - lib/fistface.rb
46
+ has_rdoc: true
47
+ homepage: http://github.com/thoughtbot/fistface
48
+ licenses: []
49
+
50
+ post_install_message:
51
+ rdoc_options: []
52
+
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 3
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ hash: 3
70
+ segments:
71
+ - 0
72
+ version: "0"
73
+ requirements: []
74
+
75
+ rubyforge_project:
76
+ rubygems_version: 1.3.7
77
+ signing_key:
78
+ specification_version: 3
79
+ summary: DIY @font-face web service
80
+ test_files: []
81
+