simple_sitemap 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,9 +8,9 @@ A simple sitemap generator
8
8
 
9
9
  ```ruby
10
10
  SimpleSitemap.configure do |config|
11
- config.local_path = 'tmp/'
11
+ config.local_path = 'public/sitemaps/'
12
12
  config.default_path = 'http://yoursite.com'
13
- config.sitemap_location = 'http://yoursite.com/sitemap'
13
+ config.sitemap_location = 'http://yoursite.com/sitemaps'
14
14
  end
15
15
  ```
16
16
 
@@ -47,6 +47,7 @@ SimpleSitemap gives you a after_write hook for easy access to sitemap files as t
47
47
  For example, to upload sitmaps to S3
48
48
 
49
49
  ```ruby
50
+ require 'fog'
50
51
  SimpleSitemap.after_write do |filename|
51
52
  s3 = Fog::Storage.new({
52
53
  provider: 'AWS',
@@ -25,11 +25,12 @@ module SimpleSitemap
25
25
  end
26
26
 
27
27
  def build(opts={}, &block)
28
+ config = OpenStruct.new(@config.marshal_dump.merge opts)
28
29
  start_time = Time.now
29
- generator = Generators::Sitemap.new @config, @hooks
30
+ generator = Generators::Sitemap.new config, @hooks
30
31
  generator.instance_eval &block
31
32
  generator.write!
32
- puts "Time taken: #{Time.now - start_time}" if @config.verbose
33
+ puts "Time taken: #{Time.now - start_time}" if config.verbose
33
34
  end
34
35
 
35
36
  def after_write(&block)
@@ -26,6 +26,9 @@ module SimpleSitemap
26
26
  def write!
27
27
  xml = to_xml
28
28
  index_filename = 'index.xml'
29
+ if @config.prefix
30
+ index_filename = "#{@config.prefix}_#{index_filename}"
31
+ end
29
32
  if @config.gzip
30
33
  index_filename << '.gz'
31
34
  end
@@ -105,6 +105,9 @@ module SimpleSitemap
105
105
  else
106
106
  "sitemap_#{index}.xml"
107
107
  end
108
+ if @config.prefix
109
+ filename = "#{@config.prefix}_#{filename}"
110
+ end
108
111
  if @config.gzip
109
112
  filename << '.gz'
110
113
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleSitemap
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_sitemap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-22 00:00:00.000000000 Z
12
+ date: 2012-07-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
- requirement: &70222280337640 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,12 @@ dependencies:
21
21
  version: 1.5.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70222280337640
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.5.0
25
30
  description: A simple sitemap generator
26
31
  email:
27
32
  - rpjlower@gmail.com
@@ -62,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
67
  version: '0'
63
68
  requirements: []
64
69
  rubyforge_project:
65
- rubygems_version: 1.8.11
70
+ rubygems_version: 1.8.23
66
71
  signing_key:
67
72
  specification_version: 3
68
73
  summary: Simple sitemap generator