heroku_rails_deflate 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,26 +17,55 @@ GEM
17
17
  activesupport (3.2.13)
18
18
  i18n (= 0.6.1)
19
19
  multi_json (~> 1.0)
20
+ addressable (2.3.5)
20
21
  builder (3.0.4)
21
22
  diff-lcs (1.2.2)
22
23
  erubis (2.7.0)
24
+ faraday (0.8.8)
25
+ multipart-post (~> 1.2.0)
23
26
  git (1.2.5)
27
+ github_api (0.10.1)
28
+ addressable
29
+ faraday (~> 0.8.1)
30
+ hashie (>= 1.2)
31
+ multi_json (~> 1.4)
32
+ nokogiri (~> 1.5.2)
33
+ oauth2
34
+ hashie (2.0.5)
35
+ highline (1.6.19)
24
36
  hike (1.2.1)
37
+ httpauth (0.2.0)
25
38
  i18n (0.6.1)
26
- jeweler (1.8.4)
39
+ jeweler (1.8.6)
40
+ builder
27
41
  bundler (~> 1.0)
28
42
  git (>= 1.2.5)
43
+ github_api (= 0.10.1)
44
+ highline (>= 1.6.15)
45
+ nokogiri (= 1.5.10)
29
46
  rake
30
47
  rdoc
31
48
  journey (1.0.4)
32
- json (1.7.7)
49
+ json (1.8.0)
50
+ jwt (0.1.8)
51
+ multi_json (>= 1.5)
33
52
  multi_json (1.7.2)
53
+ multi_xml (0.5.4)
54
+ multipart-post (1.2.0)
55
+ nokogiri (1.5.10)
56
+ oauth2 (0.9.2)
57
+ faraday (~> 0.8)
58
+ httpauth (~> 0.2)
59
+ jwt (~> 0.1.4)
60
+ multi_json (~> 1.0)
61
+ multi_xml (~> 0.5)
62
+ rack (~> 1.2)
34
63
  rack (1.4.5)
35
64
  rack-cache (1.2)
36
65
  rack (>= 0.4)
37
66
  rack-test (0.6.2)
38
67
  rack (>= 1.0)
39
- rake (10.0.4)
68
+ rake (10.1.0)
40
69
  rdoc (4.0.1)
41
70
  json (~> 1.4)
42
71
  rspec (2.13.0)
data/README.md CHANGED
@@ -36,7 +36,7 @@ part. After you get done with this, you could take it to the next level by addin
36
36
  config.static_cache_control = "public, max-age=31536000"
37
37
  ```
38
38
 
39
- * You should precompile your assets prior to deploying to Heroku to save CPU cycles at request time:
39
+ * Optionally, I prefer precompiling assets prior to deploying to Heroku to ensure that assets compile properly (if not, Heroku will enable runtime compilation which will slow your app down tremendously).
40
40
 
41
41
  ```ruby
42
42
  RAILS_ENV=production rake assets:precompile
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "heroku_rails_deflate"
8
- s.version = "1.0.0"
8
+ s.version = "1.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matt Olson"]
12
- s.date = "2013-04-03"
12
+ s.date = "2013-08-02"
13
13
  s.description = "This gem is designed for use by Rails applications running on Heroku. For others, the better approach is to use a frontend server such as nginx or Apache. However, the Heroku Cedar stack is no longer fronted by a file server, and there is no automatic provision for gzipping responses. This gem activates Rack::Deflate for all requests. In addition, we serve up the gzipped versions of our precompiled assets, taking advantage of the higher compression ratio used during precompilation, and reducing CPU load at request time."
14
14
  s.email = "matt@mattolson.com"
15
15
  s.extra_rdoc_files = [
@@ -3,9 +3,17 @@ require 'heroku_rails_deflate/serve_zipped_assets'
3
3
 
4
4
  module HerokuRailsDeflate
5
5
  class Railtie < Rails::Railtie
6
- initializer "heroku_rails_deflate.middleware_initialization" do |app|
7
- app.middleware.insert_before ActionDispatch::Static, Rack::Deflater
8
- app.middleware.insert_before ActionDispatch::Static, HerokuRailsDeflate::ServeZippedAssets, app.paths["public"].first, app.config.assets.prefix, app.config.static_cache_control
6
+ # Use after_initialize to ensure that all other middleware is already loaded
7
+ initializer "heroku_rails_deflate.middleware_initialization", :after => :load_config_initializers do |app|
8
+ # Put Rack::Deflater in the right place
9
+ if app.config.action_controller.perform_caching && app.config.action_dispatch.rack_cache
10
+ app.config.middleware.insert_after 'Rack::Cache', 'Rack::Deflater'
11
+ else
12
+ app.config.middleware.insert_before 'ActionDispatch::Static', 'Rack::Deflater'
13
+ end
14
+
15
+ # Insert our custom middleware for serving gzipped static assets
16
+ app.config.middleware.insert_after 'Rack::Deflater', 'HerokuRailsDeflate::ServeZippedAssets', app.paths["public"].first, app.config.assets.prefix, app.config.static_cache_control
9
17
  end
10
18
 
11
19
  # Set default Cache-Control headers to 365 days. Override in config/application.rb.
@@ -49,7 +49,9 @@ module HerokuRailsDeflate
49
49
  end
50
50
  end
51
51
 
52
- @app.call(env)
52
+ status, headers, body = @app.call(env)
53
+ body.close if body.respond_to?(:close)
54
+ [status, headers, body]
53
55
  end
54
56
  end
55
57
  end
@@ -2,7 +2,7 @@ module HerokuRailsDeflate
2
2
  class Version
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- PATCH = 0
5
+ PATCH = 1
6
6
  BUILD = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku_rails_deflate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
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: 2013-04-03 00:00:00.000000000 Z
12
+ date: 2013-08-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -152,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
152
  version: '0'
153
153
  segments:
154
154
  - 0
155
- hash: 848461724416935905
155
+ hash: 2875700319250447575
156
156
  required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  none: false
158
158
  requirements: