sitemap_generator 5.0.0 → 5.0.1

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ./
3
3
  specs:
4
- sitemap_generator (5.0.0)
4
+ sitemap_generator (5.0.1)
5
5
  builder
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -117,6 +117,7 @@ That's it! Welcome to the future!
117
117
 
118
118
  ## Changelog
119
119
 
120
+ * v5.0.1: Include new `SitemapGenerator::FogAdapter` ([#138](https://github.com/kjvarga/sitemap_generator/pull/138)). Fix usage of attr_* methods in LinkSet; don't override custom getters/setters ([#144](https://github.com/kjvarga/sitemap_generator/pull/144)). Fix breaking spec in Ruby 2 ([#142](https://github.com/kjvarga/sitemap_generator/pull/142)). Include Capistrano 3.x tasks ([#141](https://github.com/kjvarga/sitemap_generator/pull/141)).
120
121
  * v5.0.0: Support new `:compress` option for customizing which files get compressed. Remove old deprecated methods (see deprecation notices above). Support `fog_path_style` option in the `SitemapGenerator::S3Adapter` so buckets with dots in the name work over HTTPS without SSL certificate problems.
121
122
  * v4.3.1: Support integer timestamps. Update README for new features added in last release.
122
123
  * v4.3.0: Support `media` attibute on alternate links ([#125](https://github.com/kjvarga/sitemap_generator/issues/125)). Changed `SitemapGenerator::S3Adapter` to write files in a single operation, avoiding potential permissions errors when listing a directory prior to writing ([#130](https://github.com/kjvarga/sitemap_generator/issues/130)). Remove Sitemap Writer from ping task ([#129](https://github.com/kjvarga/sitemap_generator/issues/129)). Support `url:expires` element ([#126](https://github.com/kjvarga/sitemap_generator/issues/126)).
@@ -297,34 +298,27 @@ SitemapGenerator::Interpreter.send :include, RoutingHelper
297
298
 
298
299
  ## Deployments & Capistrano
299
300
 
300
- To ensure that your application's sitemaps are available after a deployment you can do one of the following:
301
+ To include the capistrano tasks just add the following to your Capfile:
301
302
 
302
- 1. **Generate sitemaps into a directory which is shared by all deployments.**
303
- You can set your sitemaps path to your shared directory using the `sitemaps_path` option. For example if we have a directory `public/shared/` that is shared by all deployments we can have our sitemaps generated into that directory by setting:
303
+ ```ruby
304
+ require 'capistrano/sitemap_generator'
305
+ ```
304
306
 
305
- ```ruby
306
- SitemapGenerator::Sitemap.sitemaps_path = 'shared/'
307
- ```
308
- 2. **Copy the sitemaps from the previous deploy over to the new deploy:**
309
- (You will need to customize the task if you are using custom sitemap filenames or locations.)
310
-
311
- ```ruby
312
- after "deploy:update_code", "deploy:copy_old_sitemap"
313
- namespace :deploy do
314
- task :copy_old_sitemap do
315
- run "if [ -e #{previous_release}/public/sitemap.xml.gz ]; then cp #{previous_release}/public/sitemap* #{current_release}/public/; fi"
316
- end
317
- end
318
- ```
319
- 3. **Regenerate your sitemaps after each deployment:**
307
+ Available capistrano tasks:
320
308
 
321
- ```ruby
322
- after "deploy", "refresh_sitemaps"
323
- task :refresh_sitemaps do
324
- run "cd #{latest_release} && RAILS_ENV=#{rails_env} rake sitemap:refresh"
325
- end
326
- ```
309
+ ```ruby
310
+ deploy:sitemap:create #Create sitemaps without pinging search engines
311
+ deploy:sitemap:refresh #Create sitemaps and ping search engines
312
+ deploy:sitemap:clean #Clean up sitemaps in the sitemap path
313
+ ```
314
+
315
+ **Generate sitemaps into a directory which is shared by all deployments.**
327
316
 
317
+ You can set your sitemaps path to your shared directory using the `sitemaps_path` option. For example if we have a directory `public/shared/` that is shared by all deployments we can have our sitemaps generated into that directory by setting:
318
+
319
+ ```ruby
320
+ SitemapGenerator::Sitemap.sitemaps_path = 'shared/'
321
+ ```
328
322
 
329
323
  ### Sitemaps with no Index File
330
324
 
@@ -351,11 +345,28 @@ And the default "intelligent" behaviour:
351
345
  SitemapGenerator::Sitemap.create_index = :auto
352
346
  ```
353
347
 
354
- ### Upload Sitemaps to a Remote Host
348
+ ### Upload Sitemaps to a Remote Host using Adapters
349
+
350
+ _This section needs better documentation. Please consider contributing._
351
+
352
+ #### Supported Adapters
353
+ * `SitemapGenerator::FileAdapter`
354
+
355
+ Standard adapter, writes out to a file
356
+
357
+ * `SitemapGenerator::FogAdapter`
358
+
359
+ Uses `fog` to upload to any service supported by Fog.
360
+
361
+ * `SitemapGenerator::S3Adapter`
362
+
363
+ Uses `fog` to upload to Amazon S3 storage.
364
+
365
+ * `SitemapGenerator::WaveAdapter`
366
+
367
+ Uses `carrierwave` to upload to any service supported by CarrierWave.
355
368
 
356
- > SitemapGenerator::S3Adapter is a simple S3 adapter which was added in v3.2 which
357
- > uses Fog and doesn't require CarrierWave. You can find a bit more information
358
- > about it [on the wiki page][remote_hosts].
369
+ Some documentation exists [on the wiki page][remote_hosts].
359
370
 
360
371
  Sometimes it is desirable to host your sitemap files on a remote server and point robots
361
372
  and search engines to the remote files. For example if you are using a host like Heroku
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.0.0
1
+ 5.0.1
@@ -0,0 +1 @@
1
+ load File.expand_path(File.join('..', 'tasks', 'sitemap_generator.cap'), __FILE__)
@@ -0,0 +1,36 @@
1
+ namespace :deploy do
2
+ namespace :sitemap do
3
+ desc 'Create sitemap and ping search engines'
4
+ task :refresh do
5
+ on roles :web do
6
+ within release_path do
7
+ with rails_env: fetch(:rails_env) do
8
+ execute :rake, "sitemap:refresh"
9
+ end
10
+ end
11
+ end
12
+ end
13
+
14
+ desc 'Create sitemap without pinging search engines'
15
+ task :create do
16
+ on roles :web do
17
+ within release_path do
18
+ with rails_env: fetch(:rails_env) do
19
+ execute :rake, "sitemap:create"
20
+ end
21
+ end
22
+ end
23
+ end
24
+
25
+ desc 'Clean up sitemaps in sitemap_generator path'
26
+ task :clean do
27
+ on roles :web do
28
+ within release_path do
29
+ with rails_env: fetch(:rails_env) do
30
+ execute :rake, "sitemap:clean"
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -12,6 +12,7 @@ module SitemapGenerator
12
12
  autoload(:FileAdapter, 'sitemap_generator/adapters/file_adapter')
13
13
  autoload(:S3Adapter, 'sitemap_generator/adapters/s3_adapter')
14
14
  autoload(:WaveAdapter, 'sitemap_generator/adapters/wave_adapter')
15
+ autoload(:FogAdapter, 'sitemap_generator/adapters/fog_adapter')
15
16
  autoload(:BigDecimal, 'sitemap_generator/core_ext/big_decimal')
16
17
  autoload(:Numeric, 'sitemap_generator/core_ext/numeric')
17
18
 
@@ -0,0 +1,28 @@
1
+ begin
2
+ require 'fog'
3
+ rescue LoadError
4
+ raise LoadError.new("Missing required 'fog'. Please 'gem install fog' and require it in your application.")
5
+ end
6
+
7
+ module SitemapGenerator
8
+ class FogAdapter
9
+
10
+ def initialize(opts = {})
11
+ @fog_credentials = opts[:fog_credentials]
12
+ @fog_directory = opts[:fog_directory]
13
+ end
14
+
15
+ # Call with a SitemapLocation and string data
16
+ def write(location, raw_data)
17
+ SitemapGenerator::FileAdapter.new.write(location, raw_data)
18
+
19
+ storage = Fog::Storage.new(@fog_credentials)
20
+ directory = storage.directories.new(:key => @fog_directory)
21
+ directory.files.create(
22
+ :key => location.path_in_public,
23
+ :body => File.open(location.path),
24
+ :public => true
25
+ )
26
+ end
27
+ end
28
+ end
@@ -8,7 +8,8 @@ module SitemapGenerator
8
8
  @@new_location_opts = [:filename, :sitemaps_path, :namer]
9
9
 
10
10
  attr_reader :default_host, :sitemaps_path, :filename, :create_index
11
- attr_accessor :verbose, :yahoo_app_id, :include_root, :include_index, :sitemaps_host, :adapter, :yield_sitemap
11
+ attr_accessor :include_root, :include_index, :adapter, :yield_sitemap
12
+ attr_writer :verbose
12
13
 
13
14
  # Create a new sitemap index and sitemap files. Pass a block with calls to the following
14
15
  # methods:
@@ -54,7 +54,12 @@ describe SitemapGenerator::Helpers::NumberHelper do
54
54
  number_with_precision(0, :precision => 0).should == "0"
55
55
  number_with_precision(0.001, :precision => 5).should == "0.00100"
56
56
  number_with_precision(0.00111, :precision => 3).should == "0.001"
57
- number_with_precision(9.995, :precision => 2).should == "9.99"
57
+ # Odd difference between Ruby versions
58
+ if RUBY_VERSION < '1.9.3'
59
+ number_with_precision(9.995, :precision => 2).should == "9.99"
60
+ else
61
+ number_with_precision(9.995, :precision => 2).should == "10.00"
62
+ end
58
63
  number_with_precision(10.995, :precision => 2).should == "11.00"
59
64
  end
60
65
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 5
7
7
  - 0
8
- - 0
9
- version: 5.0.0
8
+ - 1
9
+ version: 5.0.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Karl Varga
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2014-02-05 00:00:00 -08:00
17
+ date: 2014-03-04 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -84,7 +84,10 @@ files:
84
84
  - Rakefile
85
85
  - README.md
86
86
  - VERSION
87
+ - lib/capistrano/sitemap_generator.rb
88
+ - lib/capistrano/tasks/sitemap_generator.cap
87
89
  - lib/sitemap_generator/adapters/file_adapter.rb
90
+ - lib/sitemap_generator/adapters/fog_adapter.rb
88
91
  - lib/sitemap_generator/adapters/s3_adapter.rb
89
92
  - lib/sitemap_generator/adapters/wave_adapter.rb
90
93
  - lib/sitemap_generator/adapters.rb
@@ -174,7 +177,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
174
177
  requirements:
175
178
  - - ">="
176
179
  - !ruby/object:Gem::Version
177
- hash: -2638185396459765227
180
+ hash: 3343341669011167258
178
181
  segments:
179
182
  - 0
180
183
  version: "0"
@@ -183,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
186
  requirements:
184
187
  - - ">="
185
188
  - !ruby/object:Gem::Version
186
- hash: -2638185396459765227
189
+ hash: 3343341669011167258
187
190
  segments:
188
191
  - 0
189
192
  version: "0"