solidus_sitemap 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 718fecbf020589158c6f22d26213dc8aedd8a67a
4
+ data.tar.gz: 2b9e64f822ede23cd8b7f56cc13d71fd1329f61c
5
+ SHA512:
6
+ metadata.gz: 77256038eb46f5f659a3e8d5c87ffc66617c77124a9dd7c257852cfb125dd6e2e591913a856094d6d6ad8e9d065b2fab87c47b013f4c97bc3973739a3d21b928
7
+ data.tar.gz: 1ecda5f6886e8e39c77fbd4bfc27c569e4daec0eb1692fec4c4fa53c4368d237143e1cad08ffc9650879c983ac6b4192b34310ffe611682c889314954c61aa4b
@@ -0,0 +1,14 @@
1
+ \#*
2
+ *~
3
+ .#*
4
+ .DS_Store
5
+ tmp
6
+ *.swp
7
+ spec/dummy
8
+ pkg
9
+ Gemfile.lock
10
+ coverage
11
+ .rvmrc
12
+ .ruby-version
13
+ .ruby-gemset
14
+ .bundle
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ -r spec_helper
3
+ -r pry
4
+ -f documentation
@@ -0,0 +1,19 @@
1
+ sudo: false
2
+ cache: bundler
3
+ language: ruby
4
+ rvm:
5
+ - 2.3.1
6
+ env:
7
+ matrix:
8
+ - SOLIDUS_BRANCH=v1.1 DB=postgres
9
+ - SOLIDUS_BRANCH=v1.2 DB=postgres
10
+ - SOLIDUS_BRANCH=v1.3 DB=postgres
11
+ - SOLIDUS_BRANCH=v1.4 DB=postgres
12
+ - SOLIDUS_BRANCH=v2.0 DB=postgres
13
+ - SOLIDUS_BRANCH=master DB=postgres
14
+ - SOLIDUS_BRANCH=v1.1 DB=mysql
15
+ - SOLIDUS_BRANCH=v1.2 DB=mysql
16
+ - SOLIDUS_BRANCH=v1.3 DB=mysql
17
+ - SOLIDUS_BRANCH=v1.4 DB=mysql
18
+ - SOLIDUS_BRANCH=v2.0 DB=mysql
19
+ - SOLIDUS_BRANCH=master DB=mysql
@@ -0,0 +1,90 @@
1
+ # Contributing
2
+
3
+ Solidus Sitemap is an open source project and we encourage contributions. Please
4
+ see the [contributor guidelines](https://github.com/solidusio/solidus/blob/master/CONTRIBUTING.md)
5
+ for more information before contributing.
6
+
7
+ In the spirit of [free software][1], **everyone** is encouraged to help improve
8
+ this project.
9
+
10
+ Here are some ways *you* can contribute:
11
+
12
+ * by using prerelease versions
13
+ * by reporting [bugs][2]
14
+ * by suggesting new features
15
+ * by writing or editing documentation
16
+ * by writing specifications
17
+ * by writing code (*no patch is too small*: fix typos, add comments, clean up
18
+ inconsistent whitespace)
19
+ * by refactoring code
20
+ * by resolving [issues][2]
21
+ * by reviewing patches
22
+
23
+ ---
24
+
25
+ ## Filing an issue
26
+
27
+ When filing an issue on this extension, please first do these things:
28
+
29
+ * Verify you can reproduce this issue in a brand new application.
30
+ * Run through the steps to reproduce the issue again.
31
+
32
+ In the issue itself please provide:
33
+
34
+ * A comprehensive list of steps to reproduce the issue.
35
+ * What you're *expecting* to happen compared with what's *actually* happening.
36
+ * The version of Solidus *and* the version of Rails.
37
+ * A list of all extensions.
38
+ * Any relevant stack traces ("Full trace" preferred)
39
+ * Your `Gemfile`
40
+
41
+ In 99% of cases, this information is enough to determine the cause and solution
42
+ to the problem that is being described.
43
+
44
+ ---
45
+
46
+ ## Pull requests
47
+
48
+ We gladly accept pull requests to fix bugs and, in some circumstances, add new
49
+ features to this extension.
50
+
51
+ Here's a quick guide:
52
+
53
+ 1. Fork the repo.
54
+ 2. Run the tests. We only take pull requests with passing tests, and it's great
55
+ to know that you have a clean slate.
56
+ 3. Create new branch then make changes and add tests for your changes. Only
57
+ refactoring and documentation changes require no new tests. If you are adding
58
+ functionality or fixing a bug, we need tests!
59
+ 4. Push to your fork and submit a pull request. If the changes will apply
60
+ cleanly to the latest stable branches and master branch, you will only need
61
+ to submit one pull request.
62
+
63
+ At this point you're waiting on us. We may suggest some changes or improvements
64
+ or alternatives.
65
+
66
+ Some things that will increase the chance that your pull request is accepted,
67
+ taken straight from the Ruby on Rails guide:
68
+
69
+ * Use Rails idioms and helpers.
70
+ * Include tests that fail without your code, and pass with it.
71
+ * Update the documentation, the surrounding one, examples elsewhere, guides,
72
+ whatever is affected by your contribution.
73
+
74
+ ---
75
+
76
+ ## TL;DR
77
+
78
+ * Fork the repo
79
+ * Clone your repo
80
+ * Run `bundle install`
81
+ * Run `bundle exec rake test_app` to create the test application in `spec/dummy`
82
+ * Make your changes
83
+ * Ensure specs pass by running `bundle exec rspec spec`
84
+ * Ensure all syntax ok by running `rubocop .`
85
+ * Submit your pull request
86
+
87
+ And in case we didn't emphasize it enough: **we love tests!**
88
+
89
+ [1]: http://www.fsf.org/licensing/essays/free-sw.html
90
+ [2]: https://github.com/StemboltHQ/solidus_sitemap/issues
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source "https://rubygems.org"
2
+
3
+ branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
4
+ gem "solidus", github: "solidusio/solidus", branch: branch
5
+
6
+ if branch == 'master' || branch >= "v2.0"
7
+ gem "rails-controller-testing", group: :test
8
+ end
9
+
10
+ gem 'pg'
11
+ gem 'mysql2'
12
+
13
+ group :development, :test do
14
+ gem "pry-rails"
15
+ end
16
+
17
+ gemspec
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2011-2015 Jeff Dutil and other contributors
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name Solidus nor the names of its contributors may be used to
13
+ endorse or promote products derived from this software without specific
14
+ prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,113 @@
1
+ # Solidus Sitemap
2
+
3
+ [![Build Status](https://travis-ci.org/solidusio-contrib/solidus_sitemap.svg?branch=master)](https://travis-ci.org/solidusio-contrib/solidus_sitemap)
4
+
5
+ Solidus Sitemap is a sitemap generator based on the [sitemap_generator][1] gem.
6
+ It adheres to the Sitemap 0.9 protocol specification. This is a continuation of
7
+ the [original Spree version](https://github.com/spree-contrib/spree_sitemap),
8
+ updated to work with the [Solidus](https://solidus.io) eCommerce platform.
9
+
10
+ ### Features
11
+
12
+ - Notifies search engine of new sitemaps (Google, Yahoo, Ask, Bing)
13
+ - Supports large huge product catalogs
14
+ - Adheres to 0.9 Sitemap protocol specification
15
+ - Compresses sitemaps with gzip
16
+ - Provides basic sitemap of a Solidus site (products, taxons, login page, signup page)
17
+ - Easily add additional sitemaps for pages you add to your solidus site
18
+ - Supports Amazon S3 and other hosting services
19
+ - Thin wrapper over battle tested sitemap generator
20
+
21
+ ### Configuration Options
22
+
23
+ Check out the [README][1] for the [sitemap_generator][1].
24
+
25
+ ---
26
+
27
+ ## Installation
28
+
29
+ 1. Add the gem to your Solidus store's `Gemfile`:
30
+ ```ruby
31
+ gem 'solidus_sitemap', github: 'solidusio-contrib/solidus_sitemap', branch: 'master'
32
+ ```
33
+
34
+ 2. Update your bundle:
35
+
36
+ ```
37
+ $ bundle install
38
+ ```
39
+
40
+ 3. Run the installer, it will create a `config/sitemap.rb` file with some sane
41
+ defaults
42
+
43
+ ```
44
+ $ rails g solidus_sitemap:install
45
+ ```
46
+
47
+ 4. Add the sitemap to your `.gitignore`, since it will be regenerated
48
+ server-side.
49
+
50
+ ```
51
+ $ echo "public/sitemap*" >> .gitignore
52
+ ```
53
+
54
+ 5. Set up a cron job to regenrate your sitemap via the `rake sitemap:refresh`
55
+ task. If you use the [Whenever gem](https://github.com/javan/whenever), add
56
+ this to your `config/schedule.rb`:
57
+
58
+ ```ruby
59
+ every 1.day, at: '5:00 am' do
60
+ rake '-s sitemap:refresh'
61
+ end
62
+ ```
63
+
64
+ 6. Ensure crawlers can find the sitemap, by adding the following line to your
65
+ `public/robots.txt` with your correct domain name
66
+
67
+ ```
68
+ $ echo "Sitemap: http://www.example.com/sitemap.xml.gz" >> public/robots.txt
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Acknowledgements
74
+
75
+ - [The original Spree version of this gem](https://github.com/spree-contrib/spree_sitemap)
76
+ - [The creators & contributors of sitemap_generator](http://github.com/kjvarga/sitemap_generator/contributors)
77
+ - [Joshua Nussbaum's original implementation of spree-sitemap-generator](https://github.com/joshnuss/spree-sitemap-generator)
78
+
79
+ ---
80
+
81
+ ## Upgrading
82
+
83
+ If you upgrade from early versions of `solidus_sitemap` you need to change your sitemaps from:
84
+ ```ruby
85
+ SitemapGenerator::Sitemap.add_links do
86
+ # ...
87
+ end
88
+ ```
89
+
90
+ to this:
91
+ ```ruby
92
+ SitemapGenerator::Sitemap.create do
93
+ # ...
94
+ end
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Contributing
100
+
101
+ See corresponding [guidelines][2]
102
+
103
+ ---
104
+
105
+ Copyright (c) 2016 [Stembolt](https://stembolt.com/)
106
+
107
+ Copyright (c) 2011-2015 [Jeff Dutil][5] and other [contributors][6], released under the [New BSD License][4].
108
+
109
+ [1]: http://github.com/kjvarga/sitemap_generator
110
+ [2]: https://github.com/spree-contrib/spree_i18n/blob/master/CONTRIBUTING.md
111
+ [4]: https://github.com/spree-contrib/spree_sitemap/blob/master/LICENSE.md
112
+ [5]: https://github.com/jdutil
113
+ [6]: https://github.com/solidusio-contrib/solidus_sitemap/graphs/contributors
@@ -0,0 +1,21 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rspec/core/rake_task'
5
+ require 'spree/testing_support/extension_rake'
6
+
7
+ RSpec::Core::RakeTask.new
8
+
9
+ task :default do
10
+ if Dir["spec/dummy"].empty?
11
+ Rake::Task[:test_app].invoke
12
+ Dir.chdir("../../")
13
+ end
14
+ Rake::Task[:spec].invoke
15
+ end
16
+
17
+ desc 'Generates a dummy app for testing'
18
+ task :test_app do
19
+ ENV['LIB_NAME'] = 'solidus_sitemap'
20
+ Rake::Task['extension:test_app'].invoke
21
+ end
@@ -0,0 +1,12 @@
1
+ module SolidusSitemap
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 solidus_sitemap'
7
+ def copy_config
8
+ directory 'config'
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,52 @@
1
+ SitemapGenerator::Sitemap.default_host = "http://#{Spree::Store.default.url}"
2
+
3
+ ##
4
+ ## If using Heroku or similar service where you want sitemaps to live in S3 you'll need to setup these settings.
5
+ ##
6
+
7
+ ## Pick a place safe to write the files
8
+ # SitemapGenerator::Sitemap.public_path = 'tmp/'
9
+
10
+ ## Store on S3 using Fog - Note must add fog to your Gemfile.
11
+ # SitemapGenerator::Sitemap.adapter = SitemapGenerator::S3Adapter.new(aws_access_key_id: Spree::Config[:s3_access_key],
12
+ # aws_secret_access_key: Spree::Config[:s3_secret],
13
+ # fog_provider: 'AWS',
14
+ # fog_directory: Spree::Config[:s3_bucket])
15
+
16
+ ## Inform the map cross-linking where to find the other maps.
17
+ # SitemapGenerator::Sitemap.sitemaps_host = "http://#{Spree::Config[:s3_bucket]}.s3.amazonaws.com/"
18
+
19
+ ## Pick a namespace within your bucket to organize your maps. Note you'll need to set this directory to be public.
20
+ # SitemapGenerator::Sitemap.sitemaps_path = 'sitemaps/'
21
+
22
+ SitemapGenerator::Sitemap.create do
23
+ # Put links creation logic here.
24
+ #
25
+ # The root path '/' and sitemap index file are added automatically.
26
+ # Links are added to the Sitemap in the order they are specified.
27
+ #
28
+ # Usage: add(path, options = {})
29
+ # (default options are used if you don't specify)
30
+ #
31
+ # Defaults: priority: 0.5, changefreq: 'weekly',
32
+ # lastmod: Time.now, host: default_host
33
+ #
34
+ #
35
+ # Examples:
36
+ #
37
+ # Add '/articles'
38
+ #
39
+ # add articles_path, priority: 0.7, changefreq: 'daily'
40
+ #
41
+ # Add individual articles:
42
+ #
43
+ # Article.find_each do |article|
44
+ # add article_path(article), lastmod: article.updated_at
45
+ # end
46
+ add_login
47
+ add_signup
48
+ add_account
49
+ add_password_reset
50
+ add_taxons
51
+ add_products
52
+ end
@@ -0,0 +1,4 @@
1
+ require 'spree_core'
2
+ require 'sitemap_generator'
3
+ require 'solidus_sitemap/engine'
4
+ require 'solidus_sitemap/version'
@@ -0,0 +1,26 @@
1
+ module SolidusSitemap
2
+ class Engine < Rails::Engine
3
+ require 'spree/core'
4
+ isolate_namespace Spree
5
+ engine_name 'solidus_sitemap'
6
+
7
+ config.autoload_paths += %W(#{config.root}/lib)
8
+
9
+ def self.activate
10
+ Spree::Product.class_eval do
11
+ def self.last_updated
12
+ last_update = order('spree_products.updated_at DESC').first
13
+ last_update.try(:updated_at)
14
+ end
15
+ end
16
+
17
+ require 'solidus_sitemap/solidus_defaults'
18
+ SitemapGenerator::Interpreter.send :include, SolidusSitemap::SolidusDefaults
19
+ if defined? SitemapGenerator::LinkSet
20
+ SitemapGenerator::LinkSet.send :include, SolidusSitemap::SolidusDefaults
21
+ end
22
+ end
23
+
24
+ config.to_prepare(&method(:activate).to_proc)
25
+ end
26
+ end
@@ -0,0 +1,107 @@
1
+ module SolidusSitemap::SolidusDefaults
2
+ include Spree::Core::Engine.routes.url_helpers
3
+ include Spree::BaseHelper # for meta_data
4
+
5
+ def default_url_options
6
+ { host: SitemapGenerator::Sitemap.default_host }
7
+ end
8
+
9
+ def add_login(options = {})
10
+ add(login_path, options)
11
+ end
12
+
13
+ def add_signup(options = {})
14
+ add(signup_path, options)
15
+ end
16
+
17
+ def add_account(options = {})
18
+ add(account_path, options)
19
+ end
20
+
21
+ def add_password_reset(options = {})
22
+ add(new_spree_user_password_path, options)
23
+ end
24
+
25
+ def add_products(options = {})
26
+ active_products = Spree::Product.active.uniq
27
+
28
+ add(products_path, options.merge(lastmod: active_products.last_updated))
29
+ active_products.each do |product|
30
+ add_product(product, options)
31
+ end
32
+ end
33
+
34
+ def add_product(product, options = {})
35
+ opts = options.merge(lastmod: product.updated_at)
36
+
37
+ if gem_available?('spree_videos') && product.videos.present?
38
+ # TODO: add exclusion list configuration option
39
+ # https://sites.google.com/site/webmasterhelpforum/en/faq-video-sitemaps#multiple-pages
40
+
41
+ # don't include all the videos on the page to avoid duplicate title warnings
42
+ primary_video = product.videos.first
43
+ opts.merge!(video: [video_options(primary_video.youtube_ref, product)])
44
+ end
45
+
46
+ add(product_path(product), opts)
47
+ end
48
+
49
+ def add_pages(options = {})
50
+ # TODO: this should be refactored to add_pages & add_page
51
+
52
+ Spree::Page.active.each do |page|
53
+ add(page.path, options.merge(lastmod: page.updated_at))
54
+ end if gem_available? 'spree_essential_cms'
55
+
56
+ Spree::Page.visible.each do |page|
57
+ add(page.slug, options.merge(lastmod: page.updated_at))
58
+ end if gem_available? 'spree_static_content'
59
+ end
60
+
61
+ def add_taxons(options = {})
62
+ Spree::Taxon.roots.each { |taxon| add_taxon(taxon, options) }
63
+ end
64
+
65
+ def add_taxon(taxon, options = {})
66
+ add(nested_taxons_path(taxon.permalink), options.merge(lastmod: taxon.products.last_updated)) if taxon.permalink.present?
67
+ taxon.children.each { |child| add_taxon(child, options) }
68
+ end
69
+
70
+ def gem_available?(name)
71
+ Gem::Specification.find_by_name(name)
72
+ rescue Gem::LoadError
73
+ false
74
+ rescue
75
+ Gem.available?(name)
76
+ end
77
+
78
+ def main_app
79
+ Rails.application.routes.url_helpers
80
+ end
81
+
82
+ private
83
+
84
+ ##
85
+ # Multiple videos of the same ID can exist, but all videos linked in the sitemap should be inique
86
+ #
87
+ # Required video fields:
88
+ # http://www.seomoz.org/blog/video-sitemap-guide-for-vimeo-and-youtube
89
+ #
90
+ # YouTube thumbnail images:
91
+ # http://www.reelseo.com/youtube-thumbnail-image/
92
+ #
93
+ # NOTE title should match the page title, however the title generation isn't self-contained
94
+ # although not a future proof solution, the best (+ easiest) solution is to mimic the title for product pages
95
+ # https://github.com/solidusio/solidus/blob/1-3-stable/core/lib/spree/core/controller_helpers/common.rb#L39
96
+ # https://github.com/solidusio/solidus/blob/1-3-stable/core/app/controllers/spree/products_controller.rb#L41
97
+ #
98
+ def video_options(youtube_id, object = false)
99
+ ({ description: meta_data(object)[:description] } rescue {}).merge(
100
+ ({ title: [Spree::Config[:site_name], object.name].join(' - ') } rescue {})
101
+ ).merge(
102
+ thumbnail_loc: "http://img.youtube.com/vi/#{youtube_id}/0.jpg",
103
+ player_loc: "http://www.youtube.com/v/#{youtube_id}",
104
+ autoplay: 'ap=1'
105
+ )
106
+ end
107
+ end
@@ -0,0 +1,18 @@
1
+ module SolidusSitemap
2
+ module_function
3
+
4
+ # Returns the version of the currently loaded SolidusSitemap as a
5
+ # <tt>Gem::Version</tt>.
6
+ def version
7
+ Gem::Version.new VERSION::STRING
8
+ end
9
+
10
+ module VERSION
11
+ MAJOR = 1
12
+ MINOR = 0
13
+ TINY = 0
14
+ PRE = nil
15
+
16
+ STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
17
+ end
18
+ end
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib/', __FILE__)
3
+ $LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
4
+
5
+ require 'solidus_sitemap/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.platform = Gem::Platform::RUBY
9
+ s.name = 'solidus_sitemap'
10
+ s.version = SolidusSitemap.version
11
+ s.summary = 'Provides a sitemap file for Solidus'
12
+ s.description = s.summary
13
+ s.required_ruby_version = '>= 2.1.0'
14
+
15
+ s.author = 'Stembolt'
16
+ s.email = 'contact@stembolt.com'
17
+ s.homepage = 'https://github.com/StemboltHQ/solidus_sitemap'
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = `git ls-files -- spec/*`.split("\n")
21
+ s.require_path = 'lib'
22
+ s.requirements << 'none'
23
+
24
+ s.add_runtime_dependency 'solidus_core', ['>= 1.1', '< 3']
25
+ s.add_runtime_dependency 'sitemap_generator', '~> 5.1.0'
26
+
27
+ s.add_development_dependency 'database_cleaner', '~> 1.4.0'
28
+ s.add_development_dependency 'factory_girl', '~> 4.4'
29
+ s.add_development_dependency 'ffaker'
30
+ s.add_development_dependency 'rspec-rails', '~> 3.5'
31
+ s.add_development_dependency 'sqlite3', '~> 1.3.10'
32
+ s.add_development_dependency 'simplecov', '~> 0.9.0'
33
+ end
@@ -0,0 +1,57 @@
1
+ RSpec.describe SolidusSitemap::SolidusDefaults do
2
+ before do
3
+ @interpreter = SitemapGenerator::Interpreter.send :include, SolidusSitemap::SolidusDefaults
4
+ end
5
+
6
+ subject { @interpreter.new }
7
+
8
+ context 'Interpreter' do
9
+ %w( add_login
10
+ add_signup
11
+ add_account
12
+ add_password_reset
13
+ add_products
14
+ add_product
15
+ add_pages
16
+ add_taxons
17
+ add_taxons ).each do |method|
18
+ it "inherit included method #{method.to_sym}" do
19
+ expect(subject.respond_to?(method.to_sym)).to be(true)
20
+ end
21
+ end
22
+ end
23
+
24
+ context '.default_url_options' do
25
+ it 'returns a hash' do
26
+ expect(subject.default_url_options).to be_a Hash
27
+ end
28
+ end
29
+
30
+ context '.gem_available?' do
31
+ it 'verifies that gem is available' do
32
+ expect(subject.gem_available?('rspec-rails')).to be_truthy
33
+ end
34
+
35
+ context 'when there is no such gem' do
36
+ it 'returns false' do
37
+ expect(subject.gem_available?('fake_solidus_gem_name')).to be false
38
+ end
39
+ end
40
+ end
41
+
42
+ describe '.main_app' do
43
+ context 'returns the url helpers module for the application' do
44
+ it { expect(subject.main_app).to respond_to(:url_for, :spree_path, :_routes) }
45
+ end
46
+ end
47
+
48
+ skip '.add_login(options = {})'
49
+ skip '.add_signup(options = {})'
50
+ skip '.add_account(options = {})'
51
+ skip '.add_password_reset(options = {})'
52
+ skip '.add_products(options = {})'
53
+ skip '.add_product(product, options = {})'
54
+ skip '.add_pages(options = {})'
55
+ skip '.add_taxons(options = {})'
56
+ skip '.add_taxon(taxon, options = {})'
57
+ end
@@ -0,0 +1,24 @@
1
+ require 'simplecov'
2
+ SimpleCov.start do
3
+ add_group 'Libraries', 'lib'
4
+ add_filter 'spec'
5
+ end
6
+
7
+ ENV['RAILS_ENV'] ||= 'test'
8
+
9
+ begin
10
+ require File.expand_path('../dummy/config/environment', __FILE__)
11
+ rescue LoadError
12
+ puts 'Could not load dummy application. Please ensure you have run `bundle exec rake test_app`'
13
+ exit
14
+ end
15
+
16
+ require 'rspec/rails'
17
+ require 'ffaker'
18
+
19
+ RSpec.configure do |config|
20
+ config.use_transactional_fixtures = false
21
+ config.infer_base_class_for_anonymous_controllers = false
22
+ end
23
+
24
+ Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |file| require file }
@@ -0,0 +1,16 @@
1
+ require 'database_cleaner'
2
+
3
+ RSpec.configure do |config|
4
+ config.before(:suite) do
5
+ DatabaseCleaner.clean_with :truncation
6
+ end
7
+
8
+ config.before do
9
+ DatabaseCleaner.strategy = :transaction
10
+ DatabaseCleaner.start
11
+ end
12
+
13
+ config.after do
14
+ DatabaseCleaner.clean
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ require 'factory_girl'
2
+
3
+ RSpec.configure do |config|
4
+ config.include FactoryGirl::Syntax::Methods
5
+ end
@@ -0,0 +1,6 @@
1
+ require 'spree/testing_support/factories'
2
+ require 'spree/testing_support/url_helpers'
3
+
4
+ RSpec.configure do |config|
5
+ config.include Spree::TestingSupport::UrlHelpers
6
+ end
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: solidus_sitemap
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Stembolt
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-09-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: solidus_core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '1.1'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '3'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '1.1'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '3'
33
+ - !ruby/object:Gem::Dependency
34
+ name: sitemap_generator
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 5.1.0
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: 5.1.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: database_cleaner
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: 1.4.0
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: 1.4.0
61
+ - !ruby/object:Gem::Dependency
62
+ name: factory_girl
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '4.4'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '4.4'
75
+ - !ruby/object:Gem::Dependency
76
+ name: ffaker
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rspec-rails
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '3.5'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '3.5'
103
+ - !ruby/object:Gem::Dependency
104
+ name: sqlite3
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: 1.3.10
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: 1.3.10
117
+ - !ruby/object:Gem::Dependency
118
+ name: simplecov
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: 0.9.0
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: 0.9.0
131
+ description: Provides a sitemap file for Solidus
132
+ email: contact@stembolt.com
133
+ executables: []
134
+ extensions: []
135
+ extra_rdoc_files: []
136
+ files:
137
+ - ".gitignore"
138
+ - ".rspec"
139
+ - ".travis.yml"
140
+ - CONTRIBUTING.md
141
+ - Gemfile
142
+ - LICENSE.md
143
+ - README.md
144
+ - Rakefile
145
+ - lib/generators/solidus_sitemap/install/install_generator.rb
146
+ - lib/generators/templates/config/sitemap.rb
147
+ - lib/solidus_sitemap.rb
148
+ - lib/solidus_sitemap/engine.rb
149
+ - lib/solidus_sitemap/solidus_defaults.rb
150
+ - lib/solidus_sitemap/version.rb
151
+ - solidus_sitemap.gemspec
152
+ - spec/lib/solidus_sitemap/solidus_defaults_spec.rb
153
+ - spec/spec_helper.rb
154
+ - spec/support/database_cleaner.rb
155
+ - spec/support/factory_girl.rb
156
+ - spec/support/spree.rb
157
+ homepage: https://github.com/StemboltHQ/solidus_sitemap
158
+ licenses: []
159
+ metadata: {}
160
+ post_install_message:
161
+ rdoc_options: []
162
+ require_paths:
163
+ - lib
164
+ required_ruby_version: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: 2.1.0
169
+ required_rubygems_version: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ requirements:
175
+ - none
176
+ rubyforge_project:
177
+ rubygems_version: 2.5.1
178
+ signing_key:
179
+ specification_version: 4
180
+ summary: Provides a sitemap file for Solidus
181
+ test_files:
182
+ - spec/lib/solidus_sitemap/solidus_defaults_spec.rb
183
+ - spec/spec_helper.rb
184
+ - spec/support/database_cleaner.rb
185
+ - spec/support/factory_girl.rb
186
+ - spec/support/spree.rb