Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Enforce semantic versioning of dependencies

  • Loading branch information...
commit 2c0224c4350daf3c02e5c88557c12655cb6f9f04 1 parent a662a1a
@croaky croaky authored
View
30 Gemfile.lock
@@ -7,31 +7,31 @@ PATH
GEM
remote: http://rubygems.org/
specs:
- diff-lcs (1.1.2)
+ diff-lcs (1.2.1)
rack (1.3.1)
rack-test (0.6.0)
rack (>= 1.0)
- rake (0.9.2.2)
- rspec (2.6.0)
- rspec-core (~> 2.6.0)
- rspec-expectations (~> 2.6.0)
- rspec-mocks (~> 2.6.0)
- rspec-core (2.6.4)
- rspec-expectations (2.6.0)
- diff-lcs (~> 1.1.2)
- rspec-mocks (2.6.0)
+ rake (10.0.3)
+ rspec (2.13.0)
+ rspec-core (~> 2.13.0)
+ rspec-expectations (~> 2.13.0)
+ rspec-mocks (~> 2.13.0)
+ rspec-core (2.13.1)
+ rspec-expectations (2.13.0)
+ diff-lcs (>= 1.1.3, < 2.0)
+ rspec-mocks (2.13.0)
sinatra (1.2.7)
rack (~> 1.1)
tilt (>= 1.2.2, < 2.0)
tilt (1.3.3)
- timecop (0.3.5)
+ timecop (0.6.1)
PLATFORMS
ruby
DEPENDENCIES
fistface!
- rack-test
- rake
- rspec
- timecop
+ rack-test (~> 0.6)
+ rake (~> 10.0)
+ rspec (~> 2.13)
+ timecop (~> 0.6)
View
37 fistface.gemspec
@@ -1,27 +1,22 @@
# -*- encoding: utf-8 -*-
-$:.push File.expand_path("../lib", __FILE__)
-require "fistface/version"
+$:.push File.expand_path('../lib', __FILE__)
+require 'fistface/version'
Gem::Specification.new do |s|
-
- # Dependencies
s.add_dependency('sinatra', '~> 1.1')
- s.add_development_dependency("rspec")
- s.add_development_dependency("rack-test")
- s.add_development_dependency("timecop")
- s.add_development_dependency("rake")
-
- #Configuration
- s.name = 'fistface'
- s.version = Fistface::VERSION
- s.authors = ['Dan Croak']
- s.email = 'support@thoughtbot.com'
- s.homepage = 'http://github.com/thoughtbot/fistface'
- s.summary = 'DIY @font-face web service'
+ s.add_development_dependency('rack-test', '~> 0.6')
+ s.add_development_dependency('rake', '~> 10.0')
+ s.add_development_dependency('rspec', '~> 2.13')
+ s.add_development_dependency('timecop', '~> 0.6')
+ s.authors = ['Dan Croak']
s.description = 'Pow. Right in the kisser.'
-
- s.files = `git ls-files`.split("\n")
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
- s.require_paths = ["lib"]
+ s.email = 'support@thoughtbot.com'
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.files = `git ls-files`.split("\n")
+ s.homepage = 'http://github.com/thoughtbot/fistface'
+ s.name = 'fistface'
+ s.require_paths = ['lib']
+ s.summary = 'DIY @font-face web service'
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.version = FistFace::VERSION
end
View
20 lib/fistface.rb
@@ -16,17 +16,19 @@ def self.registered(app)
end
app.get '/:directory/:font_face' do
- content_type case params[:font_face]
- when /\.ttf$/ then 'font/truetype'
- when /\.otf$/ then 'font/opentype'
- when /\.woff$/ then 'font/woff'
- when /\.eot$/ then 'application/vnd.ms-fontobject'
- when /\.svg$/ then 'image/svg+xml'
- end
+ content_type(
+ case params[:font_face]
+ when /\.ttf$/ then 'font/truetype'
+ when /\.otf$/ then 'font/opentype'
+ when /\.woff$/ then 'font/woff'
+ when /\.eot$/ then 'application/vnd.ms-fontobject'
+ when /\.svg$/ then 'image/svg+xml'
+ end
+ )
open("#{ENV['S3_URL']}/#{params[:directory]}/#{params[:font_face]}").read
end
-
end
end
+
register FistFace
-end
+end
View
4 lib/fistface/version.rb
@@ -1,3 +1,3 @@
-module Fistface
- VERSION = "1.0.1"
+module FistFace
+ VERSION = '1.0.1'
end
View
54 spec/fistface_spec.rb
@@ -1,38 +1,38 @@
require 'spec_helper'
-describe "FistFace" do
+describe 'FistFace' do
include Rack::Test::Methods
def app
@app ||= Sinatra::Application
end
- context "when I GET a font stylesheet by convention of font-name.css" do
+ context 'when I GET a font stylesheet by convention of font-name.css' do
before do
Timecop.freeze(first_of_january)
- get "chunk.css"
+ get 'chunk.css'
end
after { Timecop.return }
- it "responds with HTTP status OK" do
+ it 'responds with HTTP status OK' do
last_response.should be_ok
end
- it "has the @font-face declaration in the CSS body" do
+ it 'has the @font-face declaration in the CSS body' do
last_response.body.should == File.read('spec/fixtures/chunk.css')
end
- it "is in the CSS Content-Type" do
+ it 'is in the CSS Content-Type' do
last_response.content_type.should == 'text/css;charset=utf-8'
end
- it "wildcards the Access-Control-Allow-Origin header so Firefox can access the file" do
+ it 'wildcards the Access-Control-Allow-Origin header so Firefox can access the file' do
last_response.headers['Access-Control-Allow-Origin'].should == '*'
end
- it "HTTP caches the file for a year in Varnish" do
+ it 'HTTP caches the file for a year in HTTP accelerators like Varnish' do
last_response.headers['Cache-Control'].should == 'public, max-age=31536000'
end
@@ -41,28 +41,28 @@ def app
end
end
- context "when I GET a font file by convention of font-name/font-name.ttf" do
+ context 'when I GET a font file by convention of font-name/font-name.ttf' do
before do
Timecop.freeze(first_of_january)
- get "chunk/chunk.ttf"
+ get 'chunk/chunk.ttf'
end
after { Timecop.return }
- it "responds with HTTP status OK" do
+ it 'responds with HTTP status OK' do
last_response.should be_ok
end
- it "is in the truetype Content-Type" do
+ it 'is in the truetype Content-Type' do
last_response.content_type.should == 'font/truetype'
end
- it "wildcards the Access-Control-Allow-Origin header so Firefox can access the file" do
+ it 'wildcards the Access-Control-Allow-Origin header so Firefox can access the file' do
last_response.headers['Access-Control-Allow-Origin'].should == '*'
end
- it "HTTP caches the file for a year in Varnish" do
+ it 'HTTP caches the file for a year in Varnish' do
last_response.headers['Cache-Control'].should == 'public, max-age=31536000'
end
@@ -71,39 +71,39 @@ def app
end
end
- context "when I GET an opentype font" do
- before { get "chunk/chunk.otf" }
+ context 'when I GET an opentype font' do
+ before { get 'chunk/chunk.otf' }
- it "is in the opentype Content-Type" do
+ it 'is in the opentype Content-Type' do
last_response.content_type.should == 'font/opentype'
end
end
- context "when I GET a web open font format font" do
- before { get "chunk/chunk.woff" }
+ context 'when I GET a web open font format font' do
+ before { get 'chunk/chunk.woff' }
- it "is in the web open font format Content-Type" do
+ it 'is in the web open font format Content-Type' do
last_response.content_type.should == 'font/woff'
end
end
- context "when I GET an embedded opentype font" do
- before { get "chunk/chunk.eot" }
+ context 'when I GET an embedded opentype font' do
+ before { get 'chunk/chunk.eot' }
- it "is in the embedded opentype Content-Type" do
+ it 'is in the embedded opentype Content-Type' do
last_response.content_type.should == 'application/vnd.ms-fontobject'
end
end
- context "when I GET an svg font" do
- before { get "chunk/chunk.svg" }
+ context 'when I GET an svg font' do
+ before { get 'chunk/chunk.svg' }
- it "is in the svg Content-Type" do
+ it 'is in the svg Content-Type' do
last_response.content_type.should == 'image/svg+xml'
end
end
def first_of_january
- Date.parse("January 1, 2011")
+ Date.parse('January 1, 2011')
end
end
View
2  spec/spec_helper.rb
@@ -5,4 +5,4 @@
require 'timecop'
ENV['RACK_ENV'] = 'test'
-ENV['S3_URL'] = 'spec/fixtures'
+ENV['S3_URL'] = 'spec/fixtures'
Please sign in to comment.
Something went wrong with that request. Please try again.