canonical-rails 0.1.0 → 0.1.1

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: 6dbb138db50b84284c942035e43ee69bf159df10
4
- data.tar.gz: b74bab55d53c5f52e0ed132c30d2e34037853545
3
+ metadata.gz: 6511d92cac533fd032b7224521b2fa01e98cba0b
4
+ data.tar.gz: cd7f3ca3ebe5966c7a991072d848c202b3542f14
5
5
  SHA512:
6
- metadata.gz: 95fdb9912513679fd6b345b609b987b4b4f8cf1106c2b155fb4cb4115be9fe285454893009a7ef73e87378dc6b5af69b96d533a37cd6a10be8cc4ceac689402b
7
- data.tar.gz: c56a57c38691e76c075e7161f99abcb991c8081f7ded42610950e43bcec3d94675f0881ec9feb04bfba7281a32ea54f458d83910722e01105828dbee3a3501a0
6
+ metadata.gz: 1c500d013292a55e102bd77c1d533939ca85061fa154cf6baaa372a428140e8a3a1f7b624762a07dc137bf2a3d9d113c2015ec83853b3b2e1baea2e2876c20de
7
+ data.tar.gz: f5f34a3b2ec60590f373395494eee62cd8196df87afe0d615068e10e25b6dba98bd3418f5e3603bc8d75acb5196c5eeb48388f48a36fd9994e89ebe3ddee19e3
data/README.md CHANGED
@@ -3,14 +3,16 @@ CanonicalRails
3
3
  [![Dependency Status](https://gemnasium.com/jumph4x/canonical-rails.png)](https://gemnasium.com/jumph4x/canonical-rails)
4
4
  [![Build Status](https://travis-ci.org/jumph4x/canonical-rails.svg?branch=master)](https://travis-ci.org/jumph4x/canonical-rails)
5
5
 
6
- This project rocks and uses MIT-LICENSE, foh sho. Works with rails 3 and 4.
7
-
8
6
  A number of articles exist explaining the issue concisely and at length:
9
7
 
10
8
  * [Google Webmaster Blog Page About Specifying Canonical](http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html)
11
9
  * [Google Support About rel="canonical"](http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139394)
12
10
  * [Google Support About Canonicalization](http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139066)
13
11
 
12
+ ## Guide
13
+
14
+ Take a look at this blog post that can guide you through the idea and the setup: [Easily add canonical URLs to your Rails app](http://blog.planetargon.com/entries/2014/4/4/easily-add-canonical-urls-to-your-rails-app)
15
+
14
16
  ## Challenge
15
17
 
16
18
  I've seen a lot of folks do more harm by neglecting canonicalization altogether than by applying to narrowly and conservatively, so here is an attempt to let people start modestly without spending too much time on it and whitelist parameters as they need to.
@@ -25,7 +25,8 @@ module CanonicalRails
25
25
  end
26
26
 
27
27
  def canonical_href(host = canonical_host, port = canonical_port)
28
- port = port.present? && port.to_i != 80 ? ":#{port}" : ''
28
+ default_ports = { 'https://' => 443, 'http://' => 80 }
29
+ port = port.present? && port.to_i != default_ports[canonical_protocol] ? ":#{port}" : ''
29
30
  raw "#{canonical_protocol}#{host}#{port}#{path_without_html_extension}#{trailing_slash_if_needed}#{whitelisted_query_string}".downcase
30
31
  end
31
32
 
@@ -33,5 +33,4 @@ module CanonicalRails
33
33
  def self.sym_whitelisted_parameters
34
34
  @@sym_whitelisted_parameters ||= self.whitelisted_parameters.map(&:to_sym)
35
35
  end
36
-
37
36
  end
@@ -1,3 +1,3 @@
1
1
  module CanonicalRails
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canonical-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Ivanov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-24 00:00:00.000000000 Z
11
+ date: 2016-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.1'
19
+ version: '4.1'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '5.1'
@@ -26,10 +26,24 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '3.1'
29
+ version: '4.1'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '5.1'
33
+ - !ruby/object:Gem::Dependency
34
+ name: appraisal
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: sqlite3
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -50,14 +64,14 @@ dependencies:
50
64
  requirements:
51
65
  - - "~>"
52
66
  - !ruby/object:Gem::Version
53
- version: 3.4.2
67
+ version: 3.5.0.beta3
54
68
  type: :development
55
69
  prerelease: false
56
70
  version_requirements: !ruby/object:Gem::Requirement
57
71
  requirements:
58
72
  - - "~>"
59
73
  - !ruby/object:Gem::Version
60
- version: 3.4.2
74
+ version: 3.5.0.beta3
61
75
  - !ruby/object:Gem::Dependency
62
76
  name: pry
63
77
  requirement: !ruby/object:Gem::Requirement