sitemap_generator 6.0.2 → 6.3.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
  SHA256:
3
- metadata.gz: 526fb81217b6a251f0855ca41062a46c4e891c7ef0b0f205e66150c71971d88e
4
- data.tar.gz: 60deb9fca4870f1726a366a8179ce4845e0221a8eb59d59dd44d990f603b1665
3
+ metadata.gz: bd65e97e0a574eb1d124988e20c38312968548bf8ef8d381e648c54d6766d049
4
+ data.tar.gz: b9cbf014555cbdfb293c6e780a3e9ab4349db02f8fddbcddc28ab8c743f24657
5
5
  SHA512:
6
- metadata.gz: 66d23227adef4509f58d8187f8b41008a1357b558db9c669bb83bba3a28372f23be1958cc22a14bab2be891b4984bfda9360afdb807665ebd137fe45a2e19833
7
- data.tar.gz: cedd0f41927cd430a8f3089e71230dcd11f92804b62bb1dad8626925068823e27bce55cb144fc49d2c78010239f4ff350ed877f948291b28b8ff7fd894311d14
6
+ metadata.gz: 1ec50b44415503a1d3bce5859cf6b397592212c19827f6dc45019df221f3c08131a04f7e89db98d21172982d6ca212c901638c30882c9b4b08adc107fff67d95
7
+ data.tar.gz: 3afc709b82309f5c052fb00e8c467554c44cc974d7dc122ae45938d9b80c574236639c74b85058a1251c7fc5a2fd2fe827d8478619612f8c6ee0a5ef514d780f
data/CHANGES.md CHANGED
@@ -1,3 +1,36 @@
1
+ ### 6.3.0
2
+
3
+ * Remove Bing's deprecated sitemap submission [#400](https://github.com/kjvarga/sitemap_generator/pull/400).
4
+ * `SitemapGenerator::AwsSdkAdapter`: Support configuring ACL and caching on the uploaded files [#409](https://github.com/kjvarga/sitemap_generator/pull/409).
5
+ * `SitemapGenerator::GoogleStorageAdapter`: Support configuring ACL on the uploaded files [#410](https://github.com/kjvarga/sitemap_generator/pull/410).
6
+ * Fix CircleCI specs for Ruby 3 [#407](https://github.com/kjvarga/sitemap_generator/pull/407).
7
+
8
+ ### 6.2.1
9
+
10
+ * Bugfix: Improve handling of deprecated options in `AwsSdkAdapter`. Fixes bug where `:region` was being set to `nil`. [#390](https://github.com/kjvarga/sitemap_generator/pull/390).
11
+
12
+ ### 6.2.0
13
+
14
+ * Raise `LoadError` when an adapter's dependency is missing to better support Sorbet [#387](https://github.com/kjvarga/sitemap_generator/pull/387).
15
+ * Update the Bing notification URL [#386](https://github.com/kjvarga/sitemap_generator/pull/386).
16
+ * Setup integration testing against a matrix of Ruby and Rails versions; test against Ruby 3.1 and Rails 7.
17
+ * Change default `changefreq` of the root URL from `always` to `weekly` [#376](https://github.com/kjvarga/sitemap_generator/pull/376).
18
+ * `SitemapGenerator::GoogleStorageAdapter`: Support ruby 3 kwarg changes [#375](https://github.com/kjvarga/sitemap_generator/pull/375).
19
+ * `SitemapGenerator::S3Adapter`: Allow Fog `public` option to be Configurable [#359](https://github.com/kjvarga/sitemap_generator/pull/359).
20
+
21
+ ### 6.1.2
22
+
23
+ * Resolve NoMethodError using URI#open for Ruby less than 2.5.0 [#353](https://github.com/kjvarga/sitemap_generator/pull/353)
24
+
25
+ ### 6.1.1
26
+
27
+ * Resolve deprecation warning on using Kernel#open in Ruby 2.7 (use URI.open instead) [#342](https://github.com/kjvarga/sitemap_generator/pull/342)
28
+ * Support S3 Endpoints for S3 Compliant Providers like DigitalOcean Spaces [#325](https://github.com/kjvarga/sitemap_generator/pull/325)
29
+
30
+ ### 6.1.0
31
+
32
+ * Support uploading files to Google Cloud Storage [#326](https://github.com/kjvarga/sitemap_generator/pull/326) and [#340](https://github.com/kjvarga/sitemap_generator/pull/340)
33
+
1
34
  ### 6.0.2
2
35
 
3
36
  * Resolve `BigDecimal.new is deprecated` warnings in Ruby 2.5 [#305](https://github.com/kjvarga/sitemap_generator/pull/305).
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # SitemapGenerator
2
2
 
3
+ [![CircleCI](https://circleci.com/gh/kjvarga/sitemap_generator/tree/master.svg?style=shield)](https://circleci.com/gh/kjvarga/sitemap_generator/tree/master)
4
+
3
5
  SitemapGenerator is the easiest way to generate Sitemaps in Ruby. Rails integration provides access to the Rails route helpers within your sitemap config file and automatically makes the rake tasks available to you. Or if you prefer to use another framework, you can! You can use the rake tasks provided or run your sitemap configs as plain ruby scripts.
4
6
 
5
7
  Sitemaps adhere to the [Sitemap 0.9 protocol][sitemap_protocol] specification.
@@ -13,7 +15,7 @@ Sitemaps adhere to the [Sitemap 0.9 protocol][sitemap_protocol] specification.
13
15
  * Adheres to the [Sitemap 0.9 protocol][sitemap_protocol]
14
16
  * Handles millions of links
15
17
  * Customizable sitemap compression
16
- * Notifies search engines (Google, Bing) of new sitemaps
18
+ * Notifies search engines (Google) of new sitemaps
17
19
  * Ensures your old sitemaps stay in place if the new sitemap fails to generate
18
20
  * Gives you complete control over your sitemap contents and naming scheme
19
21
  * Intelligent sitemap indexing
@@ -56,65 +58,72 @@ In /Users/karl/projects/sitemap_generator-test/public/
56
58
  Sitemap stats: 3 links / 1 sitemaps / 0m00s
57
59
 
58
60
  Successful ping of Google
59
- Successful ping of Bing
60
61
  ```
61
62
 
62
63
  ## Contents
63
64
 
64
- * [Features](#features)
65
- + [Show Me](#show-me)
66
- * [Contents](#contents)
67
- * [Contribute](#contribute)
68
- * [Foreword](#foreword)
69
- * [Installation](#installation)
70
- + [Ruby](#ruby)
71
- + [Rails](#rails)
72
- * [Getting Started](#getting-started)
73
- + [Preventing Output](#preventing-output)
74
- + [Rake Tasks](#rake-tasks)
75
- + [Pinging Search Engines](#pinging-search-engines)
76
- + [Crontab](#crontab)
77
- + [Robots.txt](#robotstxt)
78
- + [Ruby Modules](#ruby-modules)
79
- + [Deployments & Capistrano](#deployments--capistrano)
80
- + [Sitemaps with no Index File](#sitemaps-with-no-index-file)
81
- + [Upload Sitemaps to a Remote Host using Adapters](#upload-sitemaps-to-a-remote-host-using-adapters)
82
- - [Supported Adapters](#supported-adapters)
83
- - [An Example of Using an Adapter](#an-example-of-using-an-adapter)
84
- + [Generating Multiple Sitemaps](#generating-multiple-sitemaps)
85
- * [Sitemap Configuration](#sitemap-configuration)
86
- + [A Simple Example](#a-simple-example)
87
- + [Adding Links](#adding-links)
88
- + [Supported Options to `add`](#supported-options-to-add)
89
- + [Adding Links to the Sitemap Index](#adding-links-to-the-sitemap-index)
90
- + [Accessing the LinkSet instance](#accessing-the-linkset-instance)
91
- + [Speeding Things Up](#speeding-things-up)
92
- * [Customizing your Sitemaps](#customizing-your-sitemaps)
93
- + [Sitemap Options](#sitemap-options)
94
- * [Sitemap Groups](#sitemap-groups)
95
- + [A Groups Example](#a-groups-example)
96
- + [Using `group` without a block](#using-group-without-a-block)
97
- * [Sitemap Extensions](#sitemap-extensions)
98
- + [News Sitemaps](#news-sitemaps)
99
- - [Example](#example)
100
- - [Supported options](#supported-options)
101
- + [Image Sitemaps](#image-sitemaps)
102
- - [Example](#example-1)
103
- - [Supported options](#supported-options-1)
104
- + [Video Sitemaps](#video-sitemaps)
105
- - [Example](#example-2)
106
- - [Supported options](#supported-options-2)
107
- + [PageMap Sitemaps](#pagemap-sitemaps)
108
- - [Supported options](#supported-options-3)
109
- - [Example:](#example)
110
- + [Alternate Links](#alternate-links)
111
- - [Example](#example-3)
112
- - [Supported options](#supported-options-4)
113
- + [Mobile Sitemaps](#-mobile-sitemaps)
114
- - [Example](#example-4)
115
- - [Supported options](#supported-options-5)
116
- * [Compatibility](#compatibility)
117
- * [Licence](#licence)
65
+ - [SitemapGenerator](#sitemapgenerator)
66
+ - [Features](#features)
67
+ - [Show Me](#show-me)
68
+ - [Contents](#contents)
69
+ - [Contribute](#contribute)
70
+ - [Foreword](#foreword)
71
+ - [Installation](#installation)
72
+ - [Ruby](#ruby)
73
+ - [Rails](#rails)
74
+ - [Getting Started](#getting-started)
75
+ - [Preventing Output](#preventing-output)
76
+ - [Rake Tasks](#rake-tasks)
77
+ - [Pinging Search Engines](#pinging-search-engines)
78
+ - [Crontab](#crontab)
79
+ - [Robots.txt](#robotstxt)
80
+ - [Ruby Modules](#ruby-modules)
81
+ - [Deployments & Capistrano](#deployments--capistrano)
82
+ - [Sitemaps with no Index File](#sitemaps-with-no-index-file)
83
+ - [Upload Sitemaps to a Remote Host using Adapters](#upload-sitemaps-to-a-remote-host-using-adapters)
84
+ - [Supported Adapters](#supported-adapters)
85
+ - [`SitemapGenerator::FileAdapter`](#sitemapgeneratorfileadapter)
86
+ - [`SitemapGenerator::FogAdapter`](#sitemapgeneratorfogadapter)
87
+ - [`SitemapGenerator::S3Adapter`](#sitemapgenerators3adapter)
88
+ - [`SitemapGenerator::AwsSdkAdapter`](#sitemapgeneratorawssdkadapter)
89
+ - [`SitemapGenerator::WaveAdapter`](#sitemapgeneratorwaveadapter)
90
+ - [`SitemapGenerator::GoogleStorageAdapter`](#sitemapgeneratorgooglestorageadapter)
91
+ - [An Example of Using an Adapter](#an-example-of-using-an-adapter)
92
+ - [Generating Multiple Sitemaps](#generating-multiple-sitemaps)
93
+ - [Sitemap Configuration](#sitemap-configuration)
94
+ - [A Simple Example](#a-simple-example)
95
+ - [Adding Links](#adding-links)
96
+ - [Supported Options to `add`](#supported-options-to-add)
97
+ - [Adding Links to the Sitemap Index](#adding-links-to-the-sitemap-index)
98
+ - [Accessing the LinkSet instance](#accessing-the-linkset-instance)
99
+ - [Speeding Things Up](#speeding-things-up)
100
+ - [Customizing your Sitemaps](#customizing-your-sitemaps)
101
+ - [Sitemap Options](#sitemap-options)
102
+ - [Sitemap Groups](#sitemap-groups)
103
+ - [A Groups Example](#a-groups-example)
104
+ - [Using `group` without a block](#using-group-without-a-block)
105
+ - [Sitemap Extensions](#sitemap-extensions)
106
+ - [News Sitemaps](#news-sitemaps)
107
+ - [Example](#example)
108
+ - [Supported options](#supported-options)
109
+ - [Image Sitemaps](#image-sitemaps)
110
+ - [Example](#example-1)
111
+ - [Supported options](#supported-options-1)
112
+ - [Video Sitemaps](#video-sitemaps)
113
+ - [Example](#example-2)
114
+ - [Supported options](#supported-options-2)
115
+ - [PageMap Sitemaps](#pagemap-sitemaps)
116
+ - [Supported options](#supported-options-3)
117
+ - [Example:](#example-3)
118
+ - [Alternate Links](#alternate-links)
119
+ - [Example](#example-4)
120
+ - [Supported options](#supported-options-4)
121
+ - [Alternates Example](#alternates-example)
122
+ - [Mobile Sitemaps](#mobile-sitemaps)
123
+ - [Example](#example-5)
124
+ - [Supported options](#supported-options-5)
125
+ - [Compatibility](#compatibility)
126
+ - [Licence](#licence)
118
127
 
119
128
  ## Contribute
120
129
 
@@ -195,7 +204,7 @@ SitemapGenerator.verbose = false
195
204
 
196
205
  ### Pinging Search Engines
197
206
 
198
- Using `rake sitemap:refresh` will notify Google and Bing to let them know that a new sitemap
207
+ Using `rake sitemap:refresh` will notify Google to let them know that a new sitemap
199
208
  is available. To generate new sitemaps without notifying search engines, use `rake sitemap:refresh:no_ping`.
200
209
 
201
210
  If you want to customize the hash of search engines you can access it at:
@@ -329,42 +338,68 @@ directory.
329
338
 
330
339
  #### Supported Adapters
331
340
 
332
- * `SitemapGenerator::FileAdapter`
341
+ ##### `SitemapGenerator::FileAdapter`
333
342
 
334
343
  Standard adapter, writes out to a file.
335
344
 
336
- * `SitemapGenerator::FogAdapter`
345
+ ##### `SitemapGenerator::FogAdapter`
337
346
 
338
347
  Uses `Fog::Storage` to upload to any service supported by Fog.
339
348
 
340
349
  You must `require 'fog'` in your sitemap config before using this adapter,
341
350
  or `require` another library that defines `Fog::Storage`.
342
351
 
343
- * `SitemapGenerator::S3Adapter`
352
+ ##### `SitemapGenerator::S3Adapter`
344
353
 
345
354
  Uses `Fog::Storage` to upload to Amazon S3 storage.
346
355
 
347
356
  You must `require 'fog-aws'` in your sitemap config before using this adapter.
348
357
 
349
- * `SitemapGenerator::AwsSdkAdapter`
358
+ An example of using this adapter in your sitemap configuration:
359
+
360
+ ```ruby
361
+ SitemapGenerator::Sitemap.adapter = SitemapGenerator::S3Adapter.new(options)
362
+ ```
363
+
364
+ Where `options` is a Hash with any of the following keys:
365
+ * `aws_access_key_id` [String] Your AWS access key id
366
+ * `aws_secret_access_key` [String] Your AWS secret access key
367
+ * `fog_provider` [String]
368
+ * `fog_directory` [String]
369
+ * `fog_region` [String]
370
+ * `fog_path_style` [String]
371
+ * `fog_storage_options` [Hash] Other options to pass to `Fog::Storage`
372
+ * `fog_public` [Boolean] Whether the file is publicly accessible
373
+
374
+ Alternatively you can use an environment variable to configure each option (except `fog_storage_options`). The environment variables have the same
375
+ name but capitalized, e.g. `FOG_PATH_STYLE`.
376
+
377
+ ##### `SitemapGenerator::AwsSdkAdapter`
350
378
 
351
379
  Uses `Aws::S3::Resource` to upload to Amazon S3 storage. Includes automatic detection of your AWS
352
- credentials using `Aws::Credentials`.
380
+ credentials and region.
353
381
 
354
- You must `require 'aws-sdk'` in your sitemap config before using this adapter,
382
+ You must `require 'aws-sdk-s3'` in your sitemap config before using this adapter,
355
383
  or `require` another library that defines `Aws::S3::Resource` and `Aws::Credentials`.
356
384
 
357
385
  An example of using this adapter in your sitemap configuration:
358
386
 
359
387
  ```ruby
360
388
  SitemapGenerator::Sitemap.adapter = SitemapGenerator::AwsSdkAdapter.new('s3_bucket',
361
- aws_access_key_id: 'AKIAI3SW5CRAZBL4WSTA',
362
- aws_secret_access_key: 'asdfadsfdsafsadf',
363
- aws_region: 'us-east-1'
389
+ acl: 'public-read', # Optional. This is the default.
390
+ cache_control: 'private, max-age=0, no-cache', # Optional. This is the default.
391
+ access_key_id: 'AKIAI3SW5CRAZBL4WSTA',
392
+ secret_access_key: 'asdfadsfdsafsadf',
393
+ region: 'us-east-1',
394
+ endpoint: 'https://sfo2.digitaloceanspaces.com'
364
395
  )
365
396
  ```
366
397
 
367
- * `SitemapGenerator::WaveAdapter`
398
+ Where the first argument is the S3 bucket name, and the rest are keyword argument options. Options `:acl` and `:cache_control` configure access and caching of the uploaded files; all other options are passed directly to the AWS client.
399
+
400
+ See [the `SitemapGenerator::AwsSdkAdapter` docs](https://github.com/kjvarga/sitemap_generator/blob/master/lib/sitemap_generator/adapters/aws_sdk_adapter.rb), and [https://docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/S3/Client.html#initialize-instance_method](https://docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/S3/Client.html#initialize-instance_method) for the full list of supported options.
401
+
402
+ ##### `SitemapGenerator::WaveAdapter`
368
403
 
369
404
  Uses `CarrierWave::Uploader::Base` to upload to any service supported by CarrierWave, for example,
370
405
  Amazon S3, Rackspace Cloud Files, and MongoDB's GridF.
@@ -374,6 +409,32 @@ directory.
374
409
 
375
410
  Some documentation exists [on the wiki page][remote_hosts].
376
411
 
412
+ ##### `SitemapGenerator::GoogleStorageAdapter`
413
+
414
+ Uses [`Google::Cloud::Storage`][google_cloud_storage_gem] to upload to Google Cloud storage.
415
+
416
+ You must `require 'google/cloud/storage'` in your sitemap config before using this adapter.
417
+
418
+ An example of using this adapter in your sitemap configuration with options:
419
+
420
+ ```ruby
421
+ SitemapGenerator::Sitemap.adapter = SitemapGenerator::GoogleStorageAdapter.new(
422
+ acl: 'public', # Optional. This is the default value.
423
+ bucket: 'name_of_bucket'
424
+ credentials: 'path/to/keyfile.json',
425
+ project_id: 'google_account_project_id',
426
+ )
427
+ ```
428
+ Also, inline with Google Authentication options, it can also pick credentials from environment variables. All [supported environment variables][google_cloud_storage_authentication] can be used, for example: `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_CREDENTIALS`. An example of using this adapter with the environment variables is:
429
+
430
+ ```ruby
431
+ SitemapGenerator::Sitemap.adapter = SitemapGenerator::GoogleStorageAdapter.new(
432
+ bucket: 'name_of_bucket'
433
+ )
434
+ ```
435
+
436
+ All options other than the `:bucket` and `:acl` options are passed to the `Google::Cloud::Storage.new` initializer giving you maximum configurability. See the [Google Cloud Storage initializer][google_cloud_storage_initializer] for supported options.
437
+
377
438
  #### An Example of Using an Adapter
378
439
 
379
440
  1. Please see [this wiki page][remote_hosts] for more information about setting up SitemapGenerator to upload to a
@@ -410,8 +471,7 @@ directory.
410
471
  Note that SitemapGenerator will automatically turn off `include_index` in this case because
411
472
  the `sitemaps_host` does not match the `default_host`. The link to the sitemap index file
412
473
  that would otherwise be included would point to a different host than the rest of the links
413
- in the sitemap, something that the sitemap rules forbid. (Since version 3.2 this is no
414
- longer an issue because [`include_index` is off by default][include_index_change].)
474
+ in the sitemap, something that the sitemap rules forbid.
415
475
 
416
476
  4. Verify to Google that you own the S3 url
417
477
 
@@ -521,7 +581,7 @@ In /Users/karl/projects/sitemap_generator-test/public/
521
581
  Sitemap stats: 2 links / 1 sitemaps / 0m00s
522
582
  ```
523
583
 
524
- Weird! The sitemap has two links, even though we only added one! This is because SitemapGenerator adds the root URL `/` for you by default. (Note that prior to version 3.2 the URL of the sitemap index file was also added to the sitemap by default but [this behaviour has been changed][include_index_change] because of Google complaining about nested indexing. This also doesn't make sense anymore because indexes are not always needed.) You can change the default behaviour by setting the `include_root` or `include_index` option.
584
+ Weird! The sitemap has two links, even though we only added one! This is because SitemapGenerator adds the root URL `/` for you by default. You can change the default behaviour by setting the `include_root` or `include_index` option.
525
585
 
526
586
  Now let's take a look at the file that was created. After uncompressing and XML-tidying the contents we have:
527
587
 
@@ -534,7 +594,7 @@ Now let's take a look at the file that was created. After uncompressing and XML
534
594
  <url>
535
595
  <loc>http://www.example.com/</loc>
536
596
  <lastmod>2011-05-21T00:03:38+00:00</lastmod>
537
- <changefreq>always</changefreq>
597
+ <changefreq>weekly</changefreq>
538
598
  <priority>1.0</priority>
539
599
  </url>
540
600
  <url>
@@ -1066,7 +1126,27 @@ end
1066
1126
  * `:nofollow` - Optional, boolean. Used to mark link as "nofollow".
1067
1127
  * `:media` - Optional, string. Specify [media targets for responsive design pages][media].
1068
1128
 
1069
- ### <a name="internal_mobile"></a> Mobile Sitemaps
1129
+ #### Alternates Example
1130
+
1131
+ ```ruby
1132
+ SitemapGenerator::Sitemap.default_host = "http://www.example.com"
1133
+ SitemapGenerator::Sitemap.create do
1134
+ add('/index.html', :alternates => [
1135
+ {
1136
+ :href => 'http://www.example.de/index.html',
1137
+ :lang => 'de',
1138
+ :nofollow => true
1139
+ },
1140
+ {
1141
+ :href => 'http://www.example.es/index.html',
1142
+ :lang => 'es',
1143
+ :nofollow => true
1144
+ }
1145
+ ])
1146
+ end
1147
+ ```
1148
+
1149
+ ### Mobile Sitemaps
1070
1150
 
1071
1151
  Mobile sitemaps include a specific `<mobile:mobile/>` tag.
1072
1152
 
@@ -1087,8 +1167,8 @@ end
1087
1167
 
1088
1168
  ## Compatibility
1089
1169
 
1090
- Compatible with all versions of Rails and Ruby.
1091
- Ruby 1.9.3 support was dropped in Version 6.0.0 of this gem.
1170
+ Compatible with all versions of Rails and Ruby. Tested up to Ruby 3.1 and Rails 7.0.
1171
+ Ruby 1.9.3 support was dropped in Version 6.0.0.
1092
1172
 
1093
1173
  ## Licence
1094
1174
 
@@ -1099,10 +1179,6 @@ MIT. See the LICENSE.md file.
1099
1179
  Copyright (c) Karl Varga released under the MIT license
1100
1180
 
1101
1181
  [canonical_repo]:http://github.com/kjvarga/sitemap_generator
1102
- [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?"
1103
- [sitemaps_org]:http://www.sitemaps.org/protocol.html "http://www.sitemaps.org/protocol.html"
1104
- [sitemaps_xml]:http://www.sitemaps.org/protocol.html#xmlTagDefinitions "XML Tag Definitions"
1105
- [sitemap_generator_usage]:http://wiki.github.com/adamsalter/sitemap_generator/sitemapgenerator-usage "http://wiki.github.com/adamsalter/sitemap_generator/sitemapgenerator-usage"
1106
1182
  [sitemap_images]:http://www.google.com/support/webmasters/bin/answer.py?answer=178636
1107
1183
  [sitemap_video]:https://support.google.com/webmasters/answer/80471?hl=en&ref_topic=4581190
1108
1184
  [sitemap_news]:https://support.google.com/news/publisher/topic/2527688?hl=en&ref_topic=4359874
@@ -1113,10 +1189,11 @@ Copyright (c) Karl Varga released under the MIT license
1113
1189
  [image_tags]:http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=178636
1114
1190
  [news_tags]:http://www.google.com/support/news_pub/bin/answer.py?answer=74288
1115
1191
  [remote_hosts]:https://github.com/kjvarga/sitemap_generator/wiki/Generate-Sitemaps-on-read-only-filesystems-like-Heroku
1116
- [include_index_change]:https://github.com/kjvarga/sitemap_generator/issues/70
1117
- [ehoch]:https://github.com/ehoch
1118
1192
  [alternate_links]:http://support.google.com/webmasters/bin/answer.py?hl=en&answer=2620865
1119
1193
  [using_pagemaps]:https://developers.google.com/custom-search/docs/structured_data#pagemaps
1120
1194
  [iso_4217]:http://en.wikipedia.org/wiki/ISO_4217
1121
1195
  [media]:https://developers.google.com/webmasters/smartphone-sites/details
1122
1196
  [expires]:https://support.google.com/customsearch/answer/2631051?hl=en
1197
+ [google_cloud_storage_gem]:https://rubygems.org/gems/google-cloud-storage
1198
+ [google_cloud_storage_authentication]:https://googleapis.dev/ruby/google-cloud-storage/latest/file.AUTHENTICATION.html
1199
+ [google_cloud_storage_initializer]:https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-storage/lib/google/cloud/storage.rb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.0.2
1
+ 6.3.0
@@ -1,5 +1,5 @@
1
1
  if !defined?(Aws::S3::Resource) or !defined?(Aws::Credentials)
2
- raise "Error: `Aws::S3::Resource` and/or `Aws::Credentials` are not defined.\n\n"\
2
+ raise LoadError, "Error: `Aws::S3::Resource` and/or `Aws::Credentials` are not defined.\n\n"\
3
3
  "Please `require 'aws-sdk'` - or another library that defines these classes."
4
4
  end
5
5
 
@@ -8,51 +8,56 @@ module SitemapGenerator
8
8
  class AwsSdkAdapter
9
9
  # Specify your AWS bucket name, credentials, and/or region. By default
10
10
  # the AWS SDK will auto-detect your credentials and region, but you can use
11
- # the following options to configure - or override - them manually:
12
- #
13
- # Options:
14
- # :aws_access_key_id [String] Your AWS access key id
15
- # :aws_secret_access_key [String] Your AWS secret access key
16
- # :aws_region [String] Your AWS region
11
+ # the options to configure them manually.
17
12
  #
18
13
  # Requires Aws::S3::Resource and Aws::Credentials to be defined.
19
14
  #
20
- # @param [String] bucket Name of the S3 bucket
21
- # @param [Hash] options AWS credential overrides, see above
22
- def initialize(bucket, options = {})
15
+ # @param bucket [String] Name of the S3 bucket
16
+ # @param options [Hash] Options passed directly to AWS to control the Resource created. See Options below.
17
+ #
18
+ # Options:
19
+ # **Deprecated, use :endpoint instead** :aws_endpoint [String] The object storage endpoint,
20
+ # if not AWS, e.g. 'https://sfo2.digitaloceanspaces.com'
21
+ # **Deprecated, use :access_key_id instead** :aws_access_key_id [String] Your AWS access key id
22
+ # **Deprecated, use :secret_access_key instead** :aws_secret_access_key [String] Your AWS secret access key
23
+ # **Deprecated, use :region instead** :aws_region [String] Your AWS region
24
+ # :acl [String] The ACL to apply to the uploaded files. Defaults to 'public-read'.
25
+ # :cache_control [String] The cache control headder to apply to the uploaded files. Defaults to 'private, max-age=0, no-cache'.
26
+ #
27
+ # All other options you provide are passed directly to the AWS client.
28
+ # See https://docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/S3/Client.html#initialize-instance_method
29
+ # for a full list of supported options.
30
+ def initialize(bucket, aws_access_key_id: nil, aws_secret_access_key: nil, aws_region: nil, aws_endpoint: nil, acl: 'public-read', cache_control: 'private, max-age=0, no-cache', **options)
23
31
  @bucket = bucket
24
- @aws_access_key_id = options[:aws_access_key_id]
25
- @aws_secret_access_key = options[:aws_secret_access_key]
26
- @aws_region = options[:aws_region]
32
+ @acl = acl
33
+ @cache_control = cache_control
34
+ @options = options
35
+ set_option_unless_set(:access_key_id, aws_access_key_id)
36
+ set_option_unless_set(:secret_access_key, aws_secret_access_key)
37
+ set_option_unless_set(:region, aws_region)
38
+ set_option_unless_set(:endpoint, aws_endpoint)
27
39
  end
28
40
 
41
+
29
42
  # Call with a SitemapLocation and string data
30
43
  def write(location, raw_data)
31
44
  SitemapGenerator::FileAdapter.new.write(location, raw_data)
32
45
  s3_object = s3_resource.bucket(@bucket).object(location.path_in_public)
33
- s3_object.upload_file(location.path,
34
- acl: 'public-read',
35
- cache_control: 'private, max-age=0, no-cache',
46
+ s3_object.upload_file(location.path, {
47
+ acl: @acl,
48
+ cache_control: @cache_control,
36
49
  content_type: location[:compress] ? 'application/x-gzip' : 'application/xml'
37
- )
50
+ }.compact)
38
51
  end
39
52
 
40
53
  private
41
54
 
42
- def s3_resource
43
- @s3_resource ||= Aws::S3::Resource.new(s3_resource_options)
55
+ def set_option_unless_set(key, value)
56
+ @options[key] = value if @options[key].nil? && !value.nil?
44
57
  end
45
58
 
46
- def s3_resource_options
47
- options = {}
48
- options[:region] = @aws_region if !@aws_region.nil?
49
- if !@aws_access_key_id.nil? && !@aws_secret_access_key.nil?
50
- options[:credentials] = Aws::Credentials.new(
51
- @aws_access_key_id,
52
- @aws_secret_access_key
53
- )
54
- end
55
- options
59
+ def s3_resource
60
+ @s3_resource ||= Aws::S3::Resource.new(@options)
56
61
  end
57
62
  end
58
63
  end
@@ -1,5 +1,5 @@
1
1
  if !defined?(Fog::Storage)
2
- raise "Error: `Fog::Storage` is not defined.\n\n"\
2
+ raise LoadError, "Error: `Fog::Storage` is not defined.\n\n"\
3
3
  "Please `require 'fog'` - or another library that defines this class."
4
4
  end
5
5
 
@@ -0,0 +1,39 @@
1
+ if !defined?(Google::Cloud::Storage)
2
+ raise LoadError, "Error: `Google::Cloud::Storage` is not defined.\n\n"\
3
+ "Please `require 'google/cloud/storage'` - or another library that defines this class."
4
+ end
5
+
6
+ module SitemapGenerator
7
+ # Class for uploading sitemaps to a Google Storage using `google-cloud-storage` gem.
8
+ class GoogleStorageAdapter
9
+ # Requires Google::Cloud::Storage to be defined.
10
+ #
11
+ # @param [Hash] opts Google::Cloud::Storage configuration options.
12
+ # @option :bucket [String] Required. Name of Google Storage Bucket where the file is to be uploaded.
13
+ # @option :acl [String] Optional. Access control which is applied to the uploaded file(s). Default value is 'public'.
14
+ #
15
+ # All options other than the `:bucket` and `:acl` options are passed to the `Google::Cloud::Storage.new`
16
+ # initializer. See https://googleapis.dev/ruby/google-cloud-storage/latest/file.AUTHENTICATION.html
17
+ # for all the supported environment variables and https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-storage/lib/google/cloud/storage.rb
18
+ # for supported options.
19
+ #
20
+ # Suggested Options:
21
+ # @option :credentials [String] Path to Google service account JSON file, or JSON contents.
22
+ # @option :project_id [String] Google Accounts project id where the storage bucket resides.
23
+ def initialize(opts = {})
24
+ opts = opts.clone
25
+ @bucket = opts.delete(:bucket)
26
+ @acl = opts.has_key?(:acl) ? opts.delete(:acl) : 'public'
27
+ @storage_options = opts
28
+ end
29
+
30
+ # Call with a SitemapLocation and string data
31
+ def write(location, raw_data)
32
+ SitemapGenerator::FileAdapter.new.write(location, raw_data)
33
+
34
+ storage = Google::Cloud::Storage.new(**@storage_options)
35
+ bucket = storage.bucket(@bucket)
36
+ bucket.create_file(location.path, location.path_in_public, acl: @acl)
37
+ end
38
+ end
39
+ end
@@ -1,5 +1,5 @@
1
1
  if !defined?(Fog::Storage)
2
- raise "Error: `Fog::Storage` is not defined.\n\n"\
2
+ raise LoadError, "Error: `Fog::Storage` is not defined.\n\n"\
3
3
  "Please `require 'fog-aws'` - or another library that defines this class."
4
4
  end
5
5
 
@@ -16,6 +16,10 @@ module SitemapGenerator
16
16
  # @option :fog_region [String]
17
17
  # @option :fog_path_style [String]
18
18
  # @option :fog_storage_options [Hash] Other options to pass to `Fog::Storage`
19
+ # @option :fog_public [Boolean] Whether the file is publicly accessible
20
+ #
21
+ # Alternatively you can use an environment variable to configure each option (except `fog_storage_options`).
22
+ # The environment variables have the same name but capitalized, e.g. `FOG_PATH_STYLE`.
19
23
  def initialize(opts = {})
20
24
  @aws_access_key_id = opts[:aws_access_key_id] || ENV['AWS_ACCESS_KEY_ID']
21
25
  @aws_secret_access_key = opts[:aws_secret_access_key] || ENV['AWS_SECRET_ACCESS_KEY']
@@ -24,6 +28,8 @@ module SitemapGenerator
24
28
  @fog_region = opts[:fog_region] || ENV['FOG_REGION']
25
29
  @fog_path_style = opts[:fog_path_style] || ENV['FOG_PATH_STYLE']
26
30
  @fog_storage_options = opts[:fog_storage_options] || {}
31
+ fog_public = opts[:fog_public].nil? ? ENV['FOG_PUBLIC'] : opts[:fog_public]
32
+ @fog_public = SitemapGenerator::Utilities.falsy?(fog_public) ? false : true
27
33
  end
28
34
 
29
35
  # Call with a SitemapLocation and string data
@@ -47,7 +53,7 @@ module SitemapGenerator
47
53
  directory.files.create(
48
54
  :key => location.path_in_public,
49
55
  :body => File.open(location.path),
50
- :public => true
56
+ :public => @fog_public
51
57
  )
52
58
  end
53
59
  end
@@ -1,5 +1,5 @@
1
1
  if !defined?(::CarrierWave::Uploader::Base)
2
- raise "Error: `CarrierWave::Uploader::Base` is not defined.\n\n"\
2
+ raise LoadError, "Error: `CarrierWave::Uploader::Base` is not defined.\n\n"\
3
3
  "Please `require 'carrierwave'` - or another library that defines this class."
4
4
  end
5
5
 
@@ -6,7 +6,7 @@ module SitemapGenerator
6
6
 
7
7
  def initialize(path, options={})
8
8
  if index = path.is_a?(SitemapGenerator::Builder::SitemapIndexFile) && path
9
- options = SitemapGenerator::Utilities.reverse_merge(options, :host => index.location.host, :lastmod => Time.now, :changefreq => 'always', :priority => 1.0)
9
+ options = SitemapGenerator::Utilities.reverse_merge(options, :host => index.location.host, :lastmod => Time.now, :priority => 1.0)
10
10
  path = index.location.path_in_public
11
11
  super(path, options)
12
12
  else
@@ -25,4 +25,4 @@ module SitemapGenerator
25
25
  end
26
26
  end
27
27
  end
28
- end
28
+ end
@@ -32,12 +32,29 @@ module SitemapGenerator
32
32
  def initialize(path, options={})
33
33
  options = SitemapGenerator::Utilities.symbolize_keys(options)
34
34
  if sitemap = path.is_a?(SitemapGenerator::Builder::SitemapFile) && path
35
- SitemapGenerator::Utilities.reverse_merge!(options, :host => sitemap.location.host, :lastmod => sitemap.lastmod)
35
+ SitemapGenerator::Utilities.reverse_merge!(
36
+ options,
37
+ :host => sitemap.location.host,
38
+ :lastmod => sitemap.lastmod
39
+ )
36
40
  path = sitemap.location.path_in_public
37
41
  end
38
42
 
39
- SitemapGenerator::Utilities.assert_valid_keys(options, :priority, :changefreq, :lastmod, :expires, :host, :images, :video, :news, :videos, :mobile, :alternate, :alternates, :pagemap)
40
- SitemapGenerator::Utilities.reverse_merge!(options, :priority => 0.5, :changefreq => 'weekly', :lastmod => Time.now, :images => [], :news => {}, :videos => [], :mobile => false, :alternates => [])
43
+ SitemapGenerator::Utilities.assert_valid_keys(
44
+ options,
45
+ :priority, :changefreq, :lastmod, :expires, :host, :images, :video, :news, :videos, :mobile, :alternate, :alternates, :pagemap
46
+ )
47
+ SitemapGenerator::Utilities.reverse_merge!(
48
+ options,
49
+ :priority => 0.5,
50
+ :changefreq => 'weekly',
51
+ :lastmod => Time.now,
52
+ :images => [],
53
+ :news => {},
54
+ :videos => [],
55
+ :mobile => false,
56
+ :alternates => []
57
+ )
41
58
  raise "Cannot generate a url without a host" unless SitemapGenerator::Utilities.present?(options[:host])
42
59
 
43
60
  if video = options.delete(:video)
@@ -125,8 +125,7 @@ module SitemapGenerator
125
125
  :include_index => false,
126
126
  :filename => :sitemap,
127
127
  :search_engines => {
128
- :google => "http://www.google.com/webmasters/tools/ping?sitemap=%s",
129
- :bing => "http://www.bing.com/ping?sitemap=%s"
128
+ :google => "http://www.google.com/webmasters/tools/ping?sitemap=%s"
130
129
  },
131
130
  :create_index => :auto,
132
131
  :compress => true,
@@ -295,7 +294,11 @@ module SitemapGenerator
295
294
  name = Utilities.titleize(engine.to_s)
296
295
  begin
297
296
  Timeout::timeout(10) {
298
- open(link)
297
+ if URI.respond_to?(:open) # Available since Ruby 2.5
298
+ URI.open(link)
299
+ else
300
+ open(link) # using Kernel#open became deprecated since Ruby 2.7. See https://bugs.ruby-lang.org/issues/15893
301
+ end
299
302
  }
300
303
  output(" Successful ping of #{name}")
301
304
  rescue Timeout::Error, StandardError => e
@@ -434,7 +437,7 @@ module SitemapGenerator
434
437
  # in an instance variable.
435
438
  def add_default_links
436
439
  @added_default_links = true
437
- link_options = { :lastmod => Time.now, :changefreq => 'always', :priority => 1.0 }
440
+ link_options = { :lastmod => Time.now, :priority => 1.0 }
438
441
  if include_root?
439
442
  add('/', link_options)
440
443
  end
@@ -7,14 +7,15 @@ require 'sitemap_generator/application'
7
7
  require 'sitemap_generator/sitemap_location'
8
8
 
9
9
  module SitemapGenerator
10
- autoload(:Interpreter, 'sitemap_generator/interpreter')
11
- autoload(:FileAdapter, 'sitemap_generator/adapters/file_adapter')
12
- autoload(:S3Adapter, 'sitemap_generator/adapters/s3_adapter')
13
- autoload(:AwsSdkAdapter, 'sitemap_generator/adapters/aws_sdk_adapter')
14
- autoload(:WaveAdapter, 'sitemap_generator/adapters/wave_adapter')
15
- autoload(:FogAdapter, 'sitemap_generator/adapters/fog_adapter')
16
- autoload(:BigDecimal, 'sitemap_generator/core_ext/big_decimal')
17
- autoload(:Numeric, 'sitemap_generator/core_ext/numeric')
10
+ autoload(:Interpreter, 'sitemap_generator/interpreter')
11
+ autoload(:FileAdapter, 'sitemap_generator/adapters/file_adapter')
12
+ autoload(:S3Adapter, 'sitemap_generator/adapters/s3_adapter')
13
+ autoload(:AwsSdkAdapter, 'sitemap_generator/adapters/aws_sdk_adapter')
14
+ autoload(:WaveAdapter, 'sitemap_generator/adapters/wave_adapter')
15
+ autoload(:FogAdapter, 'sitemap_generator/adapters/fog_adapter')
16
+ autoload(:GoogleStorageAdapter, 'sitemap_generator/adapters/google_storage_adapter')
17
+ autoload(:BigDecimal, 'sitemap_generator/core_ext/big_decimal')
18
+ autoload(:Numeric, 'sitemap_generator/core_ext/numeric')
18
19
 
19
20
  SitemapError = Class.new(StandardError)
20
21
  SitemapFullError = Class.new(SitemapError)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sitemap_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.2
4
+ version: 6.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Varga
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-10 00:00:00.000000000 Z
11
+ date: 2022-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: fog-aws
28
+ name: aws-sdk-core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: nokogiri
42
+ name: aws-sdk-s3
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec
56
+ name: fog-aws
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,21 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: webmock
70
+ name: google-cloud-storage
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: nokogiri
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - ">="
@@ -95,7 +109,7 @@ dependencies:
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
- name: aws-sdk-core
112
+ name: rspec_junit_formatter
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - ">="
@@ -109,7 +123,21 @@ dependencies:
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
- name: aws-sdk-s3
126
+ name: rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: webmock
113
141
  requirement: !ruby/object:Gem::Requirement
114
142
  requirements:
115
143
  - - ">="
@@ -141,6 +169,7 @@ files:
141
169
  - lib/sitemap_generator/adapters/aws_sdk_adapter.rb
142
170
  - lib/sitemap_generator/adapters/file_adapter.rb
143
171
  - lib/sitemap_generator/adapters/fog_adapter.rb
172
+ - lib/sitemap_generator/adapters/google_storage_adapter.rb
144
173
  - lib/sitemap_generator/adapters/s3_adapter.rb
145
174
  - lib/sitemap_generator/adapters/wave_adapter.rb
146
175
  - lib/sitemap_generator/application.rb
@@ -165,11 +194,11 @@ files:
165
194
  - rails/install.rb
166
195
  - rails/uninstall.rb
167
196
  - templates/sitemap.rb
168
- homepage: http://github.com/kjvarga/sitemap_generator
197
+ homepage: https://github.com/kjvarga/sitemap_generator
169
198
  licenses:
170
199
  - MIT
171
200
  metadata: {}
172
- post_install_message:
201
+ post_install_message:
173
202
  rdoc_options: []
174
203
  require_paths:
175
204
  - lib
@@ -184,9 +213,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
213
  - !ruby/object:Gem::Version
185
214
  version: '0'
186
215
  requirements: []
187
- rubyforge_project:
188
- rubygems_version: 2.7.6
189
- signing_key:
216
+ rubygems_version: 3.3.3
217
+ signing_key:
190
218
  specification_version: 4
191
219
  summary: Easily generate XML Sitemaps
192
220
  test_files: []