prerender_rails 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b4c73f7e63a0f006165cd5c38331028ff9193a4
4
- data.tar.gz: 91b6b398c92f6d94ba5df1e4410f840dc51aa911
3
+ metadata.gz: 2996392178b8569743e5a189dd997cbc1faba5e3
4
+ data.tar.gz: 359d24d78c079b72214418c22f9a3c99b74f4830
5
5
  SHA512:
6
- metadata.gz: 9ea153e9c43853db6a03a5faf09604b976234d4c0e1271328480aafb4401f39a1e9f608bde14cbd7fde16fa9471b6ad535aa56952d7c01986d39f88ea57c0651
7
- data.tar.gz: 477c03ae70bb998fbe06efe7a3f2101701c5dc32569d6c6b8063328b997d67f56103deb705edc24e83bb3d9fb05ff73879f0e2e5a392a7adcb9aa0301d58d29e
6
+ metadata.gz: 685799ac0b59671fc18c9d582d4f2072a496c0cca7df0c98af583c13f28f52731cf61b7aac6ebcb183f35ea706c9be4226ccc455c37180b7fa3201e5a9f2df48
7
+ data.tar.gz: 988c602087c847c6da3fa82c1feec0e38d621112529c6eae50a7b32be518e1d4658810f060aae6915ba95103846a5a1b3aa3ec9ac23bdb866277478a89e113e1
@@ -1,6 +1,7 @@
1
1
  module Rack
2
2
  class Prerender
3
3
  require 'net/http'
4
+ require 'active_support'
4
5
 
5
6
  def initialize(app, options={})
6
7
  # googlebot, yahoo, and bingbot are not in this list because
@@ -148,6 +149,7 @@ module Rack
148
149
  headers['X-Prerender-Token'] = ENV['PRERENDER_TOKEN'] if ENV['PRERENDER_TOKEN']
149
150
  headers['X-Prerender-Token'] = @options[:prerender_token] if @options[:prerender_token]
150
151
  req = Net::HTTP::Get.new(url.request_uri, headers)
152
+ req.basic_auth(ENV['PRERENDER_USERNAME'], ENV['PRERENDER_PASSWORD']) if @options[:basic_auth]
151
153
  response = Net::HTTP.start(url.host, url.port) { |http| http.request(req) }
152
154
  if response['Content-Encoding'] == 'gzip'
153
155
  response.body = ActiveSupport::Gzip.decompress(response.body)
@@ -199,7 +201,6 @@ module Rack
199
201
  response
200
202
  end
201
203
 
202
-
203
204
  def before_render(env)
204
205
  return nil unless @options[:before_render]
205
206
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "prerender_rails"
5
- spec.version = "1.0.4"
5
+ spec.version = "1.1.0"
6
6
  spec.authors = ["Todd Hooper"]
7
7
  spec.email = ["todd@prerender.io"]
8
8
  spec.description = %q{Rails middleware to prerender your javascript heavy pages on the fly by a phantomjs service}
@@ -16,6 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.require_paths = ["lib"]
17
17
 
18
18
  spec.add_dependency 'rack', '>= 0'
19
+ spec.add_dependency 'activesupport', '>= 0'
19
20
 
20
21
  spec.add_development_dependency "bundler", "~> 1.3"
21
22
  spec.add_development_dependency "rake"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prerender_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Hooper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-12 00:00:00.000000000 Z
11
+ date: 2014-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement