sitemap_generator 5.1.0 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NmIyNzk0YTc4MDcyODYxZTQ4NTFlMDhhOTk3Y2YzZGViZmM4N2U0OA==
4
+ NDE5YzhmMzI3Mzk0ZDIxNGExNjk5OTE5MTMxMTZiYzQ1NjY2NzA5NQ==
5
5
  data.tar.gz: !binary |-
6
- NjJhMjBlNmM3NTJjOTg5MzRiYTJlMjlhMjVmNjc0NzQ2N2ZiYWJhYg==
6
+ MTY1OTNhMWE4ZWNiN2JjMzU0ZTUzYzAyZjJhNmE5ZTQ4NjM1MDVkYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YWJiY2QyNDgyN2IwM2M2NzVmMDYwYmY5YzFlY2JmMjFlZWM1NmIzNzQ4YzA5
10
- NWYwN2ExZTc4OWIyODJlY2ZmNTZlZDVlMmE1MWM3Njc2NmJiMDlkNTYyYWM5
11
- NjcxNTE2ZGE3MDFhMWI2NjFjODA2YzQ3YTFiODhkZTI0ZjY0YzA=
9
+ N2NhNmU1OWUwMWM3NTMyMDhmZmU3MmI4NDJjMWYyOWZmOGMzNTkxZTBmMzA0
10
+ Nzk1M2VjZWU2YzdhZmNkOWYwNDZmY2Q5OWQ0MzAxM2MyYTBhMjhkNjczYTZk
11
+ NzczMzVkNDhmY2I5OTU2MTFlNTNmN2JlYzRiNmJiOTkzOTc4ZWM=
12
12
  data.tar.gz: !binary |-
13
- YzI5M2E4ZGZjYmFiYWYyZmZhZmM0MzhmYzIzNWE0Y2M0MTFjYzliZDM4ZDkw
14
- ZWQ2OTAzZTE3ZDI4ZTQ4ZTg5ZWZmYmM0MjMxMzczZjFkNGI0M2YyOTI1Mjcy
15
- OWIyYWI1Y2IzZjg3MWQxOTRmY2YwYjc1YTFiNmE4YWU1YTk1N2M=
13
+ ZGNiZjJkMzI0ZmViZmM3OTk4MTFmYWQ4YTA5OWY4ODIzMWQyYWMxMzQ3ZmYw
14
+ OGY2NTdkNzY5YWJkZGJiNTc1MTVkOWFhYTM1MDZjMjczZjI3MWU1ODIwNjZm
15
+ MjUyNjc4OTRkMWIwMDZjNDBmOGYzZDAzZTgzYjE2NGU3M2E0ZmY=
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: ./
3
3
  specs:
4
- sitemap_generator (5.1.0)
5
- builder
4
+ sitemap_generator (5.2.0)
5
+ builder (~> 3.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- builder (3.0.0)
10
+ builder (3.2.2)
11
11
  diff-lcs (1.1.3)
12
12
  metaclass (0.0.1)
13
13
  mocha (0.10.0)
@@ -33,3 +33,6 @@ DEPENDENCIES
33
33
  rake
34
34
  rspec
35
35
  sitemap_generator!
36
+
37
+ BUNDLED WITH
38
+ 1.12.5
data/README.md CHANGED
@@ -20,7 +20,7 @@ Sitemaps adhere to the [Sitemap 0.9 protocol][sitemap_protocol] specification.
20
20
 
21
21
  ### Show Me
22
22
 
23
- This is a simple standalone example. For Rails installation see the Install section.
23
+ This is a simple standalone example. For Rails installation see the [Rails instructions](#rails) in the [Install](#install) section.
24
24
 
25
25
  Install:
26
26
 
@@ -117,6 +117,7 @@ That's it! Welcome to the future!
117
117
 
118
118
  ## Changelog
119
119
 
120
+ * v5.2.0: New `SitemapGenerator::AwsSdkAdapter` adapter using the bare aws-sdk gem. Fix Bing ping url. Support string option keys passed to `add`. In Railtie, Load the rake task instead of requiring them.
120
121
  * 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.
121
122
  * 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)).
122
123
  * v5.0.4: Don't include the `media` attribute on alternate links unless it's given
@@ -221,9 +222,7 @@ _If you would prefer to install as a plugin (deprecated) don't do any of the abo
221
222
 
222
223
  ### Preventing Output
223
224
 
224
- To disable all non-essential output set the environment variable `VERBOSE=false` when calling Rake or running your Ruby script.
225
-
226
- Alternatively you can pass the `-s` option to Rake, for example `rake -s sitemap:refresh`.
225
+ To disable all non-essential output you can pass the `-s` option to Rake, for example `rake -s sitemap:refresh`, or set the environment variable `VERBOSE=false` when calling as a Ruby script.
227
226
 
228
227
  To disable output in-code use the following:
229
228
 
@@ -233,7 +232,7 @@ SitemapGenerator.verbose = false
233
232
 
234
233
  ### Rake Tasks
235
234
 
236
- * `rake sitemap:install` will create a `config/sitemap.rb` file which is your sitemap configuration and contains everything needed to build your sitemap. See **Sitemap Configuration** below for more information about how to define your sitemap.
235
+ * `rake sitemap:install` will create a `config/sitemap.rb` file which is your sitemap configuration and contains everything needed to build your sitemap. See [**Sitemap Configuration**](#sitemap-configuration) below for more information about how to define your sitemap.
237
236
  * `rake sitemap:refresh` will create or rebuild your sitemap files as needed. Sitemaps are generated into the `public/` folder and by default are named `sitemap_index.xml.gz`, `sitemap1.xml.gz`, `sitemap2.xml.gz`, etc. As you can see they are automatically gzip compressed for you.
238
237
  * `rake sitemap:refresh` will output information about each sitemap that is written including its location, how many links it contains and the size of the file.
239
238
 
@@ -367,6 +366,10 @@ _This section needs better documentation. Please consider contributing._
367
366
 
368
367
  Uses `fog-aws` to upload to Amazon S3 storage.
369
368
 
369
+ * `SitemapGenerator::AwsSdkAdapter`
370
+
371
+ Uses `aws-sdk` to upload to Amazon S3 storage.
372
+
370
373
  * `SitemapGenerator::WaveAdapter`
371
374
 
372
375
  Uses `carrierwave` to upload to any service supported by CarrierWave.
@@ -772,7 +775,7 @@ The options passed to `group` only apply to the links and sitemaps generated in
772
775
 
773
776
  The following options are supported.
774
777
 
775
- * `:create_index` - Supported values: `true`, `false`, `:auto`. Default: `true`. Whether to create a sitemap index file. If `true` an index file is always created regardless of how many sitemap files are generated. If `false` an index file is never created. If `:auto` an index file is created only when you have more than one sitemap file (i.e. you have added more than 50,000 - `SitemapGenerator::MAX_SITEMAP_LINKS` - links).
778
+ * `:create_index` - Supported values: `true`, `false`, `:auto`. Default: `:auto`. Whether to create a sitemap index file. If `true` an index file is always created regardless of how many sitemap files are generated. If `false` an index file is never created. If `:auto` an index file is created only when you have more than one sitemap file (i.e. you have added more than 50,000 - `SitemapGenerator::MAX_SITEMAP_LINKS` - links).
776
779
 
777
780
  * `:default_host` - String. Required. **Host including protocol** to use when building a link to add to your sitemap. For example `http://example.com`. Calling `add '/home'` would then generate the URL `http://example.com/home` and add that to the sitemap. You can pass a `:host` option in your call to `add` to override this value on a per-link basis. For example calling `add '/home', :host => 'https://example.com'` would generate the URL `https://example.com/home`, for that link only.
778
781
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.1.0
1
+ 5.2.0
@@ -4,17 +4,17 @@ require 'sitemap_generator/link_set'
4
4
  require 'sitemap_generator/templates'
5
5
  require 'sitemap_generator/utilities'
6
6
  require 'sitemap_generator/application'
7
- require 'sitemap_generator/adapters'
8
7
  require 'sitemap_generator/sitemap_location'
9
8
 
10
9
  module SitemapGenerator
11
- autoload(:Interpreter, 'sitemap_generator/interpreter')
12
- autoload(:FileAdapter, 'sitemap_generator/adapters/file_adapter')
13
- autoload(:S3Adapter, 'sitemap_generator/adapters/s3_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(:BigDecimal, 'sitemap_generator/core_ext/big_decimal')
17
+ autoload(:Numeric, 'sitemap_generator/core_ext/numeric')
18
18
 
19
19
  SitemapError = Class.new(StandardError)
20
20
  SitemapFullError = Class.new(SitemapError)
@@ -0,0 +1,45 @@
1
+ begin
2
+ require 'aws-sdk'
3
+ rescue LoadError
4
+ raise LoadError.new("Missing required 'aws-sdk'. Please 'gem install "\
5
+ "aws-sdk' and require it in your application, or "\
6
+ "add: gem 'aws-sdk' to your Gemfile.")
7
+ end
8
+
9
+ module SitemapGenerator
10
+ # Class for uploading the sitemaps to an S3 bucket using the plain AWS SDK gem
11
+ class AwsSdkAdapter
12
+ # @param [String] bucket name of the S3 bucket
13
+ # @param [Hash] opts alternate means of configuration other than ENV
14
+ # @option opts [String] :aws_access_key_id instead of ENV['AWS_ACCESS_KEY_ID']
15
+ # @option opts [String] :aws_region instead of ENV['AWS_REGION']
16
+ # @option opts [String] :aws_secret_access_key instead of ENV['AWS_SECRET_ACCESS_KEY']
17
+ # @option opts [String] :path use this prefix on the object key instead of 'sitemaps/'
18
+ def initialize(bucket, opts = {})
19
+ @bucket = bucket
20
+
21
+ @aws_access_key_id = opts[:aws_access_key_id] || ENV['AWS_ACCESS_KEY_ID']
22
+ @aws_region = opts[:aws_region] || ENV['AWS_REGION']
23
+ @aws_secret_access_key = opts[:aws_secret_access_key] || ENV['AWS_SECRET_ACCESS_KEY']
24
+
25
+ @path = opts[:path] || 'sitemaps/'
26
+ end
27
+
28
+ # Call with a SitemapLocation and string data
29
+ def write(location, raw_data)
30
+ SitemapGenerator::FileAdapter.new.write(location, raw_data)
31
+
32
+ credentials = Aws::Credentials.new(@aws_access_key_id, @aws_secret_access_key)
33
+ s3 = Aws::S3::Resource.new(credentials: credentials, region: @aws_region)
34
+
35
+ s3_object_key = "#{@path}#{location.path_in_public}"
36
+ s3_object = s3.bucket(@bucket).object(s3_object_key)
37
+
38
+ content_type = location[:compress] ? 'application/x-gzip' : 'application/xml'
39
+ s3_object.upload_file(location.path,
40
+ acl: 'public-read',
41
+ cache_control: 'private, max-age=0, no-cache',
42
+ content_type: content_type)
43
+ end
44
+ end
45
+ end
@@ -31,7 +31,7 @@ module SitemapGenerator
31
31
  # * +alternate+/+alternates+
32
32
  # * +pagemap+
33
33
  def initialize(path, options={})
34
- options = options.dup
34
+ options = SitemapGenerator::Utilities.symbolize_keys(options)
35
35
  if sitemap = path.is_a?(SitemapGenerator::Builder::SitemapFile) && path
36
36
  SitemapGenerator::Utilities.reverse_merge!(options, :host => sitemap.location.host, :lastmod => sitemap.lastmod)
37
37
  path = sitemap.location.path_in_public
@@ -121,7 +121,7 @@ module SitemapGenerator
121
121
  :filename => :sitemap,
122
122
  :search_engines => {
123
123
  :google => "http://www.google.com/webmasters/tools/ping?sitemap=%s",
124
- :bing => "http://www.bing.com/webmaster/ping.aspx?siteMap=%s"
124
+ :bing => "http://www.bing.com/ping?sitemap=%s"
125
125
  },
126
126
  :create_index => :auto,
127
127
  :compress => true
@@ -1,7 +1,7 @@
1
1
  module SitemapGenerator
2
2
  class Railtie < Rails::Railtie
3
3
  rake_tasks do
4
- require File.expand_path('../tasks', __FILE__)
4
+ load "tasks/sitemap_generator_tasks.rake"
5
5
  end
6
6
  end
7
7
  end
@@ -29,6 +29,12 @@ describe SitemapGenerator::Builder::SitemapUrl do
29
29
  url[:lastmod].should == lastmod
30
30
  end
31
31
 
32
+ it "should support string option keys" do
33
+ url = new_url('/home', 'host' => 'http://string.com', 'priority' => 1)
34
+ url[:priority].should == 1
35
+ url[:host].should == 'http://string.com'
36
+ end
37
+
32
38
  it "should support subdirectory routing" do
33
39
  url = SitemapGenerator::Builder::SitemapUrl.new('/profile', :host => 'http://example.com/subdir/')
34
40
  url[:loc].should == 'http://example.com/subdir/profile'
metadata CHANGED
@@ -2,71 +2,75 @@
2
2
  name: sitemap_generator
3
3
  version: !ruby/object:Gem::Version
4
4
  version: !binary |-
5
- NS4xLjA=
5
+ NS4yLjA=
6
6
  platform: ruby
7
7
  authors:
8
8
  - Karl Varga
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-15 00:00:00.000000000 Z
12
+ date: 2016-09-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mocha
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ! '>='
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
- version: '0'
20
+ version: !binary |-
21
+ MC4xMC4w
21
22
  type: :development
22
23
  prerelease: false
23
24
  version_requirements: !ruby/object:Gem::Requirement
24
25
  requirements:
25
- - - ! '>='
26
+ - - ~>
26
27
  - !ruby/object:Gem::Version
27
- version: '0'
28
+ version: !binary |-
29
+ MC4xMC4w
28
30
  - !ruby/object:Gem::Dependency
29
31
  name: nokogiri
30
32
  requirement: !ruby/object:Gem::Requirement
31
33
  requirements:
32
- - - ! '>='
34
+ - - '='
33
35
  - !ruby/object:Gem::Version
34
- version: '0'
36
+ version: 1.15.10
35
37
  type: :development
36
38
  prerelease: false
37
39
  version_requirements: !ruby/object:Gem::Requirement
38
40
  requirements:
39
- - - ! '>='
41
+ - - '='
40
42
  - !ruby/object:Gem::Version
41
- version: '0'
43
+ version: 1.15.10
42
44
  - !ruby/object:Gem::Dependency
43
45
  name: rspec
44
46
  requirement: !ruby/object:Gem::Requirement
45
47
  requirements:
46
- - - ! '>='
48
+ - - ~>
47
49
  - !ruby/object:Gem::Version
48
- version: '0'
50
+ version: '2.8'
49
51
  type: :development
50
52
  prerelease: false
51
53
  version_requirements: !ruby/object:Gem::Requirement
52
54
  requirements:
53
- - - ! '>='
55
+ - - ~>
54
56
  - !ruby/object:Gem::Version
55
- version: '0'
57
+ version: '2.8'
56
58
  - !ruby/object:Gem::Dependency
57
59
  name: builder
58
60
  requirement: !ruby/object:Gem::Requirement
59
61
  requirements:
60
- - - ! '>='
62
+ - - ~>
61
63
  - !ruby/object:Gem::Version
62
- version: '0'
64
+ version: !binary |-
65
+ My4w
63
66
  type: :runtime
64
67
  prerelease: false
65
68
  version_requirements: !ruby/object:Gem::Requirement
66
69
  requirements:
67
- - - ! '>='
70
+ - - ~>
68
71
  - !ruby/object:Gem::Version
69
- version: '0'
72
+ version: !binary |-
73
+ My4w
70
74
  description: SitemapGenerator is a framework-agnostic XML Sitemap generator written
71
75
  in Ruby with automatic Rails integration. It supports Video, News, Image, Geo,
72
76
  Mobile, PageMap and Alternate Links sitemap extensions and includes Rake tasks for
@@ -85,7 +89,7 @@ files:
85
89
  - lib/capistrano/sitemap_generator.rb
86
90
  - lib/capistrano/tasks/sitemap_generator.cap
87
91
  - lib/sitemap_generator.rb
88
- - lib/sitemap_generator/adapters.rb
92
+ - lib/sitemap_generator/adapters/aws_sdk_adapter.rb
89
93
  - lib/sitemap_generator/adapters/file_adapter.rb
90
94
  - lib/sitemap_generator/adapters/fog_adapter.rb
91
95
  - lib/sitemap_generator/adapters/s3_adapter.rb
File without changes