sitemap_generator 5.0.5 → 5.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,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6445cea5741bfbdf3a4a22d3ea49b066283f8877
4
- data.tar.gz: 4d7e44c720170f44a3b302d9215b0f39fea0e093
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NmIyNzk0YTc4MDcyODYxZTQ4NTFlMDhhOTk3Y2YzZGViZmM4N2U0OA==
5
+ data.tar.gz: !binary |-
6
+ NjJhMjBlNmM3NTJjOTg5MzRiYTJlMjlhMjVmNjc0NzQ2N2ZiYWJhYg==
5
7
  SHA512:
6
- metadata.gz: 5fb21aedf7c06c9b9d9229ab00f9104e7fc177c2d4ae359d193f1766c7cf09826bf39a4a2f0964a020224ffa38494fe6ceda72107da5f22f60db02deaa8acbc7
7
- data.tar.gz: 6b858a5b19e875595e17774608bdd9cb73ffeeb5dd7a0c5fa76223a95ee39d3e4fd458b9ab4642cb104708fcab97af79718ebb9c6e2067b064b4d422fe0ae587
8
+ metadata.gz: !binary |-
9
+ YWJiY2QyNDgyN2IwM2M2NzVmMDYwYmY5YzFlY2JmMjFlZWM1NmIzNzQ4YzA5
10
+ NWYwN2ExZTc4OWIyODJlY2ZmNTZlZDVlMmE1MWM3Njc2NmJiMDlkNTYyYWM5
11
+ NjcxNTE2ZGE3MDFhMWI2NjFjODA2YzQ3YTFiODhkZTI0ZjY0YzA=
12
+ data.tar.gz: !binary |-
13
+ YzI5M2E4ZGZjYmFiYWYyZmZhZmM0MzhmYzIzNWE0Y2M0MTFjYzliZDM4ZDkw
14
+ ZWQ2OTAzZTE3ZDI4ZTQ4ZTg5ZWZmYmM0MjMxMzczZjFkNGI0M2YyOTI1Mjcy
15
+ OWIyYWI1Y2IzZjg3MWQxOTRmY2YwYjc1YTFiNmE4YWU1YTk1N2M=
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ./
3
3
  specs:
4
- sitemap_generator (5.0.5)
4
+ sitemap_generator (5.1.0)
5
5
  builder
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -117,6 +117,7 @@ That's it! Welcome to the future!
117
117
 
118
118
  ## Changelog
119
119
 
120
+ * v5.1.0: Require only `fog-aws` instead of `fog` for the `S3Adapter` and support using IAM profile instead of setting access key & secret directly. Implement `respond_to?` on the `SitemapGenerator::Sitemap` pseudo class. Make `:lang` optional on alternate links so they can be used for [AppIndexing](https://developers.google.com/app-indexing/reference/deeplinks). Documented [Mobile Sitemaps](#internal_mobile) `:mobile` option.
120
121
  * v5.0.5: Use MIT licence. Fix deploys with Capistrano 3 ([#163](https://github.com/kjvarga/sitemap_generator/issues/163)). Allow any Fog storage options for S3 adapter ([#167](https://github.com/kjvarga/sitemap_generator/pull/167)).
121
122
  * v5.0.4: Don't include the `media` attribute on alternate links unless it's given
122
123
  * v5.0.3: Add support for Video sitemaps options `:live` and ':requires_subscription'
@@ -274,7 +275,7 @@ SitemapGenerator::Sitemap.ping_search_engines('http://example.com/sitemap.xml.gz
274
275
 
275
276
  To keep your sitemaps up-to-date, setup a cron job. Make sure to pass the `-s` option to silence rake. That way you will only get email if the sitemap build fails.
276
277
 
277
- If you're using Whenever, your schedule would look something like this:
278
+ If you're using [Whenever](https://github.com/javan/whenever), your schedule would look something like this:
278
279
 
279
280
  ```ruby
280
281
  # config/schedule.rb
@@ -364,7 +365,7 @@ _This section needs better documentation. Please consider contributing._
364
365
 
365
366
  * `SitemapGenerator::S3Adapter`
366
367
 
367
- Uses `fog` to upload to Amazon S3 storage.
368
+ Uses `fog-aws` to upload to Amazon S3 storage.
368
369
 
369
370
  * `SitemapGenerator::WaveAdapter`
370
371
 
@@ -619,7 +620,7 @@ From this example we can see that:
619
620
  * The Rails URL/path helper methods are made available to us, and
620
621
  * The basic syntax for adding paths to the sitemap using `add`
621
622
 
622
- You can read more about `add` in the [XML Specification](http://sitemaps.org/protocol.php#xmlTagDefinitions).
623
+ You can read more about `add` in the [XML Specification](http://www.sitemaps.org/protocol.html#xmlTagDefinitions).
623
624
 
624
625
  ### Supported Options to `add`
625
626
 
@@ -659,11 +660,11 @@ add '/about', :priority => 0.75
659
660
 
660
661
  * `expires` - Optional (Integer, Time, Date, DateTime, String)
661
662
 
662
- [expires][Request removal of this URL from search engines' indexes]. Example (uses ActiveSupport):
663
+ [Request removal of this URL from search engines' indexes][expires]. Example (uses ActiveSupport):
663
664
 
664
665
  ```ruby
665
666
  add '/about', :expires => Time.now + 2.weeks
666
-
667
+ ```
667
668
 
668
669
  ### Adding Links to the Sitemap Index
669
670
 
@@ -1044,10 +1045,29 @@ end
1044
1045
 
1045
1046
  * `:alternate`/`:alternates` - Hash or array of hashes, respectively
1046
1047
  * `:href` - Required, string.
1047
- * `:lang` - Required, string.
1048
+ * `:lang` - Optional, string.
1048
1049
  * `:nofollow` - Optional, boolean. Used to mark link as "nofollow".
1049
1050
  * `:media` - Optional, string. Specify [media targets for responsive design pages][media].
1050
1051
 
1052
+ ### <a name="internal_mobile"></a> Mobile Sitemaps
1053
+
1054
+ Mobile sitemaps include a specific `<mobile:mobile/>` tag.
1055
+
1056
+ Check out the Google specification [here][sitemap_mobile].
1057
+
1058
+ #### Example
1059
+
1060
+ ```ruby
1061
+ SitemapGenerator::Sitemap.default_host = "http://www.example.com"
1062
+ SitemapGenerator::Sitemap.create do
1063
+ add('/index.html', :mobile => true)
1064
+ end
1065
+ ```
1066
+
1067
+ #### Supported options
1068
+
1069
+ * `:mobile` - Presence of this option will turn on the mobile flag regardless of value.
1070
+
1051
1071
  ## Raison d'être
1052
1072
 
1053
1073
  Most of the Sitemap plugins out there seem to try to recreate the Sitemap links by iterating the Rails routes. In some cases this is possible, but for a great deal of cases it isn't.
@@ -1080,9 +1100,9 @@ Easy hey?
1080
1100
 
1081
1101
  Tested and working on:
1082
1102
 
1083
- * **Rails** 3.0.0, 3.0.7
1103
+ * **Rails** 3.0.0, 3.0.7, 4.2.3
1084
1104
  * **Rails** 1.x - 2.3.8
1085
- * **Ruby** 1.8.6, 1.8.7, 1.8.7 Enterprise Edition, 1.9.1, 1.9.2
1105
+ * **Ruby** 1.8.6, 1.8.7, 1.8.7 Enterprise Edition, 1.9.1, 1.9.2, 2.1.3
1086
1106
 
1087
1107
 
1088
1108
  ## Known Bugs
@@ -1116,8 +1136,8 @@ Copyright (c) 2009 Karl Varga released under the MIT license
1116
1136
 
1117
1137
  [canonical_repo]:http://github.com/kjvarga/sitemap_generator
1118
1138
  [enterprise_class]:https://twitter.com/dhh/status/1631034662 "I use enterprise in the same sense the Phusion guys do - i.e. Enterprise Ruby. Please don't look down on my use of the word 'enterprise' to represent being a cut above. It doesn't mean you ever have to work for a company the size of IBM. Or constantly fight inertia, writing crappy software, adhering to change management practices and spending hours in meetings... Not that there's anything wrong with that - Wait, what?"
1119
- [sitemaps_org]:http://www.sitemaps.org/protocol.php "http://www.sitemaps.org/protocol.php"
1120
- [sitemaps_xml]:http://www.sitemaps.org/protocol.php#xmlTagDefinitions "XML Tag Definitions"
1139
+ [sitemaps_org]:http://www.sitemaps.org/protocol.html "http://www.sitemaps.org/protocol.html"
1140
+ [sitemaps_xml]:http://www.sitemaps.org/protocol.html#xmlTagDefinitions "XML Tag Definitions"
1121
1141
  [sitemap_generator_usage]:http://wiki.github.com/adamsalter/sitemap_generator/sitemapgenerator-usage "http://wiki.github.com/adamsalter/sitemap_generator/sitemapgenerator-usage"
1122
1142
  [sitemap_images]:http://www.google.com/support/webmasters/bin/answer.py?answer=178636
1123
1143
  [sitemap_video]:https://support.google.com/webmasters/answer/80471?hl=en&ref_topic=4581190
@@ -1125,7 +1145,7 @@ Copyright (c) 2009 Karl Varga released under the MIT license
1125
1145
  [sitemap_geo]:#
1126
1146
  [sitemap_mobile]:http://support.google.com/webmasters/bin/answer.py?hl=en&answer=34648
1127
1147
  [sitemap_pagemap]:https://developers.google.com/custom-search/docs/structured_data#addtositemap
1128
- [sitemap_protocol]:http://sitemaps.org/protocol.php
1148
+ [sitemap_protocol]:http://www.sitemaps.org/protocol.html
1129
1149
  [video_tags]:http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=80472#4
1130
1150
  [image_tags]:http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=178636
1131
1151
  [geo_tags]:http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=94555
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.0.5
1
+ 5.1.0
@@ -42,6 +42,10 @@ module SitemapGenerator
42
42
  (@link_set ||= reset!).send(*args, &block)
43
43
  end
44
44
 
45
+ def respond_to?(name, include_private = false)
46
+ (@link_set ||= reset!).respond_to?(name, include_private)
47
+ end
48
+
45
49
  # Use a new LinkSet instance
46
50
  def reset!
47
51
  @link_set = LinkSet.new
@@ -1,7 +1,7 @@
1
1
  begin
2
- require 'fog'
2
+ require 'fog/storage'
3
3
  rescue LoadError
4
- raise LoadError.new("Missing required 'fog'. Please 'gem install fog' and require it in your application.")
4
+ raise LoadError.new("Missing required 'fog-aws'. Please 'gem install fog-aws' and require it in your application.")
5
5
  end
6
6
 
7
7
  module SitemapGenerator
@@ -21,11 +21,15 @@ module SitemapGenerator
21
21
  def write(location, raw_data)
22
22
  SitemapGenerator::FileAdapter.new.write(location, raw_data)
23
23
 
24
- credentials = {
25
- :aws_access_key_id => @aws_access_key_id,
26
- :aws_secret_access_key => @aws_secret_access_key,
27
- :provider => @fog_provider,
28
- }
24
+ credentials = { :provider => @fog_provider }
25
+
26
+ if @aws_access_key_id && @aws_secret_access_key
27
+ credentials[:aws_access_key_id] = @aws_access_key_id
28
+ credentials[:aws_secret_access_key] = @aws_secret_access_key
29
+ else
30
+ credentials[:use_iam_profile] = true
31
+ end
32
+
29
33
  credentials[:region] = @fog_region if @fog_region
30
34
  credentials[:path_style] = @fog_path_style if @fog_path_style
31
35
 
@@ -136,7 +136,8 @@ module SitemapGenerator
136
136
 
137
137
  self[:alternates].each do |alternate|
138
138
  rel = alternate[:nofollow] ? 'alternate nofollow' : 'alternate'
139
- attributes = { :rel => rel, :hreflang => alternate[:lang].to_s, :href => alternate[:href].to_s }
139
+ attributes = { :rel => rel, :href => alternate[:href].to_s }
140
+ attributes[:hreflang] = alternate[:lang].to_s if SitemapGenerator::Utilities.present?(alternate[:lang])
140
141
  attributes[:media] = alternate[:media].to_s if SitemapGenerator::Utilities.present?(alternate[:media])
141
142
  builder.xhtml :link, attributes
142
143
  end
@@ -41,7 +41,7 @@ module SitemapGenerator
41
41
  # * <tt>:verbose</tt> - whether to output summary into to STDOUT. Default +false+.
42
42
  # * <tt>:create_index</tt> - whether to create a sitemap index. Default `:auto`. See <tt>LinkSet::create_index=</tt>
43
43
  # for possible values. Only applies to the SitemapIndexLocation object.
44
- # * <tt>compress</tt> - The LinkSet compress setting. Default: true. If `false` any `.gz` extension is
44
+ # * <tt>compress</tt> - The LinkSet compress setting. Default: +true+. If `false` any `.gz` extension is
45
45
  # stripped from the filename. If `:all_but_first`, only the `.gz` extension of the first
46
46
  # filename is stripped off. If `true` the extensions are left unchanged.
47
47
  def initialize(opts={})
@@ -24,6 +24,27 @@ describe "SitemapGenerator" do
24
24
  alternate.attribute('media').should be_nil
25
25
  end
26
26
 
27
+ it "should not include hreflang element unless provided" do
28
+ xml_fragment = SitemapGenerator::Builder::SitemapUrl.new('link_with_alternates.html',
29
+ :host => 'http://www.example.com',
30
+ :alternates => [
31
+ {
32
+ :href => 'http://www.example.de/link_with_alternate.html'
33
+ }
34
+ ]
35
+ ).to_xml
36
+
37
+ doc = Nokogiri::XML.parse("<root xmlns='http://www.sitemaps.org/schemas/sitemap/0.9' xmlns:xhtml='http://www.w3.org/1999/xhtml'>#{xml_fragment}</root>")
38
+ url = doc.css('url')
39
+ url.should_not be_nil
40
+ url.css('loc').text.should == 'http://www.example.com/link_with_alternates.html'
41
+
42
+ alternate = url.at_xpath('xhtml:link')
43
+ alternate.should_not be_nil
44
+ alternate.attribute('rel').value.should == 'alternate'
45
+ alternate.attribute('hreflang').should be_nil
46
+ end
47
+
27
48
  it "should add alternate links to sitemap" do
28
49
  xml_fragment = SitemapGenerator::Builder::SitemapUrl.new('link_with_alternates.html',
29
50
  :host => 'http://www.example.com',
@@ -549,6 +549,15 @@ describe "SitemapGenerator" do
549
549
  end
550
550
  end
551
551
 
552
+ describe "respond_to?" do
553
+ it "should correctly identify the methods that it responds to" do
554
+ SitemapGenerator::Sitemap.respond_to?(:create).should be_true
555
+ SitemapGenerator::Sitemap.respond_to?(:adapter).should be_true
556
+ SitemapGenerator::Sitemap.respond_to?(:default_host).should be_true
557
+ SitemapGenerator::Sitemap.respond_to?(:invalid_func).should be_false
558
+ end
559
+ end
560
+
552
561
  protected
553
562
 
554
563
  #
metadata CHANGED
@@ -1,69 +1,70 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sitemap_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.5
4
+ version: !binary |-
5
+ NS4xLjA=
5
6
  platform: ruby
6
7
  authors:
7
8
  - Karl Varga
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-07-30 00:00:00.000000000 Z
12
+ date: 2015-07-15 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: mocha
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
- - - '>='
18
+ - - ! '>='
18
19
  - !ruby/object:Gem::Version
19
20
  version: '0'
20
21
  type: :development
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
- - - '>='
25
+ - - ! '>='
25
26
  - !ruby/object:Gem::Version
26
27
  version: '0'
27
28
  - !ruby/object:Gem::Dependency
28
29
  name: nokogiri
29
30
  requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
- - - '>='
32
+ - - ! '>='
32
33
  - !ruby/object:Gem::Version
33
34
  version: '0'
34
35
  type: :development
35
36
  prerelease: false
36
37
  version_requirements: !ruby/object:Gem::Requirement
37
38
  requirements:
38
- - - '>='
39
+ - - ! '>='
39
40
  - !ruby/object:Gem::Version
40
41
  version: '0'
41
42
  - !ruby/object:Gem::Dependency
42
43
  name: rspec
43
44
  requirement: !ruby/object:Gem::Requirement
44
45
  requirements:
45
- - - '>='
46
+ - - ! '>='
46
47
  - !ruby/object:Gem::Version
47
48
  version: '0'
48
49
  type: :development
49
50
  prerelease: false
50
51
  version_requirements: !ruby/object:Gem::Requirement
51
52
  requirements:
52
- - - '>='
53
+ - - ! '>='
53
54
  - !ruby/object:Gem::Version
54
55
  version: '0'
55
56
  - !ruby/object:Gem::Dependency
56
57
  name: builder
57
58
  requirement: !ruby/object:Gem::Requirement
58
59
  requirements:
59
- - - '>='
60
+ - - ! '>='
60
61
  - !ruby/object:Gem::Version
61
62
  version: '0'
62
63
  type: :runtime
63
64
  prerelease: false
64
65
  version_requirements: !ruby/object:Gem::Requirement
65
66
  requirements:
66
- - - '>='
67
+ - - ! '>='
67
68
  - !ruby/object:Gem::Version
68
69
  version: '0'
69
70
  description: SitemapGenerator is a framework-agnostic XML Sitemap generator written
@@ -78,25 +79,26 @@ files:
78
79
  - Gemfile
79
80
  - Gemfile.lock
80
81
  - MIT-LICENSE
81
- - Rakefile
82
82
  - README.md
83
+ - Rakefile
83
84
  - VERSION
84
85
  - lib/capistrano/sitemap_generator.rb
85
86
  - lib/capistrano/tasks/sitemap_generator.cap
87
+ - lib/sitemap_generator.rb
88
+ - lib/sitemap_generator/adapters.rb
86
89
  - lib/sitemap_generator/adapters/file_adapter.rb
87
90
  - lib/sitemap_generator/adapters/fog_adapter.rb
88
91
  - lib/sitemap_generator/adapters/s3_adapter.rb
89
92
  - lib/sitemap_generator/adapters/wave_adapter.rb
90
- - lib/sitemap_generator/adapters.rb
91
93
  - lib/sitemap_generator/application.rb
94
+ - lib/sitemap_generator/builder.rb
92
95
  - lib/sitemap_generator/builder/sitemap_file.rb
93
96
  - lib/sitemap_generator/builder/sitemap_index_file.rb
94
97
  - lib/sitemap_generator/builder/sitemap_index_url.rb
95
98
  - lib/sitemap_generator/builder/sitemap_url.rb
96
- - lib/sitemap_generator/builder.rb
99
+ - lib/sitemap_generator/core_ext.rb
97
100
  - lib/sitemap_generator/core_ext/big_decimal.rb
98
101
  - lib/sitemap_generator/core_ext/numeric.rb
99
- - lib/sitemap_generator/core_ext.rb
100
102
  - lib/sitemap_generator/helpers/number_helper.rb
101
103
  - lib/sitemap_generator/interpreter.rb
102
104
  - lib/sitemap_generator/link_set.rb
@@ -106,11 +108,9 @@ files:
106
108
  - lib/sitemap_generator/tasks.rb
107
109
  - lib/sitemap_generator/templates.rb
108
110
  - lib/sitemap_generator/utilities.rb
109
- - lib/sitemap_generator.rb
110
111
  - lib/tasks/sitemap_generator_tasks.rake
111
112
  - rails/install.rb
112
113
  - rails/uninstall.rb
113
- - templates/sitemap.rb
114
114
  - spec/blueprint.rb
115
115
  - spec/files/sitemap.create.rb
116
116
  - spec/files/sitemap.groups.rb
@@ -151,34 +151,41 @@ files:
151
151
  - spec/support/schemas/sitemap-video.xsd
152
152
  - spec/support/schemas/sitemap.xsd
153
153
  - spec/support/xml_macros.rb
154
+ - templates/sitemap.rb
154
155
  homepage: http://github.com/kjvarga/sitemap_generator
155
156
  licenses:
156
157
  - MIT
157
158
  metadata: {}
158
- post_install_message: |
159
- NOTE: SitemapGenerator 4.x uses a new file naming scheme which is more standards-compliant.
160
- If you're upgrading from 3.x, please see the release note in the README:
159
+ post_install_message: ! 'NOTE: SitemapGenerator 4.x uses a new file naming scheme
160
+ which is more standards-compliant.
161
+
162
+ If you''re upgrading from 3.x, please see the release note in the README:
163
+
161
164
 
162
165
  https://github.com/kjvarga/sitemap_generator#important-changes-in-version-4
163
166
 
167
+
164
168
  The simple answer is that your index file is now called sitemap.xml.gz
169
+
165
170
  and not sitemap_index.xml.gz, but please take a look and see what else has changed.
171
+
172
+ '
166
173
  rdoc_options: []
167
174
  require_paths:
168
175
  - lib
169
176
  required_ruby_version: !ruby/object:Gem::Requirement
170
177
  requirements:
171
- - - '>='
178
+ - - ! '>='
172
179
  - !ruby/object:Gem::Version
173
180
  version: '0'
174
181
  required_rubygems_version: !ruby/object:Gem::Requirement
175
182
  requirements:
176
- - - '>='
183
+ - - ! '>='
177
184
  - !ruby/object:Gem::Version
178
185
  version: '0'
179
186
  requirements: []
180
187
  rubyforge_project:
181
- rubygems_version: 2.1.11
188
+ rubygems_version: 2.4.6
182
189
  signing_key:
183
190
  specification_version: 4
184
191
  summary: Easily generate XML Sitemaps