middleman-sitemap 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 794ac84510f4da06044e9db6407660b1bbeea74e
4
+ data.tar.gz: 99cbee50bebadacedad2ef096639b3f17e56c863
5
+ SHA512:
6
+ metadata.gz: 83589b2674c20bafeb03c3d1b9c399ab1cbedca92b0dfc0455813803e1a94d2f3c701a8bcbcb9b8313d224ffca6d3b4db6188c2a3efc01ab01afb9f684dee6af
7
+ data.tar.gz: 20a02c5c1b6becb936757b0c2327d37cd0ab8fbd1fc464b3fdcc1fa7f57497bfb7566190140e1708b53c798fee95c0698ba5941c0eb0e7cb868d949c59ead615
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ .DS_Store
2
+
3
+ # Ignore bundler lock file
4
+ /Gemfile.lock
5
+
6
+ # Ignore pkg folder
7
+ /pkg
8
+
9
+ # Ignore tmp
10
+ /tmp
11
+
12
+ # Ignore vendor
13
+ /vendor
14
+ .bundle
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.1
6
+ - jruby-19mode
7
+
8
+ script: "bundle exec rake test"
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ # If you have OpenSSL installed, we recommend updating
2
+ # the following line to use "https"
3
+ source 'http://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in middleman-sitemap.gemspec
6
+ gemspec
7
+
8
+ group :development do
9
+ gem 'rake'
10
+ gem 'rdoc'
11
+ gem 'yard'
12
+ end
13
+
14
+ group :test do
15
+ gem 'cucumber'
16
+ gem 'fivemat'
17
+ gem 'aruba'
18
+ gem 'rspec'
19
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Larry Staton Jr.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # Middleman-Sitemap
2
+
3
+ `middleman-sitemap` is an extension for the [Middleman] static site generator that adds sitemap functionality. By default, the sitemap is GZIP'd.
4
+
5
+ ## Installation
6
+
7
+ If you're just getting started, install the `middleman` gem and generate a new project:
8
+
9
+ ```
10
+ gem install middleman
11
+ middleman init MY_PROJECT
12
+ ```
13
+
14
+ If you already have a Middleman project: Add `gem "middleman-sitemap"` to your `Gemfile` and run `bundle install`
15
+
16
+ ## Configuration
17
+
18
+ ```
19
+ activate :sitemap
20
+ ```
21
+
22
+ ## Options
23
+
24
+ ### GZIP
25
+
26
+ GZIP is on by default, so the extension will produce a sitemap.xml.gz file in addition to the sitemap.xml file.
27
+
28
+ If you don't want to create a GZIP file, pass `false` during activation.
29
+
30
+ ```
31
+ activate :sitemap, :gzip => false
32
+ ```
33
+
34
+ ### Hostname
35
+
36
+ The default hostname is set to "http://www.example.com". You probably want to change this to your hostname.
37
+
38
+ ```
39
+ activate :sitemap, :hostname => "http://www.apple.com"
40
+ ```
41
+
42
+
43
+ ## Build & Dependency Status
44
+
45
+ [![Build Status](https://travis-ci.org/statonjr/middleman-sitemap.png)][travis]
46
+
47
+ ## Community
48
+
49
+ The official community forum is available at: http://forum.middlemanapp.com
50
+
51
+ ## Bug Reports
52
+
53
+ Github Issues are used for managing bug reports and feature requests. If you run into issues, please search the issues and submit new problems: https://github.com/middleman/middleman-blog/issues
54
+
55
+ The best way to get quick responses to your issues and swift fixes to your bugs is to submit detailed bug reports, include test cases and respond to developer questions in a timely manner. Even better, if you know Ruby, you can submit [Pull Requests](https://help.github.com/articles/using-pull-requests) containing Cucumber Features which describe how your feature should work or exploit the bug you are submitting.
56
+
57
+ ## How to Run Cucumber Tests
58
+
59
+ 1. Checkout Repository: `git clone https://github.com/statonjr/middleman-sitemap.git`
60
+ 2. Install Bundler: `gem install bundler`
61
+ 3. Run `bundle install` inside the project root to install the gem dependencies.
62
+ 4. Run test cases: `bundle exec rake test`
63
+
64
+ ## Donate
65
+
66
+ [Click here to lend your support to Middleman](https://spacebox.io/s/4dXbHBorC3)
67
+
68
+ ## License
69
+
70
+ Copyright (c) 2014 Larry Staton Jr. MIT Licensed, see [LICENSE] for details.
71
+
72
+ [middleman]: http://middlemanapp.com
73
+ [travis]: http://travis-ci.org/statonjr/middleman-sitemap
74
+ [LICENSE]: https://github.com/statonjr/middleman-sitemap/blob/master/LICENSE
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'cucumber/rake/task'
5
+
6
+ Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
7
+ t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}"
8
+ end
9
+
10
+ require 'rake/clean'
11
+
12
+ task :test => ['cucumber']
13
+
14
+ task :default => :test
@@ -0,0 +1,28 @@
1
+ Feature: GZIP sitemap build
2
+
3
+ Scenario: Sitemap should be gzipped by default
4
+ Given a successfully built app at "gzip-app"
5
+ Then the following files should exist:
6
+ | build/sitemap.xml.gz |
7
+ | build/sitemap.xml |
8
+
9
+ Scenario: Sitemap should not be gzipped when option set to false
10
+ Given a fixture app "gzip-app"
11
+ And a file named "config.rb" with:
12
+ """
13
+ activate :sitemap, :gzip => false
14
+ """
15
+ And a successfully built app at "gzip-app"
16
+ When I cd to "build"
17
+ Then the following files should not exist:
18
+ | build/sitemap.xml.gz |
19
+
20
+ Scenario: Sitemap should not be gzipped when option set to false
21
+ Given a fixture app "gzip-app"
22
+ And a file named "config.rb" with:
23
+ """
24
+ activate :sitemap, :hostname => "http://www.apple.com"
25
+ """
26
+ And a successfully built app at "gzip-app"
27
+ When I cd to "build"
28
+ Then the file "sitemap.xml" should contain "http://www.apple.com"
@@ -0,0 +1,4 @@
1
+ PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
2
+ require 'middleman-core'
3
+ require 'middleman-core/step_definitions'
4
+ require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-sitemap')
@@ -0,0 +1 @@
1
+ activate :sitemap
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ ---
2
+ priority: 0.7
3
+ changefreq: daily
4
+ ---
5
+ something
File without changes
@@ -0,0 +1,44 @@
1
+ # Require core library
2
+ require 'middleman-core'
3
+
4
+ # Extension namespace
5
+ class Sitemap < ::Middleman::Extension
6
+ option :gzip, true, 'Whether or not to GZIP the resulting file'
7
+ option :hostname, "http://www.example.com", "The hostname for your website"
8
+
9
+ def initialize(app, options_hash={}, &block)
10
+ # Call super to build options from the options_hash
11
+ super
12
+
13
+ # Require libraries only when activated
14
+ # require 'necessary/library'
15
+
16
+ # set up your extension
17
+ # puts options.my_option
18
+ end
19
+
20
+ def after_build
21
+ require 'erb'
22
+ @pages = app.sitemap.resources.find_all{ |p| p.source_file.match(/\.html/) }
23
+ @hostname = options.hostname
24
+ template = Tilt::ERBTemplate.new(File.expand_path(File.join("#{File.dirname(__FILE__)}", "../templates/sitemap.xml.erb")))
25
+ sitemap = template.render(self)
26
+ outfile = File.join(app.build_dir, "sitemap.xml")
27
+ File.open(outfile, 'w') {|f| f.write(sitemap) }
28
+ if options.gzip
29
+ gzip_file(File.read(outfile))
30
+ end
31
+ end
32
+
33
+ def gzip_file(sitemap)
34
+ require 'zlib'
35
+ File.open(File.join(@app.build_dir, "sitemap.xml.gz"), 'wb') do |f|
36
+ gz = Zlib::GzipWriter.new(f, Zlib::BEST_COMPRESSION)
37
+ gz.write sitemap
38
+ gz.close
39
+ end
40
+ end
41
+
42
+ end
43
+
44
+ ::Middleman::Extensions.register(:sitemap, Sitemap)
@@ -0,0 +1 @@
1
+ require 'middleman-sitemap'
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "middleman-sitemap"
6
+ s.version = "0.0.1"
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ["Larry Staton Jr."]
9
+ s.email = ["larry@larrystaton.com"]
10
+ s.homepage = "http://bitbucket.org/statonjr/middleman-sitemap"
11
+ s.summary = %q{Builds a sitemap.xml for your site}
12
+ s.description = %q{Builds a sitemap.xml for your site}
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib"]
18
+
19
+ # The version of middleman-core your extension depends on
20
+ s.add_runtime_dependency("middleman-core", [">= 3.2.2"])
21
+
22
+ end
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3
+ <% @pages.each do |p| %>
4
+ <url>
5
+ <loc><%= @hostname %><%= p.url.gsub(/\/$/, '') %></loc>
6
+ <lastmod><%= Date.today.to_time.iso8601 %></lastmod>
7
+ <changefreq><%= p.data.changefreq || 'weekly' %></changefreq>
8
+ <priority><%= p.data.priority || '0.5' %></priority>
9
+ </url>
10
+ <% end %>
11
+ </urlset>
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: middleman-sitemap
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Larry Staton Jr.
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: middleman-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.2
27
+ description: Builds a sitemap.xml for your site
28
+ email:
29
+ - larry@larrystaton.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".gitignore"
35
+ - ".travis.yml"
36
+ - Gemfile
37
+ - LICENSE
38
+ - README.md
39
+ - Rakefile
40
+ - features/gzip.feature
41
+ - features/support/env.rb
42
+ - fixtures/gzip-app/config.rb
43
+ - fixtures/gzip-app/source/index.html
44
+ - fixtures/gzip-app/source/javascripts/test.js
45
+ - fixtures/gzip-app/source/something.html
46
+ - fixtures/gzip-app/source/stylesheets/test.css
47
+ - lib/middleman-sitemap.rb
48
+ - lib/middleman_extension.rb
49
+ - middleman-sitemap.gemspec
50
+ - templates/sitemap.xml.erb
51
+ homepage: http://bitbucket.org/statonjr/middleman-sitemap
52
+ licenses: []
53
+ metadata: {}
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubyforge_project:
70
+ rubygems_version: 2.2.2
71
+ signing_key:
72
+ specification_version: 4
73
+ summary: Builds a sitemap.xml for your site
74
+ test_files:
75
+ - features/gzip.feature
76
+ - features/support/env.rb
77
+ has_rdoc: