simple_sitemap 0.1.4 → 0.3.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
- !binary "U0hBMQ==":
3
- metadata.gz: cad164683073dca92485f5ba105262c7928c9986
4
- data.tar.gz: faf47f9804352bfb46e1b5407351d29b7350bf7f
5
- !binary "U0hBNTEy":
6
- metadata.gz: bdd44ef8b4184a4192db91f9fd13b5087ce3ce1b06ff4ce5bdb118f2e6c5ee3015857b54d5eacdff1158065e36519340e85df3006009578220c91a0660ea0f09
7
- data.tar.gz: 5aaaebad958bb61ea726d2cbfece90130ca4f26c95a541ac75594b1698599ebd07da8713714f0329a858a1622e88f3296b73fa0d0cae0685060564bba0108d2a
2
+ SHA1:
3
+ metadata.gz: 1323a49add2477a12a99555fcd8ebc8430ff5266
4
+ data.tar.gz: 54e28e0e55e0084eed2f97c0cb5fd8f8603e0d73
5
+ SHA512:
6
+ metadata.gz: c2afc2b05479c430c90bf69c1bedd46a5b4bfdf42a795fa7a8a03bc8b04b770636513607acbfe32fa0261794daffa7b9aa0d0179e492b91063c08b98665febac
7
+ data.tar.gz: f5720862af3f7f59a39c524bd065c3d6e2e32c49db375e61036f13bce1a238dae6f5d2604d0793ab92ae81a0645159a5cda902635f3bd0133a3889cabcd4787a
@@ -1,10 +1,10 @@
1
+ require 'ostruct'
1
2
 
2
3
  require 'simple_sitemap/generators/base'
3
4
  require 'simple_sitemap/generators/index'
4
5
  require 'simple_sitemap/generators/sitemap'
5
6
  require 'simple_sitemap/writers/gzip_writer'
6
7
  require 'simple_sitemap/writers/plain_writer'
7
-
8
8
  require 'simple_sitemap/version'
9
9
 
10
10
 
@@ -12,6 +12,7 @@ module SimpleSitemap
12
12
 
13
13
  MAX_LINKS_PER_FILE = 50000
14
14
  MAX_FILE_SIZE = 10*1024*1024 # 10 megabytes
15
+ MAX_INDEX_SIZE = 1000
15
16
 
16
17
  class << self
17
18
 
@@ -24,21 +24,24 @@ module SimpleSitemap
24
24
  end
25
25
 
26
26
  def write!
27
- xml = to_xml
28
- index_filename = 'index.xml'
29
- if @config.prefix
30
- index_filename = "#{@config.prefix}_#{index_filename}"
27
+ @sitemaps.each_slice(SimpleSitemap::MAX_INDEX_SIZE).with_index do |sitemaps, index_count|
28
+ xml = to_xml(sitemaps)
29
+ write_file index_filename(index_count), xml
31
30
  end
32
- if @config.gzip
33
- index_filename << '.gz'
34
- end
35
- write_file index_filename, xml
36
31
  end
37
32
 
38
- def to_xml
33
+ def index_filename(index_count)
34
+ filename = "index.xml"
35
+ filename = "index_#{index_count}.xml" if index_count > 0
36
+ filename = "#{@config.prefix}_#{filename}" if @config.prefix
37
+ filename << '.gz' if @config.gzip
38
+ filename
39
+ end
40
+
41
+ def to_xml(sitemaps)
39
42
  builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
40
43
  xml.sitemapindex(xmlns: 'http://www.sitemaps.org/schemas/sitemap/0.9') do
41
- @sitemaps.each do |sitemap_url|
44
+ sitemaps.each do |sitemap_url|
42
45
  xml.sitemap do
43
46
  xml.loc sitemap_url
44
47
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleSitemap
2
- VERSION = '0.1.4'
2
+ VERSION = '0.3.1'
3
3
  end
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  $:.push File.expand_path('../lib', __FILE__)
3
2
  require 'simple_sitemap/version'
4
3
 
@@ -7,10 +6,10 @@ Gem::Specification.new do |gem|
7
6
  gem.name = 'simple_sitemap'
8
7
  gem.version = SimpleSitemap::VERSION
9
8
 
10
- gem.add_dependency 'nokogiri', '~> 1.5.0'
9
+ gem.add_dependency 'nokogiri', '~> 1.7'
11
10
 
12
- gem.authors = ['ryanlower', 'capicue']
13
- gem.email = ['rpjlower@gmail.com', 'stacey@touset.org']
11
+ gem.authors = ['nate00']
12
+ gem.email = ['nathanielsullivan00@gmail.com']
14
13
  gem.description = 'A simple sitemap generator'
15
14
  gem.summary = 'Simple sitemap generator'
16
15
  gem.homepage = 'https://github.com/academia-edu/simple-sitemap'
metadata CHANGED
@@ -1,53 +1,51 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_sitemap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
- - ryanlower
8
- - capicue
7
+ - nate00
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-27 00:00:00.000000000 Z
11
+ date: 2018-02-06 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: nokogiri
16
15
  requirement: !ruby/object:Gem::Requirement
17
16
  requirements:
18
- - - ~>
17
+ - - "~>"
19
18
  - !ruby/object:Gem::Version
20
- version: 1.5.0
19
+ version: '1.7'
21
20
  type: :runtime
22
21
  prerelease: false
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
23
  requirements:
25
- - - ~>
24
+ - - "~>"
26
25
  - !ruby/object:Gem::Version
27
- version: 1.5.0
26
+ version: '1.7'
28
27
  - !ruby/object:Gem::Dependency
29
28
  name: rake
30
29
  requirement: !ruby/object:Gem::Requirement
31
30
  requirements:
32
- - - ! '>='
31
+ - - ">="
33
32
  - !ruby/object:Gem::Version
34
33
  version: '0'
35
34
  type: :development
36
35
  prerelease: false
37
36
  version_requirements: !ruby/object:Gem::Requirement
38
37
  requirements:
39
- - - ! '>='
38
+ - - ">="
40
39
  - !ruby/object:Gem::Version
41
40
  version: '0'
42
41
  description: A simple sitemap generator
43
42
  email:
44
- - rpjlower@gmail.com
45
- - stacey@touset.org
43
+ - nathanielsullivan00@gmail.com
46
44
  executables: []
47
45
  extensions: []
48
46
  extra_rdoc_files: []
49
47
  files:
50
- - .gitignore
48
+ - ".gitignore"
51
49
  - Gemfile
52
50
  - LICENSE
53
51
  - README.md
@@ -69,19 +67,18 @@ require_paths:
69
67
  - lib
70
68
  required_ruby_version: !ruby/object:Gem::Requirement
71
69
  requirements:
72
- - - ! '>='
70
+ - - ">="
73
71
  - !ruby/object:Gem::Version
74
72
  version: '0'
75
73
  required_rubygems_version: !ruby/object:Gem::Requirement
76
74
  requirements:
77
- - - ! '>='
75
+ - - ">="
78
76
  - !ruby/object:Gem::Version
79
77
  version: '0'
80
78
  requirements: []
81
79
  rubyforge_project:
82
- rubygems_version: 2.0.2
80
+ rubygems_version: 2.5.2.1
83
81
  signing_key:
84
82
  specification_version: 4
85
83
  summary: Simple sitemap generator
86
84
  test_files: []
87
- has_rdoc: