octopress-docs 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/_layouts/default.html +1 -0
- data/lib/octopress-docs/command.rb +7 -4
- data/lib/octopress-docs/doc.rb +3 -3
- data/lib/octopress-docs/hooks.rb +8 -2
- data/lib/octopress-docs/page.rb +1 -1
- data/lib/octopress-docs/version.rb +1 -1
- data/lib/octopress-docs.rb +34 -19
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9016278546132adf8327ea7465ed5a6d337b3679
|
4
|
+
data.tar.gz: 80a53837d9f7cc202ca720b9c7d24547f7582ffe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f8aec83d98d4ccf8099dd60e39a0e50b44615b057410614eca9364afc8a940d6d6a0580e59293082d891b47a1686eae53af46efca6a55fc754347bd82608564
|
7
|
+
data.tar.gz: c90728916468f1d7ecdb79fd01b5ee11bf480688f1dc33ecee41f8c4d28148d53bd8f4c6c94e40da565d37324a91632fe8aec76431ca70c2dc8291ad4261fa04
|
data/docs/_layouts/default.html
CHANGED
@@ -20,6 +20,7 @@ module Octopress
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.serve_docs(options)
|
23
|
+
Octopress::Docs.docs_mode = true
|
23
24
|
if options['jekyll']
|
24
25
|
options = init_jekyll_docs(options)
|
25
26
|
else
|
@@ -60,7 +61,7 @@ module Octopress
|
|
60
61
|
end
|
61
62
|
|
62
63
|
def self.require_plugins
|
63
|
-
config = Octopress.
|
64
|
+
config = Octopress::Configuration.jekyll_config
|
64
65
|
|
65
66
|
if config['gems'].is_a?(Array)
|
66
67
|
config['gems'].each {|g| require g }
|
@@ -78,10 +79,12 @@ module Octopress
|
|
78
79
|
|
79
80
|
# Returns an Array of plugin search paths
|
80
81
|
def self.plugins_path
|
81
|
-
|
82
|
-
|
82
|
+
config = Octopress::Configuration.jekyll_config
|
83
|
+
plugins = config['plugins']
|
84
|
+
if (plugins == Jekyll::Configuration::DEFAULTS['plugins'])
|
85
|
+
[Jekyll.sanitized_path(config['source'], plugins)]
|
83
86
|
else
|
84
|
-
Array(
|
87
|
+
Array(plugins).map { |d| File.expand_path(d) }
|
85
88
|
end
|
86
89
|
end
|
87
90
|
|
data/lib/octopress-docs/doc.rb
CHANGED
@@ -11,7 +11,7 @@ module Octopress
|
|
11
11
|
@plugin_slug = options[:slug]
|
12
12
|
@plugin_type = options[:type]
|
13
13
|
@base_url = options[:base_url]
|
14
|
-
@
|
14
|
+
@data = options[:data] || {}
|
15
15
|
end
|
16
16
|
|
17
17
|
# Add doc page to Jekyll pages
|
@@ -44,7 +44,7 @@ module Octopress
|
|
44
44
|
'docs_base_url' => @base_url
|
45
45
|
}
|
46
46
|
@page.data['dir'] = doc_dir
|
47
|
-
@page.data
|
47
|
+
@page.data = @data.merge(@page.data)
|
48
48
|
@page
|
49
49
|
end
|
50
50
|
|
@@ -59,7 +59,7 @@ module Octopress
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def plugin_slug
|
62
|
-
|
62
|
+
Jekyll::Utils.slugify(@plugin_type == 'theme' ? 'theme' : @plugin_slug)
|
63
63
|
end
|
64
64
|
|
65
65
|
def page_dir
|
data/lib/octopress-docs/hooks.rb
CHANGED
@@ -1,14 +1,20 @@
|
|
1
1
|
module Octopress
|
2
2
|
module Docs
|
3
3
|
class DocsSiteHook < Octopress::Hooks::Site
|
4
|
+
def post_read(site)
|
5
|
+
if Octopress::Docs.docs_mode && Octopress.site.nil?
|
6
|
+
Octopress.site = site
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
4
10
|
def pre_render(site)
|
5
|
-
if Octopress.
|
11
|
+
if Octopress::Docs.docs_mode
|
6
12
|
site.pages.concat Octopress::Docs.pages
|
7
13
|
end
|
8
14
|
end
|
9
15
|
|
10
16
|
def merge_payload(payload, site)
|
11
|
-
if Octopress.
|
17
|
+
if Octopress::Docs.docs_mode
|
12
18
|
Octopress::Docs.pages_info
|
13
19
|
end
|
14
20
|
end
|
data/lib/octopress-docs/page.rb
CHANGED
data/lib/octopress-docs.rb
CHANGED
@@ -12,9 +12,20 @@ require "octopress-docs/tag"
|
|
12
12
|
require "octopress-docs/hooks"
|
13
13
|
|
14
14
|
module Octopress
|
15
|
+
unless defined? Octopress.site
|
16
|
+
def self.site
|
17
|
+
@site
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.site=(site)
|
21
|
+
@site = site
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
15
25
|
module Docs
|
16
26
|
attr_reader :docs
|
17
27
|
@docs = {}
|
28
|
+
@docs_mode = false
|
18
29
|
|
19
30
|
autoload :Doc, 'octopress-docs/doc'
|
20
31
|
|
@@ -22,6 +33,14 @@ module Octopress
|
|
22
33
|
File.expand_path(File.join(File.dirname(__FILE__), '../', dir))
|
23
34
|
end
|
24
35
|
|
36
|
+
def self.docs_mode
|
37
|
+
@docs_mode
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.docs_mode=(mode)
|
41
|
+
@docs_mode = mode
|
42
|
+
end
|
43
|
+
|
25
44
|
# Get all doc pages
|
26
45
|
#
|
27
46
|
def self.pages
|
@@ -58,14 +77,10 @@ module Octopress
|
|
58
77
|
|
59
78
|
def self.add_plugin_docs(plugin)
|
60
79
|
options = plugin_options(plugin)
|
61
|
-
|
62
|
-
|
63
|
-
# If there is no docs index page, set the reame as the index page
|
64
|
-
has_index = !plugin_doc_pages.select {|d| d.file =~ /^index/ }.empty?
|
65
|
-
plugin_doc_pages << add_root_plugin_doc(plugin, 'readme', index: !has_index)
|
66
|
-
|
67
|
-
plugin_doc_pages << add_root_plugin_doc(plugin, 'changelog')
|
80
|
+
options[:docs] ||= %w{readme docs}
|
68
81
|
|
82
|
+
plugin_doc_pages = add_asset_docs(options)
|
83
|
+
plugin_doc_pages.concat add_root_docs(options, plugin_doc_pages)
|
69
84
|
plugin_doc_pages
|
70
85
|
end
|
71
86
|
|
@@ -86,6 +101,7 @@ module Octopress
|
|
86
101
|
options[:slug] = slug(options)
|
87
102
|
options[:base_url] = base_url(options)
|
88
103
|
options[:dir] ||= '.'
|
104
|
+
options
|
89
105
|
end
|
90
106
|
|
91
107
|
def self.slug(options)
|
@@ -103,21 +119,26 @@ module Octopress
|
|
103
119
|
|
104
120
|
def self.add(options)
|
105
121
|
options[:docs] ||= %w{readme changelog}
|
122
|
+
options = default_options(options)
|
106
123
|
options[:docs_path] ||= File.join(options[:dir], 'assets', 'docs')
|
107
124
|
docs = []
|
108
|
-
docs.concat add_root_docs(options)
|
109
125
|
docs.concat add_asset_docs(options)
|
126
|
+
docs.concat add_root_docs(options, docs)
|
110
127
|
docs.compact!
|
111
128
|
end
|
112
129
|
|
113
|
-
def self.add_root_docs(options)
|
130
|
+
def self.add_root_docs(options, asset_docs=[])
|
114
131
|
root_docs = []
|
115
132
|
options[:docs].each do |doc|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
133
|
+
doc_data = {
|
134
|
+
'title' => doc.capitalize
|
135
|
+
}
|
136
|
+
|
137
|
+
if doc =~ /readme/ && asset_docs.select {|d| d.file =~ /^index/ }.empty?
|
138
|
+
doc_data['permalink'] = '/'
|
120
139
|
end
|
140
|
+
|
141
|
+
root_docs << add_root_doc(doc, options.merge(data: doc_data))
|
121
142
|
end
|
122
143
|
root_docs
|
123
144
|
end
|
@@ -129,11 +150,6 @@ module Octopress
|
|
129
150
|
end
|
130
151
|
end
|
131
152
|
|
132
|
-
def self.add_root_plugin_doc(plugin, filename, options={})
|
133
|
-
options = plugin_options(plugin).merge(options)
|
134
|
-
add_root_doc(filename, options)
|
135
|
-
end
|
136
|
-
|
137
153
|
def self.add_doc_page(options)
|
138
154
|
page = Docs::Doc.new(options)
|
139
155
|
@docs[options[:slug]] ||= []
|
@@ -169,6 +185,5 @@ module Octopress
|
|
169
185
|
def self.select_first(dir, match)
|
170
186
|
Dir.new(dir).select { |f| f =~/#{match}/i}.first
|
171
187
|
end
|
172
|
-
|
173
188
|
end
|
174
189
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-docs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name: pry-
|
84
|
+
name: pry-byebug
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|