spree_sitemap_generator 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ Redistribution and use in source and binary forms, with or without modification,
2
+ are permitted provided that the following conditions are met:
3
+
4
+ * Redistributions of source code must retain the above copyright notice,
5
+ this list of conditions and the following disclaimer.
6
+ * Redistributions in binary form must reproduce the above copyright notice,
7
+ this list of conditions and the following disclaimer in the documentation
8
+ and/or other materials provided with the distribution.
9
+ * Neither the name of the Rails Dog LLC nor the names of its
10
+ contributors may be used to endorse or promote products derived from this
11
+ software without specific prior written permission.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,30 @@
1
+ Spree Sitemap Generator
2
+ =====================
3
+
4
+ Spree sitemap generator is a sitemap generator based on the sitemap_generator gem http://github.com/kjvarga/sitemap_generator. It adheres to the Sitemap 0.9 protocol specification.
5
+
6
+ Installation
7
+ =======
8
+
9
+ gem install spree-sitemap-generator
10
+
11
+ Example goes here.
12
+
13
+ Setup
14
+ ======
15
+
16
+ echo "public/sitemap*" >> .gitignore
17
+
18
+ Features
19
+ =====
20
+ - Notifies search engine of new sitemaps (Google, Yahoo, Ask, Bing)
21
+ - Compresses sitemaps with gzip
22
+ - Provides basic sitemap of a Spree site
23
+ - Allows you to easily add additional sitemaps for pages you add to your site
24
+
25
+
26
+ Special Thanks
27
+ =====
28
+
29
+
30
+ Copyright (c) 2010 [name of extension creator], released under the New BSD License
@@ -0,0 +1,13 @@
1
+ module SpreeSitemapGenerator
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../../templates", __FILE__)
5
+
6
+ desc "Configures your Rails application for use with spree_sitemap_generator"
7
+ def copy_config
8
+ directory "config"
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,31 @@
1
+ SitemapGenerator::Sitemap.add_links do |sitemap|
2
+ # Put links creation logic here.
3
+ #
4
+ # The root path '/' and sitemap index file are added automatically.
5
+ # Links are added to the Sitemap in the order they are specified.
6
+ #
7
+ # Usage: sitemap.add(path, options={})
8
+ # (default options are used if you don't specify)
9
+ #
10
+ # Defaults: :priority => 0.5, :changefreq => 'weekly',
11
+ # :lastmod => Time.now, :host => default_host
12
+ #
13
+ #
14
+ # Examples:
15
+ #
16
+ # Add '/articles'
17
+ #
18
+ # sitemap.add articles_path, :priority => 0.7, :changefreq => 'daily'
19
+ #
20
+ # Add individual articles:
21
+ #
22
+ # Article.find_each do |article|
23
+ # sitemap.add article_path(article), :lastmod => article.updated_at
24
+ # end
25
+ sitemap.add_login
26
+ sitemap.add_signup
27
+ sitemap.add_account
28
+ sitemap.add_password_reset
29
+ sitemap.add_taxons
30
+ sitemap.add_products
31
+ end
@@ -0,0 +1,37 @@
1
+ require 'spree_core'
2
+ require 'spree_sitemap_generator_hooks'
3
+ require 'sitemap_generator'
4
+
5
+ module SpreeSitemapGenerator
6
+ class Engine < Rails::Engine
7
+
8
+ config.autoload_paths += %W(#{config.root}/lib)
9
+
10
+ def self.activate
11
+
12
+ ActiveRecord::Relation.class_eval do
13
+ def last_updated
14
+ last_update = order('updated_at DESC').first
15
+ last_update.try(:updated_at)
16
+ end
17
+ end
18
+
19
+ ActiveRecord::Base.class_eval do
20
+ def self.last_updated
21
+ scoped.last_updated
22
+ end
23
+ end
24
+
25
+ SitemapGenerator::Sitemap.default_host = "http://#{Spree::Config[:site_url]}"
26
+
27
+ require 'spree_sitemap_generator/spree_defaults'
28
+ SitemapGenerator::LinkSet.send :include, SpreeSitemapGenerator::SpreeDefaults
29
+
30
+ Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
31
+ Rails.env.production? ? require(c) : load(c)
32
+ end
33
+ end
34
+
35
+ config.to_prepare &method(:activate).to_proc
36
+ end
37
+ end
@@ -0,0 +1,41 @@
1
+ module SpreeSitemapGenerator::SpreeDefaults
2
+ def default_url_options
3
+ {:host => URI.parse(SitemapGenerator::Sitemap.default_host).host}
4
+ end
5
+ include ::Rails.application.routes.url_helpers
6
+
7
+ def add_login(options={})
8
+ add(login_path, options)
9
+ end
10
+
11
+ def add_signup(options={})
12
+ add(signup_path, options)
13
+ end
14
+
15
+ def add_account(options={})
16
+ add(account_path, options)
17
+ end
18
+
19
+ def add_password_reset(options={})
20
+ add(new_password_reset_path, options)
21
+ end
22
+
23
+ def add_products(options={})
24
+ active_products = Product.active
25
+
26
+ add(products_path, options.merge(:lastmod => active_products.last_updated))
27
+ active_products.each do |product|
28
+ add(product_path(product), options.merge(:lastmod => product.updated_at))
29
+ end
30
+ end
31
+
32
+ def add_taxons(options={})
33
+ Taxon.roots.each {|taxon| add_taxon(taxon, options) }
34
+ end
35
+
36
+ def add_taxon(taxon, options={})
37
+ add(nested_taxons_path(taxon.permalink), options.merge(:lastmod => taxon.products.last_updated))
38
+ taxon.children.each {|child| add_taxon(child, options) }
39
+ end
40
+ end
41
+
@@ -0,0 +1,3 @@
1
+ class SpreeSitemapGeneratorHooks < Spree::ThemeSupport::HookListener
2
+ # custom hooks go here
3
+ end
@@ -0,0 +1,5 @@
1
+ # add custom rake tasks here
2
+ desc 'test it'
3
+ task :foo do
4
+ puts 1
5
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spree_sitemap_generator
3
+ version: !ruby/object:Gem::Version
4
+ hash: 3
5
+ prerelease: false
6
+ segments:
7
+ - 3
8
+ - 0
9
+ - 2
10
+ version: 3.0.2
11
+ platform: ruby
12
+ authors: []
13
+
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-06 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: spree_core
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 101
30
+ segments:
31
+ - 0
32
+ - 30
33
+ - 1
34
+ version: 0.30.1
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: sitemap_generator
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 19
46
+ segments:
47
+ - 1
48
+ - 3
49
+ - 4
50
+ version: 1.3.4
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ description:
54
+ email:
55
+ executables: []
56
+
57
+ extensions: []
58
+
59
+ extra_rdoc_files: []
60
+
61
+ files:
62
+ - README.md
63
+ - LICENSE
64
+ - lib/spree_sitemap_generator.rb
65
+ - lib/tasks/spree_sitemap_generator.rake
66
+ - lib/spree_sitemap_generator/spree_defaults.rb
67
+ - lib/spree_sitemap_generator_hooks.rb
68
+ - lib/generators/templates/config/sitemap.rb
69
+ - lib/generators/spree_sitemap_generator/install_generator.rb
70
+ has_rdoc: true
71
+ homepage:
72
+ licenses: []
73
+
74
+ post_install_message:
75
+ rdoc_options: []
76
+
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ hash: 57
85
+ segments:
86
+ - 1
87
+ - 8
88
+ - 7
89
+ version: 1.8.7
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ hash: 3
96
+ segments:
97
+ - 0
98
+ version: "0"
99
+ requirements:
100
+ - none
101
+ rubyforge_project:
102
+ rubygems_version: 1.3.7
103
+ signing_key:
104
+ specification_version: 3
105
+ summary: Add gem summary here
106
+ test_files: []
107
+