sitemap_generator 6.1.0 → 6.2.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
  SHA256:
3
- metadata.gz: 3d08b16f794edd543800c56dd8b2827c6b4ea4fb85721b18e3b675c4a5599a9d
4
- data.tar.gz: ce55fb33969d09c5e2d9ca4b841f511b6ecb9a365a64ec20964394266bcee305
3
+ metadata.gz: 6619733ac6e91a00c5a7b194f82f76b68de2c0521dda3c554d28c8315c0e7c29
4
+ data.tar.gz: 0d73d0acac5b95961d5799a766a5c6af6fac85173420807db5cbc9a630f1841d
5
5
  SHA512:
6
- metadata.gz: 0fe5e90c200a165349a424cfbe919bb11613419acad18d068c8406c8998b22c965b80bb7a16caf20e4c59da44595abeae91f4d7555992f6f249cd4665d036cd4
7
- data.tar.gz: 7f9493d43d626dde991e35f3b552541be9154d22c5a94c55820b50f023b647207167a3dccafeff2a5402c57fa2bd0c4cd6bac2f644ecf6b823fdc1d6716b714e
6
+ metadata.gz: 637cc70ee0036b4e9d228abe34abe4b220db7a6647c3e26b1b98e5df20e59d0e9c24f5f8596ef941afb5ea252081ce048cc74e95b7b52a69fc4c5e48774e3c22
7
+ data.tar.gz: 784183a6a1a1735078734f68aab8e62702b62e474c7602c9360bf2021aeff6492c03405b14a4800d42490bd0b2319c00814541252a3a8f6d4e70becfd87ee6d0
data/CHANGES.md CHANGED
@@ -1,3 +1,25 @@
1
+ ### 6.2.1
2
+
3
+ * 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).
4
+
5
+ ### 6.2.0
6
+
7
+ * Raise `LoadError` when an adapter's dependency is missing to better support Sorbet [#387](https://github.com/kjvarga/sitemap_generator/pull/387).
8
+ * Update the Bing notification URL [#386](https://github.com/kjvarga/sitemap_generator/pull/386).
9
+ * Setup integration testing against a matrix of Ruby and Rails versions; test against Ruby 3.1 and Rails 7.
10
+ * Change default `changefreq` of the root URL from `always` to `weekly` [#376](https://github.com/kjvarga/sitemap_generator/pull/376).
11
+ * `SitemapGenerator::GoogleStorageAdapter`: Support ruby 3 kwarg changes [#375](https://github.com/kjvarga/sitemap_generator/pull/375).
12
+ * `SitemapGenerator::S3Adapter`: Allow Fog `public` option to be Configurable [#359](https://github.com/kjvarga/sitemap_generator/pull/359).
13
+
14
+ ### 6.1.2
15
+
16
+ * Resolve NoMethodError using URI#open for Ruby less than 2.5.0 [#353](https://github.com/kjvarga/sitemap_generator/pull/353)
17
+
18
+ ### 6.1.1
19
+
20
+ * Resolve deprecation warning on using Kernel#open in Ruby 2.7 (use URI.open instead) [#342](https://github.com/kjvarga/sitemap_generator/pull/342)
21
+ * Support S3 Endpoints for S3 Compliant Providers like DigitalOcean Spaces [#325](https://github.com/kjvarga/sitemap_generator/pull/325)
22
+
1
23
  ### 6.1.0
2
24
 
3
25
  * 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)
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.
@@ -61,66 +63,68 @@ Successful ping of Bing
61
63
 
62
64
  ## Contents
63
65
 
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
- * [`SitemapGenerator::FileAdapter`](#sitemapgeneratorfileadapter)
84
- * [`SitemapGenerator::FogAdapter`](#sitemapgeneratorfogadapter)
85
- * [`SitemapGenerator::S3Adapter`](#sitemapgenerators3adapter)
86
- * [`SitemapGenerator::AwsSdkAdapter`](#sitemapgeneratorawssdkadapter)
87
- * [`SitemapGenerator::WaveAdapter`](#sitemapgeneratorwaveadapter)
88
- * [`SitemapGenerator::GoogleStorageAdapter`](#sitemapgeneratorgooglestorageadapter)
89
- - [An Example of Using an Adapter](#an-example-of-using-an-adapter)
90
- + [Generating Multiple Sitemaps](#generating-multiple-sitemaps)
91
- * [Sitemap Configuration](#sitemap-configuration)
92
- + [A Simple Example](#a-simple-example)
93
- + [Adding Links](#adding-links)
94
- + [Supported Options to `add`](#supported-options-to-add)
95
- + [Adding Links to the Sitemap Index](#adding-links-to-the-sitemap-index)
96
- + [Accessing the LinkSet instance](#accessing-the-linkset-instance)
97
- + [Speeding Things Up](#speeding-things-up)
98
- * [Customizing your Sitemaps](#customizing-your-sitemaps)
99
- + [Sitemap Options](#sitemap-options)
100
- * [Sitemap Groups](#sitemap-groups)
101
- + [A Groups Example](#a-groups-example)
102
- + [Using `group` without a block](#using-group-without-a-block)
103
- * [Sitemap Extensions](#sitemap-extensions)
104
- + [News Sitemaps](#news-sitemaps)
105
- - [Example](#example)
106
- - [Supported options](#supported-options)
107
- + [Image Sitemaps](#image-sitemaps)
108
- - [Example](#example-1)
109
- - [Supported options](#supported-options-1)
110
- + [Video Sitemaps](#video-sitemaps)
111
- - [Example](#example-2)
112
- - [Supported options](#supported-options-2)
113
- + [PageMap Sitemaps](#pagemap-sitemaps)
114
- - [Supported options](#supported-options-3)
115
- - [Example:](#example)
116
- + [Alternate Links](#alternate-links)
117
- - [Example](#example-3)
118
- - [Supported options](#supported-options-4)
119
- + [Mobile Sitemaps](#-mobile-sitemaps)
120
- - [Example](#example-4)
121
- - [Supported options](#supported-options-5)
122
- * [Compatibility](#compatibility)
123
- * [Licence](#licence)
66
+ - [SitemapGenerator](#sitemapgenerator)
67
+ - [Features](#features)
68
+ - [Show Me](#show-me)
69
+ - [Contents](#contents)
70
+ - [Contribute](#contribute)
71
+ - [Foreword](#foreword)
72
+ - [Installation](#installation)
73
+ - [Ruby](#ruby)
74
+ - [Rails](#rails)
75
+ - [Getting Started](#getting-started)
76
+ - [Preventing Output](#preventing-output)
77
+ - [Rake Tasks](#rake-tasks)
78
+ - [Pinging Search Engines](#pinging-search-engines)
79
+ - [Crontab](#crontab)
80
+ - [Robots.txt](#robotstxt)
81
+ - [Ruby Modules](#ruby-modules)
82
+ - [Deployments & Capistrano](#deployments--capistrano)
83
+ - [Sitemaps with no Index File](#sitemaps-with-no-index-file)
84
+ - [Upload Sitemaps to a Remote Host using Adapters](#upload-sitemaps-to-a-remote-host-using-adapters)
85
+ - [Supported Adapters](#supported-adapters)
86
+ - [`SitemapGenerator::FileAdapter`](#sitemapgeneratorfileadapter)
87
+ - [`SitemapGenerator::FogAdapter`](#sitemapgeneratorfogadapter)
88
+ - [`SitemapGenerator::S3Adapter`](#sitemapgenerators3adapter)
89
+ - [`SitemapGenerator::AwsSdkAdapter`](#sitemapgeneratorawssdkadapter)
90
+ - [`SitemapGenerator::WaveAdapter`](#sitemapgeneratorwaveadapter)
91
+ - [`SitemapGenerator::GoogleStorageAdapter`](#sitemapgeneratorgooglestorageadapter)
92
+ - [An Example of Using an Adapter](#an-example-of-using-an-adapter)
93
+ - [Generating Multiple Sitemaps](#generating-multiple-sitemaps)
94
+ - [Sitemap Configuration](#sitemap-configuration)
95
+ - [A Simple Example](#a-simple-example)
96
+ - [Adding Links](#adding-links)
97
+ - [Supported Options to `add`](#supported-options-to-add)
98
+ - [Adding Links to the Sitemap Index](#adding-links-to-the-sitemap-index)
99
+ - [Accessing the LinkSet instance](#accessing-the-linkset-instance)
100
+ - [Speeding Things Up](#speeding-things-up)
101
+ - [Customizing your Sitemaps](#customizing-your-sitemaps)
102
+ - [Sitemap Options](#sitemap-options)
103
+ - [Sitemap Groups](#sitemap-groups)
104
+ - [A Groups Example](#a-groups-example)
105
+ - [Using `group` without a block](#using-group-without-a-block)
106
+ - [Sitemap Extensions](#sitemap-extensions)
107
+ - [News Sitemaps](#news-sitemaps)
108
+ - [Example](#example)
109
+ - [Supported options](#supported-options)
110
+ - [Image Sitemaps](#image-sitemaps)
111
+ - [Example](#example-1)
112
+ - [Supported options](#supported-options-1)
113
+ - [Video Sitemaps](#video-sitemaps)
114
+ - [Example](#example-2)
115
+ - [Supported options](#supported-options-2)
116
+ - [PageMap Sitemaps](#pagemap-sitemaps)
117
+ - [Supported options](#supported-options-3)
118
+ - [Example:](#example-3)
119
+ - [Alternate Links](#alternate-links)
120
+ - [Example](#example-4)
121
+ - [Supported options](#supported-options-4)
122
+ - [Alternates Example](#alternates-example)
123
+ - [Mobile Sitemaps](#mobile-sitemaps)
124
+ - [Example](#example-5)
125
+ - [Supported options](#supported-options-5)
126
+ - [Compatibility](#compatibility)
127
+ - [Licence](#licence)
124
128
 
125
129
  ## Contribute
126
130
 
@@ -352,24 +356,50 @@ directory.
352
356
 
353
357
  You must `require 'fog-aws'` in your sitemap config before using this adapter.
354
358
 
359
+ An example of using this adapter in your sitemap configuration:
360
+
361
+ ```ruby
362
+ SitemapGenerator::Sitemap.adapter = SitemapGenerator::S3Adapter.new(options)
363
+ ```
364
+
365
+ Where `options` is a Hash with any of the following keys:
366
+ * `aws_access_key_id` [String] Your AWS access key id
367
+ * `aws_secret_access_key` [String] Your AWS secret access key
368
+ * `fog_provider` [String]
369
+ * `fog_directory` [String]
370
+ * `fog_region` [String]
371
+ * `fog_path_style` [String]
372
+ * `fog_storage_options` [Hash] Other options to pass to `Fog::Storage`
373
+ * `fog_public` [Boolean] Whether the file is publicly accessible
374
+
375
+ Alternatively you can use an environment variable to configure each option (except `fog_storage_options`). The environment variables have the same
376
+ name but capitalized, e.g. `FOG_PATH_STYLE`.
377
+
355
378
  ##### `SitemapGenerator::AwsSdkAdapter`
356
379
 
357
380
  Uses `Aws::S3::Resource` to upload to Amazon S3 storage. Includes automatic detection of your AWS
358
- credentials using `Aws::Credentials`.
381
+ credentials and region.
359
382
 
360
- You must `require 'aws-sdk'` in your sitemap config before using this adapter,
383
+ You must `require 'aws-sdk-s3'` in your sitemap config before using this adapter,
361
384
  or `require` another library that defines `Aws::S3::Resource` and `Aws::Credentials`.
362
385
 
363
386
  An example of using this adapter in your sitemap configuration:
364
387
 
365
388
  ```ruby
366
389
  SitemapGenerator::Sitemap.adapter = SitemapGenerator::AwsSdkAdapter.new('s3_bucket',
367
- aws_access_key_id: 'AKIAI3SW5CRAZBL4WSTA',
368
- aws_secret_access_key: 'asdfadsfdsafsadf',
369
- aws_region: 'us-east-1'
390
+ access_key_id: 'AKIAI3SW5CRAZBL4WSTA',
391
+ secret_access_key: 'asdfadsfdsafsadf',
392
+ region: 'us-east-1',
393
+ endpoint: 'https://sfo2.digitaloceanspaces.com'
370
394
  )
371
395
  ```
372
396
 
397
+ Where the first argument is the S3 bucket name, and the rest are keyword argument options which
398
+ are passed directly to the AWS client.
399
+
400
+ See https://docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/S3/Client.html#initialize-instance_method
401
+ for a full list of supported options.
402
+
373
403
  ##### `SitemapGenerator::WaveAdapter`
374
404
 
375
405
  Uses `CarrierWave::Uploader::Base` to upload to any service supported by CarrierWave, for example,
@@ -441,8 +471,7 @@ directory.
441
471
  Note that SitemapGenerator will automatically turn off `include_index` in this case because
442
472
  the `sitemaps_host` does not match the `default_host`. The link to the sitemap index file
443
473
  that would otherwise be included would point to a different host than the rest of the links
444
- in the sitemap, something that the sitemap rules forbid. (Since version 3.2 this is no
445
- longer an issue because [`include_index` is off by default][include_index_change].)
474
+ in the sitemap, something that the sitemap rules forbid.
446
475
 
447
476
  4. Verify to Google that you own the S3 url
448
477
 
@@ -552,7 +581,7 @@ In /Users/karl/projects/sitemap_generator-test/public/
552
581
  Sitemap stats: 2 links / 1 sitemaps / 0m00s
553
582
  ```
554
583
 
555
- 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.
556
585
 
557
586
  Now let's take a look at the file that was created. After uncompressing and XML-tidying the contents we have:
558
587
 
@@ -565,7 +594,7 @@ Now let's take a look at the file that was created. After uncompressing and XML
565
594
  <url>
566
595
  <loc>http://www.example.com/</loc>
567
596
  <lastmod>2011-05-21T00:03:38+00:00</lastmod>
568
- <changefreq>always</changefreq>
597
+ <changefreq>weekly</changefreq>
569
598
  <priority>1.0</priority>
570
599
  </url>
571
600
  <url>
@@ -1097,7 +1126,27 @@ end
1097
1126
  * `:nofollow` - Optional, boolean. Used to mark link as "nofollow".
1098
1127
  * `:media` - Optional, string. Specify [media targets for responsive design pages][media].
1099
1128
 
1100
- ### <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
1101
1150
 
1102
1151
  Mobile sitemaps include a specific `<mobile:mobile/>` tag.
1103
1152
 
@@ -1118,8 +1167,8 @@ end
1118
1167
 
1119
1168
  ## Compatibility
1120
1169
 
1121
- Compatible with all versions of Rails and Ruby.
1122
- 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.
1123
1172
 
1124
1173
  ## Licence
1125
1174
 
@@ -1130,10 +1179,6 @@ MIT. See the LICENSE.md file.
1130
1179
  Copyright (c) Karl Varga released under the MIT license
1131
1180
 
1132
1181
  [canonical_repo]:http://github.com/kjvarga/sitemap_generator
1133
- [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?"
1134
- [sitemaps_org]:http://www.sitemaps.org/protocol.html "http://www.sitemaps.org/protocol.html"
1135
- [sitemaps_xml]:http://www.sitemaps.org/protocol.html#xmlTagDefinitions "XML Tag Definitions"
1136
- [sitemap_generator_usage]:http://wiki.github.com/adamsalter/sitemap_generator/sitemapgenerator-usage "http://wiki.github.com/adamsalter/sitemap_generator/sitemapgenerator-usage"
1137
1182
  [sitemap_images]:http://www.google.com/support/webmasters/bin/answer.py?answer=178636
1138
1183
  [sitemap_video]:https://support.google.com/webmasters/answer/80471?hl=en&ref_topic=4581190
1139
1184
  [sitemap_news]:https://support.google.com/news/publisher/topic/2527688?hl=en&ref_topic=4359874
@@ -1144,8 +1189,6 @@ Copyright (c) Karl Varga released under the MIT license
1144
1189
  [image_tags]:http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=178636
1145
1190
  [news_tags]:http://www.google.com/support/news_pub/bin/answer.py?answer=74288
1146
1191
  [remote_hosts]:https://github.com/kjvarga/sitemap_generator/wiki/Generate-Sitemaps-on-read-only-filesystems-like-Heroku
1147
- [include_index_change]:https://github.com/kjvarga/sitemap_generator/issues/70
1148
- [ehoch]:https://github.com/ehoch
1149
1192
  [alternate_links]:http://support.google.com/webmasters/bin/answer.py?hl=en&answer=2620865
1150
1193
  [using_pagemaps]:https://developers.google.com/custom-search/docs/structured_data#pagemaps
1151
1194
  [iso_4217]:http://en.wikipedia.org/wiki/ISO_4217
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.1.0
1
+ 6.2.1
@@ -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,24 +8,33 @@ 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** :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
+ #
25
+ # All other options you provide are passed directly to the AWS client.
26
+ # See https://docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/S3/Client.html#initialize-instance_method
27
+ # for a full list of supported options.
28
+ def initialize(bucket, aws_access_key_id: nil, aws_secret_access_key: nil, aws_region: nil, aws_endpoint: nil, **options)
23
29
  @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]
30
+ @options = options
31
+ set_option_unless_set(:access_key_id, aws_access_key_id)
32
+ set_option_unless_set(:secret_access_key, aws_secret_access_key)
33
+ set_option_unless_set(:region, aws_region)
34
+ set_option_unless_set(:endpoint, aws_endpoint)
27
35
  end
28
36
 
37
+
29
38
  # Call with a SitemapLocation and string data
30
39
  def write(location, raw_data)
31
40
  SitemapGenerator::FileAdapter.new.write(location, raw_data)
@@ -39,20 +48,12 @@ module SitemapGenerator
39
48
 
40
49
  private
41
50
 
42
- def s3_resource
43
- @s3_resource ||= Aws::S3::Resource.new(s3_resource_options)
51
+ def set_option_unless_set(key, value)
52
+ @options[key] = value if @options[key].nil? && !value.nil?
44
53
  end
45
54
 
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
55
+ def s3_resource
56
+ @s3_resource ||= Aws::S3::Resource.new(@options)
56
57
  end
57
58
  end
58
59
  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
 
@@ -1,5 +1,5 @@
1
1
  if !defined?(Google::Cloud::Storage)
2
- raise "Error: `Google::Cloud::Storage` is not defined.\n\n"\
2
+ raise LoadError, "Error: `Google::Cloud::Storage` is not defined.\n\n"\
3
3
  "Please `require 'google/cloud/storage'` - or another library that defines this class."
4
4
  end
5
5
 
@@ -29,7 +29,7 @@ module SitemapGenerator
29
29
  def write(location, raw_data)
30
30
  SitemapGenerator::FileAdapter.new.write(location, raw_data)
31
31
 
32
- storage = Google::Cloud::Storage.new(@storage_options)
32
+ storage = Google::Cloud::Storage.new(**@storage_options)
33
33
  bucket = storage.bucket(@bucket)
34
34
  bucket.create_file(location.path, location.path_in_public, acl: 'public')
35
35
  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)
@@ -126,7 +126,7 @@ module SitemapGenerator
126
126
  :filename => :sitemap,
127
127
  :search_engines => {
128
128
  :google => "http://www.google.com/webmasters/tools/ping?sitemap=%s",
129
- :bing => "http://www.bing.com/ping?sitemap=%s"
129
+ :bing => "http://www.bing.com/webmaster/ping.aspx?sitemap=%s"
130
130
  },
131
131
  :create_index => :auto,
132
132
  :compress => true,
@@ -295,7 +295,11 @@ module SitemapGenerator
295
295
  name = Utilities.titleize(engine.to_s)
296
296
  begin
297
297
  Timeout::timeout(10) {
298
- open(link)
298
+ if URI.respond_to?(:open) # Available since Ruby 2.5
299
+ URI.open(link)
300
+ else
301
+ open(link) # using Kernel#open became deprecated since Ruby 2.7. See https://bugs.ruby-lang.org/issues/15893
302
+ end
299
303
  }
300
304
  output(" Successful ping of #{name}")
301
305
  rescue Timeout::Error, StandardError => e
@@ -434,7 +438,7 @@ module SitemapGenerator
434
438
  # in an instance variable.
435
439
  def add_default_links
436
440
  @added_default_links = true
437
- link_options = { :lastmod => Time.now, :changefreq => 'always', :priority => 1.0 }
441
+ link_options = { :lastmod => Time.now, :priority => 1.0 }
438
442
  if include_root?
439
443
  add('/', link_options)
440
444
  end
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.1.0
4
+ version: 6.2.1
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-12-26 00:00:00.000000000 Z
11
+ date: 2022-01-19 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,7 @@ 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
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - ">="
@@ -123,7 +137,7 @@ dependencies:
123
137
  - !ruby/object:Gem::Version
124
138
  version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
- name: google-cloud-storage
140
+ name: webmock
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
143
  - - ">="
@@ -180,11 +194,11 @@ files:
180
194
  - rails/install.rb
181
195
  - rails/uninstall.rb
182
196
  - templates/sitemap.rb
183
- homepage: http://github.com/kjvarga/sitemap_generator
197
+ homepage: https://github.com/kjvarga/sitemap_generator
184
198
  licenses:
185
199
  - MIT
186
200
  metadata: {}
187
- post_install_message:
201
+ post_install_message:
188
202
  rdoc_options: []
189
203
  require_paths:
190
204
  - lib
@@ -199,9 +213,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
213
  - !ruby/object:Gem::Version
200
214
  version: '0'
201
215
  requirements: []
202
- rubyforge_project:
203
- rubygems_version: 2.7.6
204
- signing_key:
216
+ rubygems_version: 3.3.3
217
+ signing_key:
205
218
  specification_version: 4
206
219
  summary: Easily generate XML Sitemaps
207
220
  test_files: []