dynamic_sitemaps 1.0.8 → 2.0.0.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/Gemfile +17 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +106 -0
  6. data/Rakefile +10 -0
  7. data/dynamic_sitemaps.gemspec +22 -0
  8. data/lib/dynamic_sitemaps.rb +89 -4
  9. data/lib/dynamic_sitemaps/generator.rb +59 -0
  10. data/lib/dynamic_sitemaps/index_generator.rb +47 -0
  11. data/lib/dynamic_sitemaps/pinger.rb +35 -0
  12. data/lib/dynamic_sitemaps/rails/engine.rb +9 -0
  13. data/lib/dynamic_sitemaps/sitemap.rb +40 -5
  14. data/lib/dynamic_sitemaps/sitemap_generator.rb +153 -0
  15. data/lib/dynamic_sitemaps/sitemap_result.rb +24 -0
  16. data/lib/dynamic_sitemaps/tasks/sitemap.rake +12 -0
  17. data/lib/dynamic_sitemaps/version.rb +3 -0
  18. data/lib/generators/dynamic_sitemaps/USAGE +8 -0
  19. data/lib/generators/dynamic_sitemaps/install_generator.rb +9 -0
  20. data/lib/generators/dynamic_sitemaps/templates/config.rb +7 -0
  21. data/test/dummy/README.rdoc +261 -0
  22. data/test/dummy/Rakefile +7 -0
  23. data/test/dummy/app/assets/javascripts/application.js +15 -0
  24. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  25. data/test/dummy/app/controllers/application_controller.rb +3 -0
  26. data/test/dummy/app/helpers/application_helper.rb +2 -0
  27. data/test/dummy/app/mailers/.gitkeep +0 -0
  28. data/test/dummy/app/models/.gitkeep +0 -0
  29. data/test/dummy/app/models/product.rb +3 -0
  30. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  31. data/test/dummy/config.ru +4 -0
  32. data/test/dummy/config/application.rb +59 -0
  33. data/test/dummy/config/boot.rb +10 -0
  34. data/test/dummy/config/database.yml +25 -0
  35. data/test/dummy/config/environment.rb +5 -0
  36. data/test/dummy/config/environments/development.rb +37 -0
  37. data/test/dummy/config/environments/production.rb +67 -0
  38. data/test/dummy/config/environments/test.rb +37 -0
  39. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  40. data/test/dummy/config/initializers/inflections.rb +15 -0
  41. data/test/dummy/config/initializers/mime_types.rb +5 -0
  42. data/test/dummy/config/initializers/secret_token.rb +7 -0
  43. data/test/dummy/config/initializers/session_store.rb +8 -0
  44. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  45. data/test/dummy/config/locales/en.yml +5 -0
  46. data/test/dummy/config/routes.rb +58 -0
  47. data/test/dummy/db/development.sqlite3 +0 -0
  48. data/test/dummy/db/migrate/20130211190343_create_products.rb +12 -0
  49. data/test/dummy/db/schema.rb +25 -0
  50. data/test/dummy/db/test.sqlite3 +0 -0
  51. data/test/dummy/lib/assets/.gitkeep +0 -0
  52. data/test/dummy/log/.gitkeep +0 -0
  53. data/test/dummy/log/development.log +902 -0
  54. data/test/dummy/log/test.log +10 -0
  55. data/test/dummy/public/404.html +26 -0
  56. data/test/dummy/public/422.html +26 -0
  57. data/test/dummy/public/500.html +25 -0
  58. data/test/dummy/public/favicon.ico +0 -0
  59. data/test/dummy/script/rails +6 -0
  60. data/test/dummy/test/fixtures/products.yml +9 -0
  61. data/test/dummy/test/unit/product_test.rb +7 -0
  62. data/test/dynamic_sitemaps_test.rb +7 -0
  63. data/test/test_helper.rb +15 -0
  64. metadata +160 -56
  65. data/app/controllers/sitemaps_controller.rb +0 -92
  66. data/app/views/sitemaps/index.builder +0 -11
  67. data/app/views/sitemaps/sitemap.builder +0 -20
  68. data/lib/dynamic_sitemaps/engine.rb +0 -4
  69. data/lib/dynamic_sitemaps/page.rb +0 -21
  70. data/lib/dynamic_sitemaps/url.rb +0 -9
  71. data/lib/generators/dynamic_sitemaps/dynamic_sitemaps_generator.rb +0 -11
  72. data/lib/generators/dynamic_sitemaps/templates/initializer.rb +0 -28
@@ -0,0 +1,10 @@
1
+ Connecting to database specified by database.yml
2
+ Connecting to database specified by database.yml
3
+ Connecting to database specified by database.yml
4
+ Connecting to database specified by database.yml
5
+ Connecting to database specified by database.yml
6
+  (0.3ms) begin transaction
7
+  (0.0ms) rollback transaction
8
+ Connecting to database specified by database.yml
9
+  (0.2ms) begin transaction
10
+  (0.0ms) rollback transaction
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,9 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ name: MyString
5
+ slug: MyString
6
+
7
+ two:
8
+ name: MyString
9
+ slug: MyString
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class ProductTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class DynamicSitemapsTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, DynamicSitemaps
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Load support files
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
+
12
+ # Load fixtures from the engine
13
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
+ end
metadata CHANGED
@@ -1,74 +1,178 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: dynamic_sitemaps
3
- version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 8
10
- version: 1.0.8
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0.beta
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Lasse Bunk
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2012-06-25 00:00:00 Z
19
- dependencies: []
20
-
21
- description: Dynamic Sitemaps is a plugin for Ruby on Rails that enables you to easily create flexible, dynamic sitemaps.
22
- email: lassebunk@gmail.com
11
+ date: 2013-07-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.13
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.13
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Dynamic Sitemaps is a plugin for Ruby on Rails that enables you to easily
42
+ create flexible, dynamic sitemaps for Google, Bing, and Yahoo.
43
+ email:
44
+ - lassebunk@gmail.com
23
45
  executables: []
24
-
25
46
  extensions: []
26
-
27
47
  extra_rdoc_files: []
28
-
29
- files:
30
- - lib/dynamic_sitemaps/engine.rb
31
- - lib/dynamic_sitemaps/page.rb
32
- - lib/dynamic_sitemaps/sitemap.rb
33
- - lib/dynamic_sitemaps/url.rb
48
+ files:
49
+ - .gitignore
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - dynamic_sitemaps.gemspec
34
55
  - lib/dynamic_sitemaps.rb
35
- - lib/generators/dynamic_sitemaps/dynamic_sitemaps_generator.rb
36
- - lib/generators/dynamic_sitemaps/templates/initializer.rb
37
- - app/controllers/sitemaps_controller.rb
38
- - app/views/sitemaps/index.builder
39
- - app/views/sitemaps/sitemap.builder
56
+ - lib/dynamic_sitemaps/generator.rb
57
+ - lib/dynamic_sitemaps/index_generator.rb
58
+ - lib/dynamic_sitemaps/pinger.rb
59
+ - lib/dynamic_sitemaps/rails/engine.rb
60
+ - lib/dynamic_sitemaps/sitemap.rb
61
+ - lib/dynamic_sitemaps/sitemap_generator.rb
62
+ - lib/dynamic_sitemaps/sitemap_result.rb
63
+ - lib/dynamic_sitemaps/tasks/sitemap.rake
64
+ - lib/dynamic_sitemaps/version.rb
65
+ - lib/generators/dynamic_sitemaps/USAGE
66
+ - lib/generators/dynamic_sitemaps/install_generator.rb
67
+ - lib/generators/dynamic_sitemaps/templates/config.rb
68
+ - test/dummy/README.rdoc
69
+ - test/dummy/Rakefile
70
+ - test/dummy/app/assets/javascripts/application.js
71
+ - test/dummy/app/assets/stylesheets/application.css
72
+ - test/dummy/app/controllers/application_controller.rb
73
+ - test/dummy/app/helpers/application_helper.rb
74
+ - test/dummy/app/mailers/.gitkeep
75
+ - test/dummy/app/models/.gitkeep
76
+ - test/dummy/app/models/product.rb
77
+ - test/dummy/app/views/layouts/application.html.erb
78
+ - test/dummy/config.ru
79
+ - test/dummy/config/application.rb
80
+ - test/dummy/config/boot.rb
81
+ - test/dummy/config/database.yml
82
+ - test/dummy/config/environment.rb
83
+ - test/dummy/config/environments/development.rb
84
+ - test/dummy/config/environments/production.rb
85
+ - test/dummy/config/environments/test.rb
86
+ - test/dummy/config/initializers/backtrace_silencers.rb
87
+ - test/dummy/config/initializers/inflections.rb
88
+ - test/dummy/config/initializers/mime_types.rb
89
+ - test/dummy/config/initializers/secret_token.rb
90
+ - test/dummy/config/initializers/session_store.rb
91
+ - test/dummy/config/initializers/wrap_parameters.rb
92
+ - test/dummy/config/locales/en.yml
93
+ - test/dummy/config/routes.rb
94
+ - test/dummy/db/development.sqlite3
95
+ - test/dummy/db/migrate/20130211190343_create_products.rb
96
+ - test/dummy/db/schema.rb
97
+ - test/dummy/db/test.sqlite3
98
+ - test/dummy/lib/assets/.gitkeep
99
+ - test/dummy/log/.gitkeep
100
+ - test/dummy/log/development.log
101
+ - test/dummy/log/test.log
102
+ - test/dummy/public/404.html
103
+ - test/dummy/public/422.html
104
+ - test/dummy/public/500.html
105
+ - test/dummy/public/favicon.ico
106
+ - test/dummy/script/rails
107
+ - test/dummy/test/fixtures/products.yml
108
+ - test/dummy/test/unit/product_test.rb
109
+ - test/dynamic_sitemaps_test.rb
110
+ - test/test_helper.rb
40
111
  homepage: http://github.com/lassebunk/dynamic_sitemaps
41
- licenses: []
42
-
112
+ licenses:
113
+ - MIT
114
+ metadata: {}
43
115
  post_install_message:
44
116
  rdoc_options: []
45
-
46
- require_paths:
117
+ require_paths:
47
118
  - lib
48
- required_ruby_version: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- hash: 3
54
- segments:
55
- - 0
56
- version: "0"
57
- required_rubygems_version: !ruby/object:Gem::Requirement
58
- none: false
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- hash: 3
63
- segments:
64
- - 0
65
- version: "0"
119
+ required_ruby_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - '>'
127
+ - !ruby/object:Gem::Version
128
+ version: 1.3.1
66
129
  requirements: []
67
-
68
130
  rubyforge_project:
69
- rubygems_version: 1.8.24
131
+ rubygems_version: 2.0.3
70
132
  signing_key:
71
- specification_version: 3
133
+ specification_version: 4
72
134
  summary: Dynamic sitemap generation plugin for Ruby on Rails.
73
- test_files: []
74
-
135
+ test_files:
136
+ - test/dummy/README.rdoc
137
+ - test/dummy/Rakefile
138
+ - test/dummy/app/assets/javascripts/application.js
139
+ - test/dummy/app/assets/stylesheets/application.css
140
+ - test/dummy/app/controllers/application_controller.rb
141
+ - test/dummy/app/helpers/application_helper.rb
142
+ - test/dummy/app/mailers/.gitkeep
143
+ - test/dummy/app/models/.gitkeep
144
+ - test/dummy/app/models/product.rb
145
+ - test/dummy/app/views/layouts/application.html.erb
146
+ - test/dummy/config.ru
147
+ - test/dummy/config/application.rb
148
+ - test/dummy/config/boot.rb
149
+ - test/dummy/config/database.yml
150
+ - test/dummy/config/environment.rb
151
+ - test/dummy/config/environments/development.rb
152
+ - test/dummy/config/environments/production.rb
153
+ - test/dummy/config/environments/test.rb
154
+ - test/dummy/config/initializers/backtrace_silencers.rb
155
+ - test/dummy/config/initializers/inflections.rb
156
+ - test/dummy/config/initializers/mime_types.rb
157
+ - test/dummy/config/initializers/secret_token.rb
158
+ - test/dummy/config/initializers/session_store.rb
159
+ - test/dummy/config/initializers/wrap_parameters.rb
160
+ - test/dummy/config/locales/en.yml
161
+ - test/dummy/config/routes.rb
162
+ - test/dummy/db/development.sqlite3
163
+ - test/dummy/db/migrate/20130211190343_create_products.rb
164
+ - test/dummy/db/schema.rb
165
+ - test/dummy/db/test.sqlite3
166
+ - test/dummy/lib/assets/.gitkeep
167
+ - test/dummy/log/.gitkeep
168
+ - test/dummy/log/development.log
169
+ - test/dummy/log/test.log
170
+ - test/dummy/public/404.html
171
+ - test/dummy/public/422.html
172
+ - test/dummy/public/500.html
173
+ - test/dummy/public/favicon.ico
174
+ - test/dummy/script/rails
175
+ - test/dummy/test/fixtures/products.yml
176
+ - test/dummy/test/unit/product_test.rb
177
+ - test/dynamic_sitemaps_test.rb
178
+ - test/test_helper.rb
@@ -1,92 +0,0 @@
1
- class SitemapsController < ActionController::Base
2
- layout false
3
-
4
- def sitemap
5
- new_page!
6
- instance_eval &DynamicSitemaps::Sitemap.draw_block
7
-
8
- if params[:page]
9
- if pages.count > 1
10
- page = pages[params[:page].to_i - 1]
11
-
12
- if page
13
- @urls = page.urls
14
- else
15
- @urls = []
16
- end
17
- else
18
- @urls = []
19
- end
20
- elsif pages.count > 1
21
- @pages = pages
22
- render :index
23
- else
24
- @urls = pages.last.urls
25
- end
26
- end
27
-
28
- protected
29
-
30
- def pages
31
- @pages ||= []
32
- end
33
-
34
- def new_page!
35
- pages << DynamicSitemaps::Page.new
36
- end
37
-
38
- def current_page
39
- pages.last
40
- end
41
-
42
- def per_page(size = nil)
43
- @per_page ||= size || 50000
44
- end
45
-
46
- def url(loc, options = {})
47
- if current_page.urls.count >= per_page
48
- new_page!
49
- end
50
-
51
- loc = polymorphic_url(loc) unless loc.is_a?(String)
52
-
53
- current_page.urls << DynamicSitemaps::Url.new(loc, options)
54
- end
55
-
56
- def autogenerate(*args)
57
- options = args.extract_options!
58
-
59
- args.flatten.each do |sym|
60
- sym.to_s.singularize.camelize.constantize.send(:all).each do |obj|
61
- url obj, convert_options(options, obj)
62
- end
63
- end
64
- end
65
-
66
- def convert_options(options, obj)
67
- options = options.dup
68
- options.each do |key, value|
69
- if value.is_a?(Symbol)
70
- value = obj.send(value)
71
- elsif value.is_a?(Proc)
72
- value = value.call(obj)
73
- end
74
- options[key] = value
75
- end
76
- options
77
- end
78
-
79
- end
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-