rack-fontserve 0.1.2 → 0.1.3

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.
data/README.rdoc CHANGED
@@ -25,18 +25,18 @@ as the directory:
25
25
  + iconic_stroke.ttf
26
26
  + iconic_stroke.svg
27
27
 
28
- That's it! Run with `rackup`, push to heroku, or mount it in an existing Rails 3 app by adding rack-fontserve to your gemfile,
28
+ That's it! Run with +rackup+, push to heroku, or mount it in an existing Rails 3 app by adding rack-fontserve to your gemfile,
29
29
  setting the fonts path and mounting the app in your routes.rb file:
30
30
 
31
31
  mount Rack::Fontserve, :at => "/fonts"
32
32
 
33
- You can see a demo of all fonts in the fonts_path at /demo.
33
+ You can see a demo of all fonts in the fonts_path at the root page (/). To deactivate demo mode, use +Rack::Fontserve.set :demo, false+.
34
34
 
35
35
  The font name is the name of the font's directory, so in the above example, the font would be called 'iconic_stroke'.
36
36
 
37
37
  == Custom font CSS
38
38
 
39
- When a `font_name.css` file is found in the subdirectory, this file will be rendered instead of the auto-generated css. If you
39
+ When a +font_name.css+ file is found in the subdirectory, this file will be rendered instead of the auto-generated css. If you
40
40
  want to tweak your css settings, copy and paste the auto-generated css into such a file and customize it to your liking!
41
41
 
42
42
  == Incorporate font licenses into CSS
@@ -16,6 +16,7 @@ module Rack
16
16
 
17
17
  set :max_age, 365 * 24 * 60 * 60
18
18
  set :views, ::File.join(::File.dirname(__FILE__), 'rack-fontserve/views')
19
+ set :demo, true
19
20
 
20
21
  not_found do
21
22
  [404, '']
@@ -45,7 +46,8 @@ module Rack
45
46
  end
46
47
  end
47
48
 
48
- get '/demo' do
49
+ get '/' do
50
+ not_found unless Rack::Fontserve.demo
49
51
  erb :demo
50
52
  end
51
53
 
@@ -2,4 +2,4 @@
2
2
  # Rack::Fontserve::VERSION since Fontserve is a class that inherits from Sinatra::Base
3
3
  # and we'd be getting Superclass mismatch errors here since Sinatra is
4
4
  # unavailable when evaluating this file standalone, i.e. in Rakefile
5
- FONTSERVE_VERSION = '0.1.2'
5
+ FONTSERVE_VERSION = '0.1.3'
data/test/test_web.rb CHANGED
@@ -2,7 +2,7 @@ require 'helper'
2
2
 
3
3
  class WebTest < Test::Unit::TestCase
4
4
 
5
- get '/' do
5
+ get '/foo' do
6
6
  should_respond_with 404
7
7
  should("render an empty string") { assert_equal '', last_response.body }
8
8
  end
@@ -56,8 +56,23 @@ class WebTest < Test::Unit::TestCase
56
56
  end
57
57
  end
58
58
 
59
- get '/demo' do
59
+ get '/' do
60
60
  should_respond_with 200
61
61
  should_set_header 'Content-Type', 'text/html;charset=utf-8'
62
62
  end
63
+
64
+ context "when demo is deactivated" do
65
+ setup do
66
+ Rack::Fontserve.set :demo, false
67
+ end
68
+
69
+ get '/' do
70
+ should_respond_with 404
71
+ should_not_set_caching
72
+ end
73
+
74
+ teardown do
75
+ Rack::Fontserve.set :demo, true
76
+ end
77
+ end
63
78
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rack-fontserve
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.2
5
+ version: 0.1.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Christoph Olszowka