big_sitemap 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,18 @@
1
+ === 0.8.2 / 2010-01-25
2
+
3
+ * Fixes an issue where sitemap files were not being generated if the same model
4
+ was added more than once (fixes issue #5: https://github.com/alexrabarts/big_sitemap/issues/#issue/5)
5
+
6
+ === 0.8.1 / 2010-01-25
7
+
8
+ * API change: Rails/Merb are no longer automatically detected - use BigSitemapRails and BigSitemapMerb instead
9
+ * API change: Rails' polymorphic_url helper is no longer used to generate URLs (use a lambda with the new :location option instead)
10
+ * Static resources can now be added using the add_static method
11
+ * Incremental updates are now available via the :partial_update option
12
+ * "loc" URL values can now be generated with lambdas
13
+ * Sitemap files can now be locked while being generated using the with_lock method
14
+ * Several bug fixes
15
+
1
16
  === 0.5.1 / 2009-09-07
2
17
 
3
18
  * Fixes an issue with the :last_modified key being passed into the find method options
data/Rakefile CHANGED
@@ -5,10 +5,10 @@ begin
5
5
  Jeweler::Tasks.new do |s|
6
6
  s.name = "big_sitemap"
7
7
  s.summary = %Q{A Sitemap generator specifically designed for large sites (although it works equally well with small sites)}
8
- s.email = %w(tobi@soundcloud.com alexrabarts@gmail.com)
9
- s.homepage = "http://github.com/rngtng/big_sitemap"
8
+ s.email = %w(alexrabarts@gmail.com tobi@soundcloud.com)
9
+ s.homepage = "http://github.com/alexrabarts/big_sitemap"
10
10
  s.description = "A Sitemap generator specifically designed for large sites (although it works equally well with small sites)"
11
- s.authors = ["Tobias Bielohlawek", "Alex Rabarts"]
11
+ s.authors = ["Alex Rabarts", "Tobias Bielohlawek"]
12
12
  s.add_dependency 'bundler'
13
13
  end
14
14
  rescue LoadError
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 1
2
+ :patch: 2
3
3
  :major: 0
4
4
  :minor: 8
data/big_sitemap.gemspec CHANGED
@@ -5,13 +5,13 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{big_sitemap}
8
- s.version = "0.8.1"
8
+ s.version = "0.8.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Tobias Bielohlawek", "Alex Rabarts"]
11
+ s.authors = ["Alex Rabarts", "Tobias Bielohlawek"]
12
12
  s.date = %q{2011-01-25}
13
13
  s.description = %q{A Sitemap generator specifically designed for large sites (although it works equally well with small sites)}
14
- s.email = ["tobi@soundcloud.com", "alexrabarts@gmail.com"]
14
+ s.email = ["alexrabarts@gmail.com", "tobi@soundcloud.com"]
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
17
  "README.rdoc"
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  "test/fixtures/test_model.rb",
33
33
  "test/test_helper.rb"
34
34
  ]
35
- s.homepage = %q{http://github.com/rngtng/big_sitemap}
35
+ s.homepage = %q{http://github.com/alexrabarts/big_sitemap}
36
36
  s.rdoc_options = ["--charset=UTF-8"]
37
37
  s.require_paths = ["lib"]
38
38
  s.rubygems_version = %q{1.3.7}
data/lib/big_sitemap.rb CHANGED
@@ -22,7 +22,7 @@ class BigSitemap
22
22
  TIMESTAMP_METHODS = [:updated_at, :updated_on, :updated, :created_at, :created_on, :created]
23
23
  PARAM_METHODS = [:to_param, :id]
24
24
 
25
- def initialize(options)
25
+ def initialize(options={})
26
26
  @options = DEFAULTS.merge options
27
27
 
28
28
  @default_url_options = options.delete(:default_url_options) || {}
@@ -56,15 +56,24 @@ class BigSitemap
56
56
  Dir.mkdir(@file_path) unless File.exists? @file_path
57
57
 
58
58
  @sources = []
59
+ @models = []
59
60
  @sitemap_files = []
60
61
  end
61
62
 
62
63
  def add(model, options={})
64
+ @models << model
65
+
66
+ filename_suffix = @models.count(model) - 1
67
+
63
68
  options[:path] ||= table_name(model)
64
69
  options[:filename] ||= file_name(model)
65
70
  options[:primary_column] ||= 'id' if model.new.respond_to?('id')
66
71
  options[:partial_update] = @options[:partial_update] && options[:partial_update] != false
72
+
73
+ options[:filename] << "_#{filename_suffix}" unless filename_suffix == 0
74
+
67
75
  @sources << [model, options.dup]
76
+
68
77
  self
69
78
  end
70
79
 
@@ -82,7 +91,7 @@ class BigSitemap
82
91
  unlock!
83
92
  end
84
93
  rescue Errno::EACCES => e
85
- STDERR.puts "Lockfile exists"
94
+ STDERR.puts 'Lockfile exists' if $VERBOSE
86
95
  end
87
96
 
88
97
  def table_name(model)
@@ -331,7 +340,7 @@ class BigSitemapRails < BigSitemap
331
340
 
332
341
  include ActionController::UrlWriter if defined? Rails
333
342
 
334
- def initialize(options)
343
+ def initialize(options={})
335
344
  require 'action_controller'
336
345
 
337
346
  super options.merge(:default_url_options => default_url_options)
@@ -346,7 +355,7 @@ end
346
355
 
347
356
  class BigSitemapMerb < BigSitemap
348
357
 
349
- def initialize(options)
358
+ def initialize(options={})
350
359
  require 'extlib'
351
360
  super
352
361
  end
@@ -42,6 +42,16 @@ class BigSitemapTest < Test::Unit::TestCase
42
42
  assert !File.exists?(third_sitemaps_model_file), "#{third_sitemaps_model_file} does not exist"
43
43
  end
44
44
 
45
+ should 'generate two sitemap model files for the same model with different options' do
46
+ create_sitemap
47
+ add_model(:path => 'foo')
48
+ add_model(:path => 'bar')
49
+ @sitemap.generate
50
+
51
+ assert File.exists?(first_sitemaps_model_file), "#{first_sitemaps_model_file} exists"
52
+ assert File.exists?(second_sitemaps_model_file), "#{second_sitemaps_model_file} exists"
53
+ end
54
+
45
55
  context 'Sitemap index file' do
46
56
  should 'contain one sitemapindex element' do
47
57
  generate_sitemap_files
@@ -454,7 +464,7 @@ class BigSitemapTest < Test::Unit::TestCase
454
464
  end
455
465
 
456
466
  def third_sitemaps_model_file
457
- "#{sitemaps_dir}/sitemap_test_model_2.xml.gz"
467
+ "#{sitemaps_dir}/sitemap_test_models_2.xml.gz"
458
468
  end
459
469
 
460
470
  def sitemaps_dir
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: big_sitemap
3
3
  version: !ruby/object:Gem::Version
4
- hash: 61
4
+ hash: 59
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 1
10
- version: 0.8.1
9
+ - 2
10
+ version: 0.8.2
11
11
  platform: ruby
12
12
  authors:
13
- - Tobias Bielohlawek
14
13
  - Alex Rabarts
14
+ - Tobias Bielohlawek
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
@@ -35,8 +35,8 @@ dependencies:
35
35
  version_requirements: *id001
36
36
  description: A Sitemap generator specifically designed for large sites (although it works equally well with small sites)
37
37
  email:
38
- - tobi@soundcloud.com
39
38
  - alexrabarts@gmail.com
39
+ - tobi@soundcloud.com
40
40
  executables: []
41
41
 
42
42
  extensions: []
@@ -60,7 +60,7 @@ files:
60
60
  - test/fixtures/test_model.rb
61
61
  - test/test_helper.rb
62
62
  has_rdoc: true
63
- homepage: http://github.com/rngtng/big_sitemap
63
+ homepage: http://github.com/alexrabarts/big_sitemap
64
64
  licenses: []
65
65
 
66
66
  post_install_message: