rack-zippy 1.1.0 → 1.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.
data/.gitignore CHANGED
@@ -18,4 +18,6 @@ tmp
18
18
  .idea/*
19
19
  *.iml
20
20
  .ruby-version
21
- vendor
21
+ vendor
22
+ .DS_Store
23
+
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 1.2.0 / 2014-07-09
2
+ - Add handling of font files with extensions: woff, woff2, ttf, eot, otf
3
+ ([#9](https://github.com/eliotsykes/rack-zippy/issues/9))
4
+ - Handle flash .swf file extension ([#20](https://github.com/eliotsykes/rack-zippy/issues/20))
5
+
1
6
  ## 1.1.0 / 2014-01-26
2
7
  - rack-zippy no longer blocks requests for assets that it cannot find on the filesystem. These
3
8
  requests are now passed on to the app. ([#7](https://github.com/eliotsykes/rack-zippy/issues/7))
data/README.md CHANGED
@@ -9,9 +9,10 @@ rack-zippy replaces the ActionDispatch::Static middleware used by Rails, which i
9
9
  the `rake assets:precompile` task. rack-zippy will serve non-gzipped assets where they are not available or not supported by the
10
10
  requesting client.
11
11
 
12
- For a fuller explanation of the how, why, and the kind of performance difference you can expect when using rack-zippy,
13
- see [Serving Compressed Assets with Heroku and Rack-Zippy](http://www.cheynewallace.com/serving-compressed-assets-with-heroku-rack-zippy/)
14
- (thanks to Cheyne Wallace).
12
+ Watch the [Web Dev Break podcast on rack-zippy](http://www.webdevbreak.com/specials/rack-zippy "Faster, friendlier assets with rack-zippy") to see how you can check if your app
13
+ is currently serving uncompressed assets and how quick it is to setup rack-zippy:
14
+
15
+ [ ![Faster, friendlier assets with rack-zippy](/video-player.png "Faster, friendlier assets with rack-zippy") ](http://www.webdevbreak.com/specials/rack-zippy "Faster, friendlier assets with rack-zippy")
15
16
 
16
17
  ## Installation
17
18
 
@@ -22,10 +23,18 @@ Add this line to your application's Gemfile:
22
23
  And then execute:
23
24
 
24
25
  $ bundle
26
+
27
+ In `config/environments/production.rb`, set `config.serve_static_assets` to `true`:
28
+
29
+ # Puts ActionDispatch::Static in middleware stack which we are going to replace with
30
+ # Rack::Zippy::AssetServer
31
+ config.serve_static_assets = true
25
32
 
26
- Add this line to config/application.rb:
33
+ Create the file `config/initializers/rack_zippy.rb` and put this line in it:
27
34
 
28
- config.middleware.swap(ActionDispatch::Static, Rack::Zippy::AssetServer)
35
+ Rails.application.config.middleware.swap(ActionDispatch::Static, Rack::Zippy::AssetServer)
36
+
37
+ Now run `rake middleware` at the command line and make sure that `Rack::Zippy::AssetServer` is near the top of the outputted list. ActionDispatch::Static should not be in the list. Nicely done, rack-zippy is now installed in your app.
29
38
 
30
39
  ## Usage
31
40
 
@@ -45,15 +54,23 @@ Check your environment (in config/environments/) does not have `serve_static_ass
45
54
  1. Fork it
46
55
  2. Create your feature branch (`git checkout -b my-new-feature`)
47
56
  3. Run tests (`rake test`)
48
- 3. Commit your changes (`git commit -am 'Add some feature'`)
49
- 4. Push to the branch (`git push origin my-new-feature`)
50
- 5. Create new Pull Request
57
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
58
+ 5. Push to the branch (`git push origin my-new-feature`)
59
+ 6. Create new Pull Request
60
+
61
+ ## Contributors
62
+
63
+ - [Eliot Sykes](https://github.com/eliotsykes)
64
+ - [Kieran Topping](https://github.com/ktopping)
65
+ - [Luke Wendling](https://github.com/lukewendling)
66
+
51
67
 
52
68
  ## Releasing a new gem
53
69
 
54
70
  1. Update pre-release version to the release version in lib/rack-zippy/version.rb, e.g. '1.0.1.pre' becomes '1.0.1'
55
- 2. Update CHANGELOG.md
71
+ 2. Update CHANGELOG.md and Contributors in README.md
56
72
  3. Tests pass? (`rake test`)
57
73
  4. Build the gem (`rake build`)
58
74
  5. Release on rubygems.org (`rake release`)
59
75
  6. Update version to the next pre-release version in lib/rack-zippy/version.rb, e.g. '1.0.1' becomes '1.0.2.pre'
76
+
data/lib/rack-zippy.rb CHANGED
@@ -47,7 +47,8 @@ module Rack
47
47
  :year => 365*(24*60*60)
48
48
  }.freeze
49
49
 
50
- STATIC_EXTENSION_REGEX = /\.(?:css|js|html|htm|txt|ico|png|jpg|jpeg|gif|pdf|svg|zip|gz|eps|psd|ai)\z/i
50
+ # Font extensions: woff, woff2, ttf, eot, otf
51
+ STATIC_EXTENSION_REGEX = /\.(?:css|js|html|htm|txt|ico|png|jpg|jpeg|gif|pdf|svg|zip|gz|eps|psd|ai|woff|woff2|ttf|eot|otf|swf)\z/i
51
52
 
52
53
  PRECOMPILED_ASSETS_SUBDIR_REGEX = /\A\/assets(?:\/|\z)/
53
54
 
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module Zippy
3
- VERSION = '1.1.0'
3
+ VERSION = '1.2.0'
4
4
  end
5
5
  end
@@ -230,6 +230,19 @@ class Rack::Zippy::AssetServerTest < Test::Unit::TestCase
230
230
  end
231
231
  end
232
232
 
233
+ def test_has_static_extension_returns_true_for_fonts
234
+ font_extensions = ['woff', 'woff2', 'ttf', 'eot', 'otf']
235
+ font_extensions.each do |extension|
236
+ assert app.send(:has_static_extension?, "/comic-sans.#{extension}"),
237
+ "'#{extension}' font extension not recognized"
238
+ end
239
+ end
240
+
241
+ def test_has_static_extension_returns_true_for_flash
242
+ assert app.send(:has_static_extension?, '/splash-page-like-its-1999.swf'),
243
+ "Should handle flash .swf files"
244
+ end
245
+
233
246
  def test_passes_non_asset_requests_onto_app
234
247
  get '/about'
235
248
  assert_underlying_app_responded
data/video-player.png ADDED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-zippy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-26 00:00:00.000000000 Z
12
+ date: 2014-07-09 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Rack middleware for serving static gzipped assets generated by the Rails
15
15
  asset pipeline
@@ -40,6 +40,7 @@ files:
40
40
  - test/public/robots.txt
41
41
  - test/public/thanks.html
42
42
  - test/test_helper.rb
43
+ - video-player.png
43
44
  homepage: https://github.com/eliotsykes/rack-zippy
44
45
  licenses:
45
46
  - MIT
@@ -55,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
55
56
  version: '0'
56
57
  segments:
57
58
  - 0
58
- hash: 2781769223884308970
59
+ hash: 2186381762254847347
59
60
  required_rubygems_version: !ruby/object:Gem::Requirement
60
61
  none: false
61
62
  requirements:
@@ -64,10 +65,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
65
  version: '0'
65
66
  segments:
66
67
  - 0
67
- hash: 2781769223884308970
68
+ hash: 2186381762254847347
68
69
  requirements: []
69
70
  rubyforge_project:
70
- rubygems_version: 1.8.23
71
+ rubygems_version: 1.8.23.2
71
72
  signing_key:
72
73
  specification_version: 3
73
74
  summary: Rack middleware for serving static gzipped assets generated by the Rails