octopress-docs 0.0.1
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/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/lib/octopress-docs.rb +78 -0
- data/lib/octopress-docs/command.rb +74 -0
- data/lib/octopress-docs/doc.rb +82 -0
- data/lib/octopress-docs/tag.rb +18 -0
- data/lib/octopress-docs/version.rb +5 -0
- metadata +163 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ff973bd8ad863c0093dc0550a1dfa0520ce4d2e0
|
4
|
+
data.tar.gz: 5e60dade12af116e5272c9780d0623b3f6308522
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 53687964a722e0ff95c99e7bcfbfa5515ecdc90a43adbf4aed6cfabdc7f3b70c9cca33d4a1b18fcef16fd5bf0de24bb45f5a14705864f60496231ad6f8dcc88c
|
7
|
+
data.tar.gz: 4f7a24b948574c24282a40a04c3a575bddd8f92ee71bff5b384c5197289e1cc48fe3afb908ab423d15b3ae01966ba88578e1c68f2816a164b2a9b0b168a6c488
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Brandon Mathis
|
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,29 @@
|
|
1
|
+
# Octopress::Docs
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'octopress-docs'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install octopress-docs
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require "octopress"
|
2
|
+
require "jekyll"
|
3
|
+
require "octopress-escape-code"
|
4
|
+
|
5
|
+
require "octopress-docs/version"
|
6
|
+
require "octopress-docs/command"
|
7
|
+
require "octopress-docs/doc"
|
8
|
+
require "octopress-docs/tag"
|
9
|
+
|
10
|
+
module Octopress
|
11
|
+
module Docs
|
12
|
+
attr_reader :pages
|
13
|
+
@pages = []
|
14
|
+
|
15
|
+
autoload :Doc, 'octopress-docs/doc'
|
16
|
+
|
17
|
+
def self.gem_dir(dir='')
|
18
|
+
File.expand_path(File.join(File.dirname(__FILE__), '../', dir))
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.add_plugin_docs(plugin, dir, files)
|
22
|
+
pages = []
|
23
|
+
options = plugin_options(plugin).merge({
|
24
|
+
dir: File.join(plugin.assets_path, dir),
|
25
|
+
})
|
26
|
+
|
27
|
+
files.each do |doc|
|
28
|
+
unless doc =~ /^_/
|
29
|
+
opts = options.merge({file: doc})
|
30
|
+
pages << add_doc_page(opts)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
pages
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.plugin_options(plugin)
|
38
|
+
{
|
39
|
+
plugin_name: plugin.name,
|
40
|
+
plugin_slug: plugin.slug,
|
41
|
+
plugin_type: plugin.type,
|
42
|
+
base_url: plugin.docs_base_url,
|
43
|
+
dir: plugin.path
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.add(options)
|
48
|
+
root_docs = []
|
49
|
+
options[:docs] ||= %w{readme changelog}
|
50
|
+
options[:docs].each do |doc|
|
51
|
+
root_docs << add_root_doc(doc, options)
|
52
|
+
end
|
53
|
+
root_docs
|
54
|
+
end
|
55
|
+
|
56
|
+
# Add a single root doc
|
57
|
+
def self.add_root_doc(filename, options)
|
58
|
+
if file = select_first(options[:dir], filename)
|
59
|
+
add_doc_page(options.merge({file: file}))
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.add_root_plugin_doc(plugin, filename, options={})
|
64
|
+
options = plugin_options(plugin).merge(options)
|
65
|
+
add_root_doc(filename, options)
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.add_doc_page(options)
|
69
|
+
page = Docs::Doc.new(options)
|
70
|
+
@pages << page
|
71
|
+
page
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.select_first(dir, match)
|
75
|
+
Dir.new(dir).select { |f| f =~/#{match}/i}.first
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module Octopress
|
2
|
+
module Docs
|
3
|
+
class Commands < Octopress::Command
|
4
|
+
def self.init_with_program(p)
|
5
|
+
p.command(:docs) do |c|
|
6
|
+
c.syntax 'octopress docs'
|
7
|
+
c.description "Launch local server with docs for Octopress v#{Octopress::VERSION} and Octopress Ink plugins."
|
8
|
+
|
9
|
+
c.option 'port', '-P', '--port [PORT]', 'Port to listen on'
|
10
|
+
c.option 'host', '-H', '--host [HOST]', 'Host to bind to'
|
11
|
+
if ENV['OCTODEV']
|
12
|
+
c.option 'watch', '--watch', 'Watch docs site for changes and rebuild. (For docs development)'
|
13
|
+
end
|
14
|
+
c.option 'jekyll', '--jekyll', "Launch local server with docs for Jekyll v#{Jekyll::VERSION}"
|
15
|
+
|
16
|
+
c.action do |args, options|
|
17
|
+
serve_docs(options)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.serve_docs(options)
|
23
|
+
if options['jekyll']
|
24
|
+
options = init_jekyll_docs(options)
|
25
|
+
else
|
26
|
+
options = init_octopress_docs(options)
|
27
|
+
end
|
28
|
+
options["serving"] = true
|
29
|
+
options = Jekyll.configuration Jekyll::Utils.symbolize_hash_keys(options)
|
30
|
+
Jekyll::Commands::Build.process(options)
|
31
|
+
Jekyll::Commands::Serve.process(options)
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.init_octopress_docs(options)
|
35
|
+
Octopress.config({
|
36
|
+
'config-file' => File.join(site_dir, '_octopress.yml'),
|
37
|
+
'override' => { 'docs_mode' => true }
|
38
|
+
})
|
39
|
+
require_gems
|
40
|
+
options['source'] = site_dir
|
41
|
+
options['destination'] = File.join(site_dir, '_site')
|
42
|
+
options
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.init_jekyll_docs(options)
|
46
|
+
options.delete('jekyll')
|
47
|
+
|
48
|
+
# Find local Jekyll gem path
|
49
|
+
#
|
50
|
+
spec = Gem::Specification.find_by_name("jekyll")
|
51
|
+
gem_path = spec.gem_dir
|
52
|
+
|
53
|
+
options['source'] = "#{gem_path}/site",
|
54
|
+
options['destination'] = "#{gem_path}/site/_site"
|
55
|
+
options
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.site_dir
|
59
|
+
Docs.gem_dir('docs')
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.require_gems
|
63
|
+
file = File.join(Dir.pwd, '_config.yml')
|
64
|
+
if File.exist? file
|
65
|
+
config = YAML.safe_load(File.open(file))
|
66
|
+
gems = config['gems']
|
67
|
+
if gems && gems.is_a?(Array)
|
68
|
+
gems.each {|g| require g }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module Octopress
|
2
|
+
module Docs
|
3
|
+
class Doc
|
4
|
+
attr_reader :filename
|
5
|
+
|
6
|
+
def initialize(options={})
|
7
|
+
|
8
|
+
@file = options[:file]
|
9
|
+
@dir = options[:dir] ||= '.'
|
10
|
+
@file_dir = File.dirname(@file)
|
11
|
+
@plugin_name = options[:plugin_name]
|
12
|
+
@plugin_slug ||= options[:plugin_slug] || @plugin_name
|
13
|
+
@plugin_type = options[:plugin_type] || 'plugin'
|
14
|
+
@base_url = options[:base_url]
|
15
|
+
end
|
16
|
+
|
17
|
+
# Add doc page to Jekyll pages
|
18
|
+
#
|
19
|
+
def add
|
20
|
+
if Octopress.config['docs_mode']
|
21
|
+
Octopress.site.pages << page
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def disabled?
|
26
|
+
false
|
27
|
+
end
|
28
|
+
|
29
|
+
def file
|
30
|
+
File.basename(@file)
|
31
|
+
end
|
32
|
+
|
33
|
+
def info
|
34
|
+
" - #{permalink.ljust(35)}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def page
|
38
|
+
return @page if @page
|
39
|
+
@page = Octopress::Ink::Page.new(Octopress.site, @dir, page_dir, file, {'path'=>base_url})
|
40
|
+
@page.data['layout'] = 'docs'
|
41
|
+
@page.data['plugin'] = {
|
42
|
+
'name' => @plugin_name,
|
43
|
+
'slug' => plugin_slug,
|
44
|
+
'docs_base_url' => base_url
|
45
|
+
}
|
46
|
+
@page.data['dir'] = doc_dir
|
47
|
+
@page
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def permalink
|
53
|
+
File.basename(file, ".*")
|
54
|
+
end
|
55
|
+
|
56
|
+
def read
|
57
|
+
File.open(File.join(@dir, @file)).read
|
58
|
+
end
|
59
|
+
|
60
|
+
def plugin_slug
|
61
|
+
Filters.sluggify @plugin_type == 'theme' ? 'theme' : @plugin_slug
|
62
|
+
end
|
63
|
+
|
64
|
+
def base_url
|
65
|
+
@base_url || if @plugin_type == 'theme'
|
66
|
+
File.join('docs', 'theme')
|
67
|
+
else
|
68
|
+
File.join('docs', 'plugins', @plugin_slug)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def page_dir
|
73
|
+
@file_dir == '.' ? '' : @file_dir
|
74
|
+
end
|
75
|
+
|
76
|
+
def doc_dir
|
77
|
+
File.join(@dir, page_dir, File.dirname(@file))
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# For plugin authors who need to generate urls pointing to ther doc pages.
|
2
|
+
|
3
|
+
module Octopress
|
4
|
+
module Docs
|
5
|
+
class DocUrlTag < Liquid::Tag
|
6
|
+
def initialize(tag_name, markup, tokens)
|
7
|
+
super
|
8
|
+
@url = markup.strip
|
9
|
+
end
|
10
|
+
|
11
|
+
def render(context)
|
12
|
+
'/' + File.join(context['page']['plugin']['docs_base_url'], @url)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
Liquid::Template.register_tag('doc_url', Octopress::Docs::DocUrlTag)
|
metadata
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: octopress-docs
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brandon Mathis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: octopress
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.0.0.rc
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.0.0.rc
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: octopress-ink
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.0.0.rc
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.0.0.rc
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: octopress-solarized
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: octopress-escape-code
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.3'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.3'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry-debugger
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: View docs for Octopress and its plugins
|
126
|
+
email:
|
127
|
+
- brandon@imathis.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- LICENSE.txt
|
133
|
+
- README.md
|
134
|
+
- lib/octopress-docs.rb
|
135
|
+
- lib/octopress-docs/command.rb
|
136
|
+
- lib/octopress-docs/doc.rb
|
137
|
+
- lib/octopress-docs/tag.rb
|
138
|
+
- lib/octopress-docs/version.rb
|
139
|
+
homepage: https://github.com/octopress/docs
|
140
|
+
licenses:
|
141
|
+
- MIT
|
142
|
+
metadata: {}
|
143
|
+
post_install_message:
|
144
|
+
rdoc_options: []
|
145
|
+
require_paths:
|
146
|
+
- lib
|
147
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
requirements: []
|
158
|
+
rubyforge_project:
|
159
|
+
rubygems_version: 2.4.1
|
160
|
+
signing_key:
|
161
|
+
specification_version: 4
|
162
|
+
summary: View docs for Octopress and its plugins
|
163
|
+
test_files: []
|