bookbindery 9.9.0 → 9.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bookbinder.gemspec +1 -1
- data/lib/bookbinder/cli.rb +9 -3
- data/lib/bookbinder/commands/collection.rb +4 -3
- data/lib/bookbinder/commands/watch.rb +13 -2
- data/lib/bookbinder/spider.rb +3 -6
- data/lib/bookbinder/subnav/template_creator.rb +5 -0
- data/master_middleman/source/subnavs/_nav-links.erb +1 -1
- data/template_app/lib/search/hit.rb +5 -1
- data/template_app/search-results.html.erb +9 -3
- data/template_app/search.yml +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99c1606223bcc841a9f5c9abd0f8bb3df7212e13
|
4
|
+
data.tar.gz: f92ba6323770d66d4f00db7194535ff46bac06e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04376d1753d497e4b55ef42960ef90948de5a106d7706d296e8c225081e54b7b4e73cea9ee1c85e8791a4ce849a3c3563e9d623f95fe0c36b55aeadbd7ee47d1
|
7
|
+
data.tar.gz: 58d72ca85fda5c537c48da63752c041c1785da464b77e7928cfb34e4c289e1e4e1153d58eca3710a10f75d73ea7e98a95a7570ec4c12951b846d29f0c9dcdd30
|
data/bookbinder.gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'base64'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'bookbindery'
|
5
|
-
s.version = '9.
|
5
|
+
s.version = '9.10.0'
|
6
6
|
s.summary = 'Markdown to Rackup application documentation generator'
|
7
7
|
s.description = 'A command line utility to be run in Book repositories to stitch together their constituent Markdown repos into a static-HTML-serving application'
|
8
8
|
s.authors = ['Mike Grafton', 'Lucas Marks', 'Gavin Morgan', 'Nikhil Gajwani', 'Dan Wendorf', 'Brenda Chan', 'Matthew Boedicker', 'Andrew Bruce', 'Frank Kotsianas', 'Elena Sharma', 'Christa Hartsock', 'Michael Trestman', 'Alpha Chen', 'Sarah McAlear', 'Gregg Van Hove']
|
data/lib/bookbinder/cli.rb
CHANGED
@@ -52,9 +52,15 @@ module Bookbinder
|
|
52
52
|
raise Thor::Error, '' if code != 0
|
53
53
|
end
|
54
54
|
|
55
|
-
desc 'watch', 'Bind and serve a local book, watching for changes'
|
56
|
-
|
57
|
-
|
55
|
+
desc 'watch [repo1 [repo2]]', 'Bind and serve a local book, watching for changes'
|
56
|
+
long_desc <<-LONG_DESC
|
57
|
+
Bind and serve a local book, watching for changes
|
58
|
+
|
59
|
+
Optionally, you can provide a subset of the repositories in the book to be watched.
|
60
|
+
This will exclude any repositories not specified from being available in the bound book, even if they exist on your file system.
|
61
|
+
LONG_DESC
|
62
|
+
def watch(*repos)
|
63
|
+
code = legacy_commands.watch(repos)
|
58
64
|
raise Thor::Error, '' if code != 0
|
59
65
|
end
|
60
66
|
|
@@ -64,11 +64,11 @@ module Bookbinder
|
|
64
64
|
def bind(*args)
|
65
65
|
@bind ||= Commands::Bind.new(
|
66
66
|
streams,
|
67
|
+
middleman_runner: runner,
|
67
68
|
output_locations: output_locations,
|
68
69
|
config_fetcher: configuration_fetcher(Config::Configuration),
|
69
70
|
config_decorator: Config::ConfigurationDecorator.new(loader: config_loader, config_filename: 'bookbinder.yml'),
|
70
71
|
file_system_accessor: local_filesystem_accessor,
|
71
|
-
middleman_runner: runner,
|
72
72
|
broken_links_checker: Postprocessing::BrokenLinksChecker.build(final_app_directory, sitemap_port),
|
73
73
|
preprocessor: Preprocessing::Preprocessor.new(
|
74
74
|
Preprocessing::DitaHTMLPreprocessor.new(
|
@@ -86,7 +86,7 @@ module Bookbinder
|
|
86
86
|
).run(*args)
|
87
87
|
end
|
88
88
|
|
89
|
-
def watch
|
89
|
+
def watch(repos=[])
|
90
90
|
@watch ||= Commands::Watch.new(
|
91
91
|
streams,
|
92
92
|
middleman_runner: runner,
|
@@ -97,7 +97,8 @@ module Bookbinder
|
|
97
97
|
preprocessor: Preprocessing::Preprocessor.new(Preprocessing::LinkToSiteGenDir.new(local_filesystem_accessor, subnav_generator_factory)),
|
98
98
|
cloner: local_file_system_cloner,
|
99
99
|
section_repository: Ingest::SectionRepository.new,
|
100
|
-
directory_preparer: directory_preparer
|
100
|
+
directory_preparer: directory_preparer,
|
101
|
+
repo_restrictions: repos
|
101
102
|
).run
|
102
103
|
end
|
103
104
|
|
@@ -10,7 +10,8 @@ module Bookbinder
|
|
10
10
|
preprocessor: nil,
|
11
11
|
cloner: nil,
|
12
12
|
section_repository: nil,
|
13
|
-
directory_preparer: nil
|
13
|
+
directory_preparer: nil,
|
14
|
+
repo_restrictions: [])
|
14
15
|
@streams = streams
|
15
16
|
@middleman_runner = middleman_runner
|
16
17
|
@output_locations = output_locations
|
@@ -21,6 +22,7 @@ module Bookbinder
|
|
21
22
|
@cloner = cloner
|
22
23
|
@section_repository = section_repository
|
23
24
|
@directory_preparer = directory_preparer
|
25
|
+
@repo_restrictions = repo_restrictions
|
24
26
|
end
|
25
27
|
|
26
28
|
def run
|
@@ -33,7 +35,7 @@ module Bookbinder
|
|
33
35
|
cloner
|
34
36
|
)
|
35
37
|
sections = section_repository.fetch(
|
36
|
-
configured_sections: watch_config.sections,
|
38
|
+
configured_sections: filter_sections(watch_config.sections),
|
37
39
|
destination_dir: output_locations.cloned_preprocessing_dir,
|
38
40
|
cloner: cloner,
|
39
41
|
streams: streams
|
@@ -84,6 +86,15 @@ module Bookbinder
|
|
84
86
|
end
|
85
87
|
temp
|
86
88
|
end
|
89
|
+
|
90
|
+
def filter_sections(section_configs)
|
91
|
+
return section_configs if @repo_restrictions.nil? || @repo_restrictions.empty?
|
92
|
+
|
93
|
+
section_configs.select do |config|
|
94
|
+
repo_name = (config.repo_name || '').split('/').last
|
95
|
+
@repo_restrictions.include?(repo_name)
|
96
|
+
end
|
97
|
+
end
|
87
98
|
end
|
88
99
|
end
|
89
100
|
end
|
data/lib/bookbinder/spider.rb
CHANGED
@@ -42,8 +42,7 @@ Found #{@broken_links.count} broken links!
|
|
42
42
|
def find_broken_links(port, broken_link_exclusions: /(?!.*)/)
|
43
43
|
temp_host = "localhost:#{port}"
|
44
44
|
sieve = Sieve.new domain: "http://#{temp_host}"
|
45
|
-
|
46
|
-
broken_links = links.first
|
45
|
+
broken_links = crawl_from "http://#{temp_host}#{ENV['CUSTOM_ROOT']}/index.html", sieve
|
47
46
|
public_broken_links = broken_links.reject {|l| l.match(broken_link_exclusions)}
|
48
47
|
|
49
48
|
Result.new(public_broken_links)
|
@@ -55,22 +54,20 @@ Found #{@broken_links.count} broken links!
|
|
55
54
|
|
56
55
|
def crawl_from(url, sieve)
|
57
56
|
broken_links = []
|
58
|
-
sitemap = [url]
|
59
57
|
2.times do |i|
|
60
58
|
is_first_pass = (i==0)
|
61
59
|
|
62
|
-
Anemone.crawl(url) do |anemone|
|
60
|
+
Anemone.crawl(url, discard_page_bodies: true) do |anemone|
|
63
61
|
dont_visit_fragments(anemone)
|
64
62
|
anemone.on_every_page do |page|
|
65
63
|
broken, working = sieve.links_from(Stabilimentum.new(page), is_first_pass)
|
66
64
|
broken_links.concat broken
|
67
|
-
sitemap.concat working
|
68
65
|
end
|
69
66
|
end
|
70
67
|
end
|
71
68
|
|
72
69
|
broken_links.concat Dir.chdir(@app_dir) { CssLinkChecker.new.broken_links_in_all_stylesheets }
|
73
|
-
|
70
|
+
broken_links.compact.uniq
|
74
71
|
end
|
75
72
|
|
76
73
|
def dont_visit_fragments(anemone)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'erb'
|
2
|
+
require 'rack/utils'
|
2
3
|
|
3
4
|
module Bookbinder
|
4
5
|
module Subnav
|
@@ -60,6 +61,10 @@ module Bookbinder
|
|
60
61
|
def links?(links)
|
61
62
|
(links || []).empty?
|
62
63
|
end
|
64
|
+
|
65
|
+
def escape_html(str)
|
66
|
+
Rack::Utils.escape_html(str)
|
67
|
+
end
|
63
68
|
end
|
64
69
|
end
|
65
70
|
end
|
@@ -8,7 +8,11 @@ module Bookbinder
|
|
8
8
|
@product_name = source_fields['product_name']
|
9
9
|
@product_version = source_fields['product_version']
|
10
10
|
|
11
|
-
|
11
|
+
if attrs.has_key?('highlight')
|
12
|
+
@text = attrs.fetch('highlight').fetch('text').first.strip
|
13
|
+
else
|
14
|
+
@text = source_fields.fetch('summary')
|
15
|
+
end
|
12
16
|
end
|
13
17
|
|
14
18
|
attr_reader :title, :url, :text, :product_name, :product_version
|
@@ -1,3 +1,9 @@
|
|
1
|
+
<%
|
2
|
+
def escape_html(str)
|
3
|
+
Rack::Utils.escape_html(str)
|
4
|
+
end
|
5
|
+
%>
|
6
|
+
|
1
7
|
<div class="search-results">
|
2
8
|
<form method="get">
|
3
9
|
|
@@ -8,12 +14,12 @@
|
|
8
14
|
<% end %>
|
9
15
|
</h4>
|
10
16
|
<% end %>
|
11
|
-
<input name="q" value="<%= search_term %>"/>
|
17
|
+
<input name="q" value="<%= escape_html search_term %>"/>
|
12
18
|
<% unless product_name.nil? %>
|
13
|
-
<input type="hidden" name="product_name" value="<%= product_name %>"/>
|
19
|
+
<input type="hidden" name="product_name" value="<%= escape_html product_name %>"/>
|
14
20
|
<% end %>
|
15
21
|
<% unless product_version.nil? %>
|
16
|
-
<input type="hidden" name="product_version" value="<%= product_version %>"/>
|
22
|
+
<input type="hidden" name="product_version" value="<%= escape_html product_version %>"/>
|
17
23
|
<% end %>
|
18
24
|
</form>
|
19
25
|
|
data/template_app/search.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bookbindery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Grafton
|
@@ -22,7 +22,7 @@ authors:
|
|
22
22
|
autorequire:
|
23
23
|
bindir: install_bin
|
24
24
|
cert_chain: []
|
25
|
-
date: 2016-06-
|
25
|
+
date: 2016-06-14 00:00:00.000000000 Z
|
26
26
|
dependencies:
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: fog-aws
|