yard-sitemap 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +25 -0
- data/lib/yard-sitemap.rb +51 -0
- data/yard-sitemap.gemspec +14 -0
- metadata +51 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b92af64ab9f128f2f75abd2bf85e9a763b4f0fed
|
4
|
+
data.tar.gz: 294ce6af6423e0cfc84347602398e39711209df5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9747c64f8ae5d7f93061313e02579115a64184024ac0d72325204029edfad3e50fdce43cd11aba68ca32494a408a90e95055a6a62aa5c4d6eb1152e5c42b3f02
|
7
|
+
data.tar.gz: 79d9725c4bacf9a3db6ae5aa7161fd2d936995d4f5937b054a998d94dc231eb194c13fa021a2bbe1bf5145ddd0f2edeb7a7d5b45efedca8a3f7f27461fe28b99
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Loren Segal
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# YARD Sitemap
|
2
|
+
|
3
|
+
A [YARD][1] plugin to build a sitemap.xml for generated HTML documentation.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'yard-sitemap'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
gem install yard-sitemap
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Simply activate the plugin when running YARD:
|
22
|
+
|
23
|
+
yard doc --plugin sitemap
|
24
|
+
|
25
|
+
[1]: http://yardoc.org
|
data/lib/yard-sitemap.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'time'
|
2
|
+
|
3
|
+
module YARD
|
4
|
+
module SitemapGenerator
|
5
|
+
module_function
|
6
|
+
|
7
|
+
# Generates a sitemap at +basedir+
|
8
|
+
# @param basedir [String] the location where the sitemap should be generated
|
9
|
+
def generate_sitemap(basedir)
|
10
|
+
sitemap_file = File.join(basedir, 'sitemap.xml')
|
11
|
+
File.open(sitemap_file, 'w') do |file|
|
12
|
+
file.write(sitemap_contents(basedir))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# @param basedir [String] the location where the sitemap should be generated
|
17
|
+
# @return [String] the sitemap.xml contents
|
18
|
+
def sitemap_contents(basedir)
|
19
|
+
data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
20
|
+
data << "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n"
|
21
|
+
data << " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n"
|
22
|
+
|
23
|
+
Dir.glob(basedir + '/**/*.html').each do |file|
|
24
|
+
next unless File.file?(file)
|
25
|
+
mtime = File.mtime(file)
|
26
|
+
fname = file.sub(/^#{Regexp.quote basedir}\//, '')
|
27
|
+
data << " <url>\n"
|
28
|
+
data << " <loc>#{fname}</loc>\n"
|
29
|
+
data << " <lastmod>#{mtime.iso8601}</lastmod>\n"
|
30
|
+
data << " </url>\n"
|
31
|
+
end
|
32
|
+
|
33
|
+
data << "</urlset>\n"
|
34
|
+
data
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
module CLI
|
39
|
+
class Yardoc
|
40
|
+
include SitemapGenerator
|
41
|
+
|
42
|
+
def run_generate_with_sitemap(*args)
|
43
|
+
run_generate_without_sitemap(*args)
|
44
|
+
generate_sitemap(options.serializer.basepath)
|
45
|
+
end
|
46
|
+
|
47
|
+
alias run_generate_without_sitemap run_generate
|
48
|
+
alias run_generate run_generate_with_sitemap
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = "yard-sitemap"
|
3
|
+
spec.version = "1.0.0"
|
4
|
+
spec.authors = ["Loren Segal"]
|
5
|
+
spec.email = ["lsegal@soen.ca"]
|
6
|
+
spec.summary = "YARD plugin to build a sitemap.xml for generated HTML documentation."
|
7
|
+
spec.homepage = "http://github.com/lsegal/yard-sitemap"
|
8
|
+
spec.license = "MIT"
|
9
|
+
|
10
|
+
spec.files = `git ls-files`.split($/)
|
11
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
12
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
13
|
+
spec.require_paths = ["lib"]
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yard-sitemap
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Loren Segal
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-14 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
- lsegal@soen.ca
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- .gitignore
|
21
|
+
- Gemfile
|
22
|
+
- LICENSE.txt
|
23
|
+
- README.md
|
24
|
+
- lib/yard-sitemap.rb
|
25
|
+
- yard-sitemap.gemspec
|
26
|
+
homepage: http://github.com/lsegal/yard-sitemap
|
27
|
+
licenses:
|
28
|
+
- MIT
|
29
|
+
metadata: {}
|
30
|
+
post_install_message:
|
31
|
+
rdoc_options: []
|
32
|
+
require_paths:
|
33
|
+
- lib
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
requirements: []
|
45
|
+
rubyforge_project:
|
46
|
+
rubygems_version: 2.0.3
|
47
|
+
signing_key:
|
48
|
+
specification_version: 4
|
49
|
+
summary: YARD plugin to build a sitemap.xml for generated HTML documentation.
|
50
|
+
test_files: []
|
51
|
+
has_rdoc:
|