usmu-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: bfc8ce619386c1feac5427d360c7468aa30c3ca8
4
+ data.tar.gz: bebe731b34e98f374acce16863d8d31c4e3b32ef
5
+ SHA512:
6
+ metadata.gz: 25083b825afa8b1fb099cc3e238b23fc005ea3462138379a5138301514bfdb2120e816de71e2c4d7d3dadff3ed3b842b72c9158e7707ebb09a70b5dece56aa79
7
+ data.tar.gz: 228d47871f982db48ac4c27e7144112312dc00fc5ef6caf7ca0bb261e63cb0e439025bb5a332cc4cccbe4098a88b435492189a599c50681c9f9797fd7981bdd1
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile*.lock
4
+ /_yardoc/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /vendor
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,5 @@
1
+ --color
2
+ -I spec
3
+ --require spec_helper
4
+ --format documentation
5
+ --no-profile
@@ -0,0 +1,24 @@
1
+ language: ruby
2
+ before_install: gem update bundler
3
+ install: bundle install --jobs 3 --retry 3 --without mutant
4
+ script: rake ci
5
+ rvm:
6
+ - 2.0
7
+ - 2.1
8
+ - 2.2
9
+ - ruby-head
10
+ - rbx
11
+ matrix:
12
+ include:
13
+ - rvm: jruby
14
+ env: JRUBY_OPTS='--2.0'
15
+ - rvm: jruby-head
16
+ env: JRUBY_OPTS='--2.0'
17
+ allow_failures:
18
+ - rvm: jruby
19
+ - rvm: jruby-head
20
+ - rvm: mruby-head
21
+ - rvm: rbx
22
+ addons:
23
+ code_climate:
24
+ repo_token: ebb97d3c606e22753911d08f39444a86f27a7da6a40d834f94d640375615fff8
@@ -0,0 +1 @@
1
+ --private --protected --default-return void -m markdown -M redcarpet -- lib/**/*.rb - README.md CHANGELOG.md
@@ -0,0 +1,11 @@
1
+ # Usmu sitemap plugin change log
2
+
3
+ ## 1.0.0
4
+
5
+ Matthew Scharley <matt.scharley@gmail.com>
6
+
7
+ * Initial pass of the plugin structure (ffacf001766deb558122eadaa8c88a710345c10f)
8
+ * First pass on the file generation (f5241488587d02c0e66d840dc12df880e6d31f96)
9
+ * Initial implementation of sitemaps (fab80cada780949f31398a48235f6e52d24a1884)
10
+ * Implement first tests (92abd04698498762c84149e53f5fa7835fc64c56)
11
+ * Add some tests for SitemapFile (51e6196c7540f1a3df6871600d36abe18f4e9966)
@@ -0,0 +1,7 @@
1
+ # Contributing to usmu
2
+
3
+ 1. Fork it
4
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
5
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
6
+ 4. Push to the branch (`git push origin my-new-feature`)
7
+ 5. Create a new Pull Request
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in usmu.gemspec
4
+ gemspec name: 'usmu-sitemap'
5
+
6
+ gem 'usmu', path: '../usmu' if File.exist? '../usmu'
7
+ gem 'codeclimate-test-reporter', group: :test, require: nil
8
+ gem 'mutant', '~> 0.8', group: 'mutant'
9
+ gem 'mutant-rspec', '~> 0.8', group: 'mutant'
@@ -0,0 +1,13 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :rspec, cmd: 'rspec', spec_paths: ['spec'] do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/usmu/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
+ watch(%r{^spec/support}) { 'spec' }
8
+ watch('spec/spec_helper.rb') { 'spec' }
9
+
10
+ # Turnip features and steps
11
+ watch(%r{^spec/acceptance/(.+)\.feature$})
12
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
13
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Matthew Scharley and contributors
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,41 @@
1
+ # usmu-sitemap
2
+
3
+ [![Build Status](https://travis-ci.org/usmu/usmu-sitemap.svg?branch=master)](https://travis-ci.org/usmu/usmu-sitemap)
4
+ [![Dependency Status](https://gemnasium.com/usmu/usmu-sitemap.svg)](https://gemnasium.com/usmu/usmu-sitemap)
5
+ [![Code Climate](https://codeclimate.com/github/usmu/usmu-sitemap/badges/gpa.svg)](https://codeclimate.com/github/usmu/usmu-sitemap)
6
+
7
+ **Source:** [https://github.com/usmu/usmu-sitemap](https://github.com/usmu/usmu-sitemap)
8
+ **Author:** Matthew Scharley
9
+ **Contributors:** [See contributors on GitHub][gh-contrib]
10
+ **Bugs/Support:** [Github Issues][gh-issues]
11
+ **Copyright:** 2015
12
+ **License:** [MIT license][license]
13
+ **Status:** Active
14
+
15
+ ## Synopsis
16
+
17
+ Generates XML and HTML sitemaps for an Usmu website.
18
+
19
+ ## Installation
20
+
21
+ $ gem install usmu-sitemap
22
+
23
+ OR
24
+
25
+ $ echo 'gem "usmu-sitemap"' >> Gemfile
26
+ $ bundle install
27
+
28
+ Usmu will automatically detect any plugins available and automatically make them available.
29
+
30
+ ## Configuration
31
+
32
+ TODO: Write this documentation.
33
+
34
+ ## Usage
35
+
36
+ TODO: Write this documentation.
37
+
38
+ [gh-contrib]: https://github.com/usmu/usmu-sitemap/graphs/contributors
39
+ [gh-issues]: https://github.com/usmu/usmu-sitemap/issues
40
+ [license]: https://github.com/usmu/usmu-sitemap/blob/master/LICENSE.md
41
+ [usmu]: https://github.com/usmu/usmu
@@ -0,0 +1,88 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ require 'rspec/core/rake_task'
5
+ require 'usmu/sitemap/version'
6
+
7
+ def current_gems
8
+ Dir["pkg/usmu-sitemap-#{Usmu::Sitemap::VERSION}*.gem"]
9
+ end
10
+
11
+ RSpec::Core::RakeTask.new(:spec) do |t|
12
+ t.pattern = 'spec/**/*_spec.rb'
13
+ end
14
+
15
+ desc 'Run all test scripts'
16
+ task :test => [:clean, :spec, :mutant]
17
+
18
+ desc 'Run mutation tests'
19
+ task :mutant, [:target] => [:clean] do |t,args|
20
+ old = ENV.delete('CODECLIMATE_REPO_TOKEN')
21
+ sh('bundle', 'exec', 'mutant', '--include', 'lib', '--require', 'usmu/sitemap', '--use', 'rspec', args[:target] || 'Usmu::Sitemap*')
22
+ ENV['CODECLIMATE_REPO_TOKEN'] = old unless old.nil?
23
+ end
24
+
25
+ desc 'Run CI test suite'
26
+ task :ci => [:clean, :spec]
27
+
28
+ desc 'Clean up after tests'
29
+ task :clean do
30
+ [
31
+ 'test/coverage',
32
+ current_gems,
33
+ ].flatten.each do |f|
34
+ rm_r f if File.exist? f
35
+ end
36
+ end
37
+
38
+ namespace :gem do
39
+ desc 'Build gems'
40
+ task :build => [:clean] do
41
+ mkdir 'pkg' unless File.exist? 'pkg'
42
+ Dir['*.gemspec'].each do |gemspec|
43
+ sh "gem build #{gemspec}"
44
+ end
45
+ Dir['*.gem'].each do |gem|
46
+ mv gem, "pkg/#{gem}"
47
+ end
48
+ end
49
+
50
+ desc 'Install gem'
51
+ task :install => ['gem:build'] do
52
+ sh "gem install pkg/usmu-sitemap-#{Usmu::Sitemap::VERSION}.gem"
53
+ end
54
+
55
+ desc 'Deploy gems to rubygems'
56
+ task :deploy => ['gem:build'] do
57
+ current_gems.each do |gem|
58
+ sh "gem push #{gem}"
59
+ end
60
+ sh "git tag #{Usmu::Sitemap::VERSION}" if File.exist? '.git'
61
+ end
62
+ end
63
+
64
+ # (mostly) borrowed from: https://gist.github.com/mcansky/802396
65
+ desc 'generate changelog with nice clean output'
66
+ task :changelog, :since_c, :until_c do |t,args|
67
+ since_c = args[:since_c] || `git tag | egrep '^[0-9]+\\.[0-9]+\\.[0-9]+\\$' | sort -Vr | head -n 1`.chomp
68
+ until_c = args[:until_c]
69
+ cmd=`git log --pretty='format:%ci::::%an <%ae>::::%s::::%H' #{since_c}..#{until_c}`
70
+
71
+ entries = Hash.new
72
+ changelog_content = "\#\# #{Usmu::Sitemap::VERSION}\n\n"
73
+
74
+ cmd.lines.each do |entry|
75
+ date, author, subject, hash = entry.chomp.split('::::')
76
+ entries[author] = Array.new unless entries[author]
77
+ day = date.split(' ').first
78
+ entries[author] << "#{subject} (#{hash})" unless subject =~ /Merge/
79
+ end
80
+
81
+ # generate clean output
82
+ entries.keys.each do |author|
83
+ changelog_content += author + "\n\n"
84
+ entries[author].reverse.each { |entry| changelog_content += "* #{entry}\n" }
85
+ end
86
+
87
+ puts changelog_content
88
+ end
@@ -0,0 +1,28 @@
1
+ %w{
2
+ logging
3
+ usmu/sitemap/sitemap_configuration
4
+ usmu/sitemap/sitemap_file
5
+ usmu/sitemap/version
6
+ }.each {|f| require f }
7
+
8
+ module Usmu
9
+ class Sitemap
10
+ def initialize
11
+ @log = Logging.logger[self]
12
+ @log.debug("Initializing usmu-sitemap v#{VERSION}")
13
+ end
14
+
15
+ def commands(ui, c)
16
+ @ui = ui
17
+ end
18
+
19
+ def renderables_alter(renderables, generator)
20
+ configuration = SitemapConfiguration.new(@ui.configuration['plugin', 'sitemap', default: {}])
21
+ renderables << SitemapFile.new(generator, configuration['filename', default: 'sitemap.xml'], configuration)
22
+ end
23
+
24
+ private
25
+
26
+ attr_reader :log
27
+ end
28
+ end
@@ -0,0 +1,15 @@
1
+ require 'usmu/helpers/indexer'
2
+
3
+ module Usmu
4
+ class Sitemap
5
+ class SitemapConfiguration
6
+ include Usmu::Helpers::Indexer
7
+
8
+ indexer :@config
9
+
10
+ def initialize(config)
11
+ @config = config
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,54 @@
1
+ require 'ox'
2
+ require 'time'
3
+ require 'usmu/template/generated_file'
4
+
5
+ module Usmu
6
+ class Sitemap
7
+ class SitemapFile < Usmu::Template::GeneratedFile
8
+ def initialize(generator, name, metadata = {}, type = nil, content = nil)
9
+ super(nil, name, metadata, type, content)
10
+ @generator = generator
11
+ end
12
+
13
+ def render
14
+ doc = Ox::Document.new(version: '1.0', encoding: 'UTF-8')
15
+
16
+ urlset = Ox::Element.new('urlset')
17
+ urlset[:xmlns] = 'http://www.sitemaps.org/schemas/sitemap/0.9'
18
+
19
+ @generator.renderables.select(&method(:valid_entry?)).map(&method(:to_url)).each {|url| urlset << url }
20
+
21
+ doc << urlset
22
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>#{Ox.to_xml(doc, effort: :strict)}"
23
+ end
24
+
25
+ def valid_entry?(renderable)
26
+ meta = renderable['sitemap', 'include']
27
+ return meta unless meta.nil?
28
+
29
+ !renderable.class.equal? Template::StaticFile
30
+ end
31
+
32
+ def to_url(renderable)
33
+ url = Ox::Element.new('url')
34
+
35
+ url << (Ox::Element.new('loc') << self['base url', default: '/'] + renderable.output_filename)
36
+ url << (Ox::Element.new('lastmod') << Time.at(renderable.mtime).utc.iso8601)
37
+
38
+ change_frequency = renderable['sitemap', 'change frequency', default: self['change frequency']]
39
+ if change_frequency && !(%w{always hourly daily weekly monthly yearly never}.include? change_frequency)
40
+ raise "Invalid change frequency '#{change_frequency}' for #{renderable.output_filename}"
41
+ end
42
+ url << (Ox::Element.new('changefreq') << change_frequency) if change_frequency
43
+
44
+ priority = renderable['sitemap', 'priority', default: self['priority']]
45
+ if priority && !(priority.is_a?(Float) && priority >= 0 && priority <= 1)
46
+ raise "Invalid priority '#{priority}' for #{renderable.output_filename}"
47
+ end
48
+ url << (Ox::Element.new('priority') << priority.to_s) if priority
49
+
50
+ url
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,7 @@
1
+
2
+ module Usmu
3
+ class Sitemap
4
+ # The current version string for the gem
5
+ VERSION = '1.0.0'
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ require 'usmu/sitemap/sitemap_configuration'
2
+
3
+ RSpec.describe Usmu::Sitemap::SitemapConfiguration do
4
+ it 'can index the constructor parameter' do
5
+ conf = described_class.new(test: 'foo')
6
+ expect(conf[:test]).to eq('foo')
7
+ end
8
+ end
@@ -0,0 +1,131 @@
1
+ require 'usmu/sitemap/sitemap_file'
2
+ require 'usmu/sitemap/sitemap_configuration'
3
+ require 'usmu/template/static_file'
4
+
5
+ RSpec.describe Usmu::Sitemap::SitemapFile do
6
+ context '#valid_entry?' do
7
+ let(:file) { described_class.new(nil, 'sitemap.xml') }
8
+
9
+ it 'defaults to false if the entry is a StaticFile' do
10
+ entry = Usmu::Template::StaticFile.new(nil, nil, nil)
11
+ expect(file.valid_entry? entry).to eq(false)
12
+ end
13
+
14
+ it 'defaults to true if the entry is not a StaticFile' do
15
+ entry = Usmu::Template::GeneratedFile.new(nil, 'test.foo')
16
+ expect(file.valid_entry? entry).to eq(true)
17
+ end
18
+
19
+ it 'validates files that set the sitemap/include metadata value to that value' do
20
+ # noinspection RubyStringKeysInHashInspection
21
+ entry = Usmu::Template::GeneratedFile.new(nil, 'test.foo', {'sitemap' => {'include' => false}})
22
+ expect(file.valid_entry? entry).to eq(false)
23
+ end
24
+ end
25
+
26
+ context '#to_url' do
27
+ it 'returns a loc and lastmod element with no metadata' do
28
+ configuration = Usmu::Sitemap::SitemapConfiguration.new({})
29
+ file = described_class.new(nil, 'sitemap.xml', configuration)
30
+ entry = Usmu::Template::GeneratedFile.new(nil, 'test.foo')
31
+ expect(entry).to receive(:mtime).and_return(1450584842)
32
+
33
+ xml = Ox.parse(<<-XML)
34
+ <url>
35
+ <loc>/test.foo</loc>
36
+ <lastmod>2015-12-20T04:14:02Z</lastmod>
37
+ </url>
38
+ XML
39
+
40
+ expect(file.to_url entry).to eq(xml)
41
+ end
42
+
43
+ it 'prepends the base url to loc' do
44
+ configuration = Usmu::Sitemap::SitemapConfiguration.new({'base url' => 'http://google.com/'})
45
+ file = described_class.new(nil, 'sitemap.xml', configuration)
46
+ entry = Usmu::Template::GeneratedFile.new(nil, 'test.foo')
47
+ expect(entry).to receive(:mtime).and_return(1450584842)
48
+
49
+ xml = Ox.parse(<<-XML)
50
+ <url>
51
+ <loc>http://google.com/test.foo</loc>
52
+ <lastmod>2015-12-20T04:14:02Z</lastmod>
53
+ </url>
54
+ XML
55
+
56
+ expect(file.to_url entry).to eq(xml)
57
+ end
58
+
59
+ it 'returns a changefreq element if a "sitemap/change frequency" metadata element is provided' do
60
+ configuration = Usmu::Sitemap::SitemapConfiguration.new({})
61
+ file = described_class.new(nil, 'sitemap.xml', configuration)
62
+ # noinspection RubyStringKeysInHashInspection
63
+ entry = Usmu::Template::GeneratedFile.new(nil, 'test.foo', {'sitemap' => {'change frequency' => 'monthly'}})
64
+ expect(entry).to receive(:mtime).and_return(1450584842)
65
+
66
+ xml = Ox.parse(<<-XML)
67
+ <url>
68
+ <loc>/test.foo</loc>
69
+ <lastmod>2015-12-20T04:14:02Z</lastmod>
70
+ <changefreq>monthly</changefreq>
71
+ </url>
72
+ XML
73
+
74
+ expect(file.to_url entry).to eq(xml)
75
+ end
76
+
77
+ it 'returns a changefreq element if a "change frequency" configuration element is provided' do
78
+ # noinspection RubyStringKeysInHashInspection
79
+ configuration = Usmu::Sitemap::SitemapConfiguration.new({'change frequency' => 'monthly'})
80
+ file = described_class.new(nil, 'sitemap.xml', configuration)
81
+ entry = Usmu::Template::GeneratedFile.new(nil, 'test.foo')
82
+ expect(entry).to receive(:mtime).and_return(1450584842)
83
+
84
+ xml = Ox.parse(<<-XML)
85
+ <url>
86
+ <loc>/test.foo</loc>
87
+ <lastmod>2015-12-20T04:14:02Z</lastmod>
88
+ <changefreq>monthly</changefreq>
89
+ </url>
90
+ XML
91
+
92
+ expect(file.to_url entry).to eq(xml)
93
+ end
94
+
95
+ it 'returns a priority element if a "sitemap/priority" metadata element is provided' do
96
+ configuration = Usmu::Sitemap::SitemapConfiguration.new({})
97
+ file = described_class.new(nil, 'sitemap.xml', configuration)
98
+ # noinspection RubyStringKeysInHashInspection
99
+ entry = Usmu::Template::GeneratedFile.new(nil, 'test.foo', {'sitemap' => {'priority' => 0.7}})
100
+ expect(entry).to receive(:mtime).and_return(1450584842)
101
+
102
+ xml = Ox.parse(<<-XML)
103
+ <url>
104
+ <loc>/test.foo</loc>
105
+ <lastmod>2015-12-20T04:14:02Z</lastmod>
106
+ <priority>0.7</priority>
107
+ </url>
108
+ XML
109
+
110
+ expect(file.to_url entry).to eq(xml)
111
+ end
112
+
113
+ it 'returns a priority element if a "priority" configuration element is provided' do
114
+ # noinspection RubyStringKeysInHashInspection
115
+ configuration = Usmu::Sitemap::SitemapConfiguration.new({'priority' => 0.7})
116
+ file = described_class.new(nil, 'sitemap.xml', configuration)
117
+ entry = Usmu::Template::GeneratedFile.new(nil, 'test.foo')
118
+ expect(entry).to receive(:mtime).and_return(1450584842)
119
+
120
+ xml = Ox.parse(<<-XML)
121
+ <url>
122
+ <loc>/test.foo</loc>
123
+ <lastmod>2015-12-20T04:14:02Z</lastmod>
124
+ <priority>0.7</priority>
125
+ </url>
126
+ XML
127
+
128
+ expect(file.to_url entry).to eq(xml)
129
+ end
130
+ end
131
+ end
@@ -0,0 +1,109 @@
1
+ begin
2
+ require 'codeclimate-test-reporter'
3
+ CodeClimate::TestReporter.start
4
+ rescue LoadError
5
+ end
6
+
7
+ require 'logging'
8
+ require 'rspec/logging_helper'
9
+ require 'timeout'
10
+
11
+ Logging.init :debug, :info, :success, :warn, :error, :fatal
12
+
13
+ # This file was generated by the `rspec --init` command. Conventionally, all
14
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
15
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
16
+ # file to always be loaded, without a need to explicitly require it in any files.
17
+ #
18
+ # Given that it is always loaded, you are encouraged to keep this file as
19
+ # light-weight as possible. Requiring heavyweight dependencies from this file
20
+ # will add to the boot time of your test suite on EVERY test run, even for an
21
+ # individual file that may not need all of that loaded. Instead, consider making
22
+ # a separate helper file that requires the additional dependencies and performs
23
+ # the additional setup, and require it from the spec files that actually need it.
24
+ #
25
+ # The `.rspec` file also contains a few flags that are not defaults but that
26
+ # users commonly want.
27
+ #
28
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
29
+ RSpec.configure do |config|
30
+ # rspec-expectations config goes here. You can use an alternate
31
+ # assertion/expectation library such as wrong or the stdlib/minitest
32
+ # assertions if you prefer.
33
+ config.expect_with :rspec do |expectations|
34
+ # This option will default to `true` in RSpec 4. It makes the `description`
35
+ # and `failure_message` of custom matchers include text for helper methods
36
+ # defined using `chain`, e.g.:
37
+ # be_bigger_than(2).and_smaller_than(4).description
38
+ # # => "be bigger than 2 and smaller than 4"
39
+ # ...rather than:
40
+ # # => "be bigger than 2"
41
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
42
+ end
43
+
44
+ # rspec-mocks config goes here. You can use an alternate test double
45
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
46
+ config.mock_with :rspec do |mocks|
47
+ # Prevents you from mocking or stubbing a method that does not exist on
48
+ # a real object. This is generally recommended, and will default to
49
+ # `true` in RSpec 4.
50
+ mocks.verify_partial_doubles = true
51
+ end
52
+
53
+ # These two settings work together to allow you to limit a spec run
54
+ # to individual examples or groups you care about by tagging them with
55
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
56
+ # get run.
57
+ config.filter_run :focus
58
+ config.run_all_when_everything_filtered = true
59
+
60
+ # Limits the available syntax to the non-monkey patched syntax that is recommended.
61
+ # For more details, see:
62
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
63
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
64
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
65
+ config.disable_monkey_patching!
66
+
67
+ # This setting enables warnings. It's recommended, but in some cases may
68
+ # be too noisy due to issues in dependencies.
69
+ config.warnings = false
70
+
71
+ # Many RSpec users commonly either run the entire suite or an individual
72
+ # file, and it's useful to allow more verbose output when running an
73
+ # individual spec file.
74
+ if config.files_to_run.one?
75
+ # Use the documentation formatter for detailed output,
76
+ # unless a formatter has already been configured
77
+ # (e.g. via a command-line flag).
78
+ config.default_formatter = 'doc'
79
+ end
80
+
81
+ # Print the 10 slowest examples and example groups at the
82
+ # end of the spec run, to help surface which specs are running
83
+ # particularly slow.
84
+ config.profile_examples = 10
85
+
86
+ # Run specs in random order to surface order dependencies. If you find an
87
+ # order dependency and want to debug it, you can fix the order by providing
88
+ # the seed, which is printed after each run.
89
+ # --seed 1234
90
+ config.order = :random
91
+
92
+ # Seed global randomization in this process using the `--seed` CLI option.
93
+ # Setting this allows you to use `--seed` to deterministically reproduce
94
+ # test failures related to randomization by passing the same `--seed` value
95
+ # as the one that triggered the failure.
96
+ Kernel.srand config.seed
97
+
98
+ # Set a timeout on individual tests
99
+ config.around(:each) do |example|
100
+ Timeout.timeout(5, &example)
101
+ end
102
+
103
+ # Configure RSpec to capture log messages for tests.
104
+ include RSpec::LoggingHelper
105
+ config.capture_log_messages
106
+ end
107
+
108
+ # Allow loading of mocks
109
+ $LOAD_PATH.unshift(File.realpath('./spec/mock')) if File.exist? 'spec/mock'
@@ -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
+ require 'usmu/sitemap/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'usmu-sitemap'
8
+ spec.version = Usmu::Sitemap::VERSION
9
+ spec.authors = ['Matthew Scharley']
10
+ spec.email = ['matt.scharley@gmail.com']
11
+ spec.summary = %q{XML sitemap generator plugin for Usmu.}
12
+ spec.homepage = 'https://github.com/usmu/usmu-sitemap'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^spec/})
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.required_ruby_version = Gem::Requirement.new('>= 1.9.3')
21
+
22
+ spec.add_dependency 'usmu', '~> 1.2'
23
+ spec.add_dependency 'logging', '~> 2.0'
24
+ spec.add_dependency 'ox', '~> 2.2'
25
+
26
+ spec.add_development_dependency 'bundler', '~> 1.6'
27
+ spec.add_development_dependency 'rake', '~> 10.0'
28
+ spec.add_development_dependency 'rspec', '~> 3.1'
29
+ spec.add_development_dependency 'yard', '~> 0.8'
30
+ spec.add_development_dependency 'guard', '~> 2.8'
31
+ spec.add_development_dependency 'guard-rspec', '~> 4.3'
32
+ spec.add_development_dependency 'libnotify', '~> 0.9'
33
+ end
metadata ADDED
@@ -0,0 +1,207 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: usmu-sitemap
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Matthew Scharley
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-12-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: usmu
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: logging
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: ox
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.2'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.6'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.6'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.1'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.1'
97
+ - !ruby/object:Gem::Dependency
98
+ name: yard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.8'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.8'
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.8'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.8'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard-rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '4.3'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '4.3'
139
+ - !ruby/object:Gem::Dependency
140
+ name: libnotify
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.9'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.9'
153
+ description:
154
+ email:
155
+ - matt.scharley@gmail.com
156
+ executables: []
157
+ extensions: []
158
+ extra_rdoc_files: []
159
+ files:
160
+ - ".gitignore"
161
+ - ".rspec"
162
+ - ".travis.yml"
163
+ - ".yardopts"
164
+ - CHANGELOG.md
165
+ - CONTRIBUTING.md
166
+ - Gemfile
167
+ - Guardfile
168
+ - LICENSE.md
169
+ - README.md
170
+ - Rakefile
171
+ - lib/usmu/sitemap.rb
172
+ - lib/usmu/sitemap/sitemap_configuration.rb
173
+ - lib/usmu/sitemap/sitemap_file.rb
174
+ - lib/usmu/sitemap/version.rb
175
+ - spec/sitemap/sitemap_configuration_spec.rb
176
+ - spec/sitemap/sitemap_file_spec.rb
177
+ - spec/spec_helper.rb
178
+ - usmu-sitemap.gemspec
179
+ homepage: https://github.com/usmu/usmu-sitemap
180
+ licenses:
181
+ - MIT
182
+ metadata: {}
183
+ post_install_message:
184
+ rdoc_options: []
185
+ require_paths:
186
+ - lib
187
+ required_ruby_version: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ version: 1.9.3
192
+ required_rubygems_version: !ruby/object:Gem::Requirement
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ version: '0'
197
+ requirements: []
198
+ rubyforge_project:
199
+ rubygems_version: 2.4.8
200
+ signing_key:
201
+ specification_version: 4
202
+ summary: XML sitemap generator plugin for Usmu.
203
+ test_files:
204
+ - spec/sitemap/sitemap_configuration_spec.rb
205
+ - spec/sitemap/sitemap_file_spec.rb
206
+ - spec/spec_helper.rb
207
+ has_rdoc: