ascii_binder_gabriel_rh 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +56 -0
- data/Dockerfile +19 -0
- data/Gemfile +3 -0
- data/Guardfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.adoc +21 -0
- data/README.md +1 -0
- data/Rakefile +1 -0
- data/ascii_binder_gabriel_rh.gemspec +41 -0
- data/bin/ascii_binder_gabriel_rh +1 -0
- data/bin/asciibinder_gabriel_rh +350 -0
- data/features/command_help.feature +8 -0
- data/features/command_version.feature +8 -0
- data/features/repo_build.feature +39 -0
- data/features/repo_clean.feature +20 -0
- data/features/repo_clone.feature +22 -0
- data/features/repo_create.feature +13 -0
- data/features/repo_package.feature +15 -0
- data/features/step_definitions/steps.rb +189 -0
- data/features/support/_clone_distro_map.yml +14 -0
- data/features/support/_invalid_alias_topic_map.yml +50 -0
- data/features/support/_invalid_distro_map.yml +14 -0
- data/features/support/env.rb +518 -0
- data/features/support/test_distro/.gitignore +9 -0
- data/features/support/test_distro/_distro_map.yml +29 -0
- data/features/support/test_distro/_images/asciibinder-logo-horizontal.png +0 -0
- data/features/support/test_distro/_images/asciibinder_web_logo.svg +125 -0
- data/features/support/test_distro/_images/book_pages_bg.jpg +0 -0
- data/features/support/test_distro/_images/favicon.ico +0 -0
- data/features/support/test_distro/_images/favicon32x32.png +0 -0
- data/features/support/test_distro/_javascripts/.gitkeep +0 -0
- data/features/support/test_distro/_stylesheets/asciibinder.css +568 -0
- data/features/support/test_distro/_templates/_css.html.erb +3 -0
- data/features/support/test_distro/_templates/_nav.html.erb +31 -0
- data/features/support/test_distro/_templates/page.html.erb +92 -0
- data/features/support/test_distro/_topic_map.yml +50 -0
- data/features/support/test_distro/index-main.html +10 -0
- data/features/support/test_distro/index-test.html +10 -0
- data/features/support/test_distro/main_only_topic_group/index.adoc +17 -0
- data/features/support/test_distro/test_only_topic_group/index.adoc +17 -0
- data/features/support/test_distro/welcome/aliased.adoc +9 -0
- data/features/support/test_distro/welcome/index.adoc +17 -0
- data/features/support/test_distro/welcome/subtopics/index.adoc +17 -0
- data/features/support/test_distro/welcome/subtopics/main_only_topic.adoc +17 -0
- data/features/support/test_distro/welcome/subtopics/test_only_topic.adoc +17 -0
- data/features/support/test_distro/welcome/subtopics/wildcard_all.adoc +17 -0
- data/lib/ascii_binder_gabriel_rh/distro.rb +111 -0
- data/lib/ascii_binder_gabriel_rh/distro_branch.rb +97 -0
- data/lib/ascii_binder_gabriel_rh/distro_map.rb +67 -0
- data/lib/ascii_binder_gabriel_rh/engine.rb +690 -0
- data/lib/ascii_binder_gabriel_rh/helpers.rb +172 -0
- data/lib/ascii_binder_gabriel_rh/site.rb +52 -0
- data/lib/ascii_binder_gabriel_rh/site_info.rb +22 -0
- data/lib/ascii_binder_gabriel_rh/site_map.rb +24 -0
- data/lib/ascii_binder_gabriel_rh/tasks/guards.rb +15 -0
- data/lib/ascii_binder_gabriel_rh/tasks/tasks.rb +41 -0
- data/lib/ascii_binder_gabriel_rh/template_renderer.rb +29 -0
- data/lib/ascii_binder_gabriel_rh/topic_entity.rb +324 -0
- data/lib/ascii_binder_gabriel_rh/topic_map.rb +112 -0
- data/lib/ascii_binder_gabriel_rh/version.rb +3 -0
- data/lib/ascii_binder_gabriel_rh.rb +5 -0
- data/templates/.gitignore +9 -0
- data/templates/LICENSE.txt +4 -0
- data/templates/README.adoc +11 -0
- data/templates/_distro_map.yml +11 -0
- data/templates/_images/asciibinder-logo-horizontal.png +0 -0
- data/templates/_images/asciibinder_web_logo.svg +125 -0
- data/templates/_images/book_pages_bg.jpg +0 -0
- data/templates/_images/favicon.ico +0 -0
- data/templates/_images/favicon32x32.png +0 -0
- data/templates/_javascripts/.gitkeep +0 -0
- data/templates/_javascripts/bootstrap-offcanvas.js +6 -0
- data/templates/_stylesheets/asciibinder.css +568 -0
- data/templates/_templates/_breadcrumb.html.erb +14 -0
- data/templates/_templates/_css.html.erb +3 -0
- data/templates/_templates/_nav.html.erb +14 -0
- data/templates/_templates/_title.html.erb +8 -0
- data/templates/_templates/page.html.erb +88 -0
- data/templates/_topic_map.yml +29 -0
- data/templates/index-main.html +89 -0
- data/templates/welcome/index.adoc +14 -0
- metadata +423 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 56fae4193af226b850e7d7d52731a13aa92c28af24d020ab07b4ca0cf10b0769
|
4
|
+
data.tar.gz: 191fa63cc8e86d8da56a4b6b1f93eedb1d2e994e53611188a4a76e3495f35fbe
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7e6858bab2a8fafe952da235508949ff207ff3fe4e78c7dffb4ad68f77112d28077b5ee9cbade6c14baa95e283109e0c9bada1d02353e792071ffdda51f5e96c
|
7
|
+
data.tar.gz: d9f3d81ca8f1615356603b8d487cecd50a74df0f9fec36d82174b6fe550338c5d4230fd3881f4de879c012ab238dae869e08c2cf52d82cf31b50e2840ba6d570
|
data/.gitignore
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
# Ignore Byebug command history file.
|
17
|
+
.byebug_history
|
18
|
+
|
19
|
+
## Specific to RubyMotion:
|
20
|
+
.dat*
|
21
|
+
.repl_history
|
22
|
+
build/
|
23
|
+
*.bridgesupport
|
24
|
+
build-iPhoneOS/
|
25
|
+
build-iPhoneSimulator/
|
26
|
+
|
27
|
+
## Specific to RubyMotion (use of CocoaPods):
|
28
|
+
#
|
29
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
30
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
31
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
32
|
+
#
|
33
|
+
# vendor/Pods/
|
34
|
+
|
35
|
+
## Documentation cache and generated files:
|
36
|
+
/.yardoc/
|
37
|
+
/_yardoc/
|
38
|
+
/doc/
|
39
|
+
/rdoc/
|
40
|
+
|
41
|
+
## Environment normalization:
|
42
|
+
/.bundle/
|
43
|
+
/vendor/bundle
|
44
|
+
/lib/bundler/man/
|
45
|
+
|
46
|
+
# for a library or gem, you might want to ignore these files since the code is
|
47
|
+
# intended to run in multiple environments; otherwise, check them in:
|
48
|
+
# Gemfile.lock
|
49
|
+
# .ruby-version
|
50
|
+
# .ruby-gemset
|
51
|
+
|
52
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
53
|
+
.rvmrc
|
54
|
+
|
55
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
56
|
+
# .rubocop-https?--*
|
data/Dockerfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
FROM centos/ruby-23-centos7
|
2
|
+
|
3
|
+
RUN scl enable rh-ruby23 -- gem install listen -v 3.0.8
|
4
|
+
RUN scl enable rh-ruby23 -- gem install ascii_binder_gabriel_rh
|
5
|
+
USER root
|
6
|
+
RUN yum install -y java-1.7.0-openjdk && \
|
7
|
+
yum clean all
|
8
|
+
|
9
|
+
LABEL url="http://www.asciibinder.org" \
|
10
|
+
summary="a documentation system built on Asciidoctor" \
|
11
|
+
description="AsciiBinderGabrielRH is for documenting versioned, interrelated projects. Run this container image from the documentation repository, which is mounted into the container. Note: Generated files will be owned by root." \
|
12
|
+
RUN="docker run -it --rm \
|
13
|
+
-v `pwd`:/docs:z \
|
14
|
+
IMAGE"
|
15
|
+
|
16
|
+
ENV JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.95-2.6.4.0.el7_2.x86_64/jre/
|
17
|
+
ENV LANG=en_US.UTF-8
|
18
|
+
WORKDIR /docs
|
19
|
+
CMD asciibinder package
|
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Red Hat, Inc.
|
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.adoc
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
= AsciiBinderGabrielRH
|
2
|
+
|
3
|
+
image:https://badge.fury.io/rb/ascii_binder_gabriel_rh.svg["Gem Version", link="https://badge.fury.io/rb/ascii_binder_gabriel_rh"]
|
4
|
+
|
5
|
+
AsciiBinderGabrielRH is an AsciiDoc-based system for authoring and publishing closely related documentation sets from a single source.
|
6
|
+
|
7
|
+
This product is no longer actively maintained.
|
8
|
+
|
9
|
+
== Learn More
|
10
|
+
|
11
|
+
* Take the https://rubygems.org/gems/ascii_binder_gabriel_rh[ascii_binder_gabriel_rh Ruby Gem] for a spin.
|
12
|
+
|
13
|
+
The AsciiBinderGabrielRH system was initially developed for https://github.com/openshift/openshift-docs[OpenShift documentation], but has been revised to work for documenting a wide variety of complex, multi-versioned software projects.
|
14
|
+
|
15
|
+
== Contributing
|
16
|
+
|
17
|
+
We are using the https://github.com/redhataccess/ascii_binder_gabriel_rh/issues[Issues] page to track bugs and feature ideas on the code, so have a look and feel free to ask questions there.
|
18
|
+
|
19
|
+
== License
|
20
|
+
|
21
|
+
The gem is available as open source under the terms of the http://opensource.org/licenses/MIT[MIT License].
|
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# asciibinder-gabriel-rh
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ascii_binder_gabriel_rh/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ascii_binder_gabriel_rh"
|
8
|
+
spec.version = AsciiBinderGabrielRH::VERSION
|
9
|
+
spec.authors = ["N. Harrison Ripps", "Jason Frey", "Carlos Munoz", "Brian Exelbierd", "Vikram Goyal"]
|
10
|
+
spec.email = ["nhr@redhat.com", "jfrey@redhat.com", "chavo16@hotmail.com", "bex@pobox.com", "vigoyal@redhat.com"]
|
11
|
+
spec.summary = %q{AsciiBinderGabrielRH is an AsciiDoc-based system for authoring and publishing closely related documentation sets from a single source.}
|
12
|
+
spec.description = spec.summary
|
13
|
+
spec.homepage = "https://github.com/redhataccess/ascii_binder_gabriel_rh"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler"
|
22
|
+
spec.add_development_dependency "cucumber", "~> 2.3.3"
|
23
|
+
spec.add_development_dependency "diff_dirs", "~> 0.1.2"
|
24
|
+
spec.add_dependency "rake", "~> 12.3.3"
|
25
|
+
|
26
|
+
spec.add_dependency 'asciidoctor', '~> 2.0.10'
|
27
|
+
spec.add_dependency 'asciidoctor-diagram', '~> 2.0.2'
|
28
|
+
spec.add_dependency 'rouge', '~> 3.18.0'
|
29
|
+
spec.add_dependency 'git'
|
30
|
+
spec.add_dependency 'guard'
|
31
|
+
spec.add_dependency 'guard-shell'
|
32
|
+
spec.add_dependency 'guard-livereload'
|
33
|
+
spec.add_dependency 'haml'
|
34
|
+
spec.add_dependency 'json'
|
35
|
+
spec.add_dependency 'sitemap_generator', '~> 6.0.1'
|
36
|
+
spec.add_dependency 'trollop', '~> 2.1.2'
|
37
|
+
spec.add_dependency "yajl-ruby", ">= 1.4.2"
|
38
|
+
spec.add_dependency 'tilt'
|
39
|
+
spec.add_dependency 'asciidoctor-fixxrefs'
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
bin/asciibinder_gabriel_rh
|
@@ -0,0 +1,350 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'ascii_binder_gabriel_rh/distro_map'
|
4
|
+
require 'ascii_binder_gabriel_rh/engine'
|
5
|
+
require 'ascii_binder_gabriel_rh/helpers'
|
6
|
+
require 'ascii_binder_gabriel_rh/version'
|
7
|
+
require 'pathname'
|
8
|
+
require 'trollop'
|
9
|
+
|
10
|
+
include AsciiBinderGabrielRH::Engine
|
11
|
+
include AsciiBinderGabrielRH::Helpers
|
12
|
+
|
13
|
+
def call_generate(branch_group, distro, page)
|
14
|
+
if page == ''
|
15
|
+
page = nil
|
16
|
+
end
|
17
|
+
begin
|
18
|
+
generate_docs(branch_group, distro, page)
|
19
|
+
rescue => e
|
20
|
+
message = "#{e.class.name}: #{e.message} at\n #{e.backtrace.join("\n ")}"
|
21
|
+
Trollop::die "Could not generate docs:\n#{message}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def repo_check(docs_basedir)
|
26
|
+
missing_files = false
|
27
|
+
# These must all be present
|
28
|
+
['_distro_map.yml','_templates'].each do |file|
|
29
|
+
unless File.exist?(File.join(docs_basedir, file))
|
30
|
+
missing_files = true
|
31
|
+
end
|
32
|
+
end
|
33
|
+
# Either of these must be present
|
34
|
+
# unless File.exist?(File.join("#{docs_basedir}/#{TOPIC_MAP_FOLDER}", '_topic_map.yml'))
|
35
|
+
# missing_files = true
|
36
|
+
# end
|
37
|
+
if missing_files or not in_git_repo(docs_basedir)
|
38
|
+
Trollop::die "The specified docs base directory '#{docs_basedir}' does not appear to be part of an AsciiBinderGabrielRH-compatible repo."
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def in_git_repo(dir)
|
43
|
+
git_path = File.join(dir,'.git')
|
44
|
+
return true if File.exist?(git_path) and File.directory?(git_path)
|
45
|
+
return false if dir == '/'
|
46
|
+
in_git_repo(File.expand_path('..',dir))
|
47
|
+
end
|
48
|
+
|
49
|
+
SUB_COMMANDS = %w{help version build watch package clean create clone}
|
50
|
+
Trollop::options do
|
51
|
+
version AsciiBinderGabrielRH::VERSION
|
52
|
+
banner <<-EOF
|
53
|
+
Usage:
|
54
|
+
#$0 <command> <docs_basedir>
|
55
|
+
|
56
|
+
Commands:
|
57
|
+
build (default action)
|
58
|
+
Builds the HTML docs within the indicated docs base directory
|
59
|
+
create
|
60
|
+
Generates a new AsciiBinderGabrielRH repo at the indicated dir
|
61
|
+
clone
|
62
|
+
Clones an existing AsciiBinderGabrielRH repo to the local filesystem
|
63
|
+
watch
|
64
|
+
Starts Guard, which automatically regenerates changed HTML
|
65
|
+
files on the working branch in the docs base directory dir
|
66
|
+
package
|
67
|
+
Builds and packages the static HTML for all of the sites
|
68
|
+
defined in the _distro_config.yml file
|
69
|
+
clean
|
70
|
+
Remove _preview, _publish and _package dirs created by
|
71
|
+
other AsciiBinderGabrielRH operations.
|
72
|
+
|
73
|
+
Options:
|
74
|
+
EOF
|
75
|
+
stop_on SUB_COMMANDS
|
76
|
+
end
|
77
|
+
|
78
|
+
cmd = ARGV.shift
|
79
|
+
docs_basedir = nil
|
80
|
+
|
81
|
+
if cmd.nil?
|
82
|
+
cmd = "build"
|
83
|
+
elsif !SUB_COMMANDS.include?(cmd)
|
84
|
+
if ARGV.empty?
|
85
|
+
docs_basedir = Pathname.new(cmd)
|
86
|
+
cmd = "build"
|
87
|
+
else
|
88
|
+
Trollop::die "'#{cmd}' is not a valid asciibinder subcommand. Legal values are '#{SUB_COMMANDS.join('\', \'')}'."
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
cmd_opts = case cmd
|
93
|
+
when "build"
|
94
|
+
Trollop::options do
|
95
|
+
banner <<-EOF
|
96
|
+
Usage:
|
97
|
+
#$0 build <options> <docs_basedir>
|
98
|
+
|
99
|
+
Description:
|
100
|
+
This is the default behavior for the asciibinder utility. When run,
|
101
|
+
AsciiBinderGabrielRH reads the _distro_config.yml file out of the working
|
102
|
+
branch of the indicated docs base directory and based on that, proceeds
|
103
|
+
to build the working branch version of the documentation for each distro.
|
104
|
+
|
105
|
+
If you use the --all_branches flag, AsciiBinderGabrielRH behaves as described
|
106
|
+
above, and then once the working branch version is built, AsciiBinderGabrielRH
|
107
|
+
cycles through the other branches named in the _distro_config.yml file
|
108
|
+
until all of the permutations have been built.
|
109
|
+
|
110
|
+
If you want to limit the scope of the build work for faster builds,
|
111
|
+
you have two targeted options:
|
112
|
+
|
113
|
+
--distro=<distro_key> - Only builds the specified distro and branches
|
114
|
+
associated with this distro.
|
115
|
+
|
116
|
+
--page=<page_path> - Only builds the specified page for all distros.
|
117
|
+
|
118
|
+
Note that the format for the "--page" option is:
|
119
|
+
|
120
|
+
<topic_group>:<topic_file>
|
121
|
+
|
122
|
+
or for subtopics:
|
123
|
+
|
124
|
+
<topic_group>/<subtopic_group>:<topic_file>
|
125
|
+
|
126
|
+
However, if you want to use the --page option extensively, then be
|
127
|
+
aware of the `asciibinder watch` function, which does this for you
|
128
|
+
automatically as you change any .adoc files in your working branch.
|
129
|
+
|
130
|
+
Options:
|
131
|
+
EOF
|
132
|
+
opt :all_branches, "Instead of building only the current working branch, build all branches", :default => false
|
133
|
+
opt :distro, "Instead of building all distros, build branches only for the specified distro.", :default => ''
|
134
|
+
opt :page, "Build only the specified page for all distros and only the current working branch.", :default => ''
|
135
|
+
opt :log_level, "Set the logging output level for this operation.", :default => 'warn'
|
136
|
+
opt :toc_depth, "Maximum depth of topics allowed. Use 0 for infinite depth.", :default => 3
|
137
|
+
conflicts :distro, :page
|
138
|
+
end
|
139
|
+
when "create"
|
140
|
+
Trollop::options do
|
141
|
+
banner <<-EOF
|
142
|
+
Usage:
|
143
|
+
#$0 create <new_docs_basedir>
|
144
|
+
|
145
|
+
Description:
|
146
|
+
Creates a new, bare AsciiBinderGabrielRH repo in the specified directory.
|
147
|
+
EOF
|
148
|
+
end
|
149
|
+
when "clone"
|
150
|
+
Trollop::options do
|
151
|
+
banner <<-EOF
|
152
|
+
Usage:
|
153
|
+
#$0 clone <options> <git_repo_url>
|
154
|
+
|
155
|
+
Description:
|
156
|
+
Clones an existing AsciiBinderGabrielRH repo to the current directory.
|
157
|
+
Under the default behavior, AsciiBinderGabrielRH will attempt to set up
|
158
|
+
tracking branches based on the contents of _distro_map.yml,
|
159
|
+
but this can be suppressed (see Options).
|
160
|
+
|
161
|
+
Options:
|
162
|
+
EOF
|
163
|
+
opt :branches, "Create tracking branches after cloning.", :default => true
|
164
|
+
opt :dir, "Specify the pathname of the local directory for cloning.", :default => ''
|
165
|
+
opt :log_level, "Set the logging output level for this operation.", :default => 'warn'
|
166
|
+
end
|
167
|
+
when "watch"
|
168
|
+
Trollop::options do
|
169
|
+
banner <<-EOF
|
170
|
+
Usage:
|
171
|
+
#$0 watch <docs_basedir>
|
172
|
+
|
173
|
+
Description:
|
174
|
+
In watch mode, AsciiBinderGabrielRH starts a Guard process in the foreground.
|
175
|
+
This process watches the docs_basedir for changes to the AsciiDoc (.adoc)
|
176
|
+
files. When a change occurs, AsciiBinderGabrielRH regenerates the specific
|
177
|
+
HTML output of the file that was changed, for the working branch only.
|
178
|
+
|
179
|
+
This is the equivalent of running:
|
180
|
+
|
181
|
+
$ asciibinder build --page='<topic_group>:<affected_file>'
|
182
|
+
|
183
|
+
...except that the Guardfile automatically detects and runs this as
|
184
|
+
you work.
|
185
|
+
|
186
|
+
This is meant to be used in conjunction with a web browser that is viewing the
|
187
|
+
output HTML page. Every time you save a new version of the .adoc file, you can
|
188
|
+
manually refresh your page to view the newly-generated HTML.
|
189
|
+
EOF
|
190
|
+
opt :log_level, "Set the logging output level for this operation.", :default => 'warn'
|
191
|
+
end
|
192
|
+
when "package"
|
193
|
+
Trollop::options do
|
194
|
+
banner <<-EOF
|
195
|
+
Usage:
|
196
|
+
#$0 package <options> <docs_basedir>
|
197
|
+
|
198
|
+
Description:
|
199
|
+
Publish mode is similar to 'build' mode, but once all of the branches' of
|
200
|
+
HTML are generated, 'publish' goes on to organize the branch / distro
|
201
|
+
combinations that are described in _distro_config.yml into their "site"
|
202
|
+
layouts. As a final step, the site layouts are tarred and gzipped for
|
203
|
+
easy placement onto a production web server.
|
204
|
+
|
205
|
+
Options:
|
206
|
+
EOF
|
207
|
+
opt :site, "Instead of packaging every docs site, package the specified site only.", :default => ''
|
208
|
+
opt :log_level, "Set the logging output level for this operation.", :default => 'warn'
|
209
|
+
opt :toc_depth, "Maximum depth of topics allowed. Use 0 for infinite depth.", :default => 3
|
210
|
+
end
|
211
|
+
when "help"
|
212
|
+
Trollop::educate
|
213
|
+
when "version"
|
214
|
+
puts AsciiBinderGabrielRH::VERSION
|
215
|
+
exit 0
|
216
|
+
end
|
217
|
+
|
218
|
+
if (not docs_basedir.nil? and not ARGV.empty?) or (docs_basedir.nil? and ARGV.length > 1)
|
219
|
+
Trollop::die "Too many arguments provided to ascii_binder_gabriel_rh: '#{ARGV.join(' ')}'. Exiting."
|
220
|
+
elsif docs_basedir.nil?
|
221
|
+
if ARGV.length == 1
|
222
|
+
if cmd == 'clone'
|
223
|
+
cmd_opts[:giturl] = ARGV.shift
|
224
|
+
if cmd_opts[:dir] != ''
|
225
|
+
docs_basedir = Pathname.new(cmd_opts[:dir])
|
226
|
+
else
|
227
|
+
docs_basedir = Pathname.new(File.join(Pathname.pwd, cmd_opts[:giturl].split('/')[-1].split('.')[0]))
|
228
|
+
end
|
229
|
+
else
|
230
|
+
docs_basedir = Pathname.new(ARGV.shift)
|
231
|
+
end
|
232
|
+
else
|
233
|
+
if cmd != 'create'
|
234
|
+
if cmd == 'clone'
|
235
|
+
Trollop::die "Provide a git URL to clone from."
|
236
|
+
else
|
237
|
+
docs_basedir = Pathname.pwd
|
238
|
+
end
|
239
|
+
else
|
240
|
+
Trollop::die "Specify a name for the new repo directory."
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
# Validate the docs_basedir path
|
246
|
+
if cmd == 'create' or cmd == 'clone'
|
247
|
+
if docs_basedir.exist?
|
248
|
+
Trollop::die "The specified new repo directory '#{docs_basedir}' already exists."
|
249
|
+
end
|
250
|
+
else
|
251
|
+
if !docs_basedir.exist?
|
252
|
+
Trollop::die "The specified docs directory '#{docs_basedir}' does not exist."
|
253
|
+
elsif !docs_basedir.directory?
|
254
|
+
Trollop::die "The specified docs directory path '#{docs_basedir}' is not a directory."
|
255
|
+
elsif !docs_basedir.readable?
|
256
|
+
Trollop::die "The specified docs directory '#{docs_basedir}' is not readable."
|
257
|
+
elsif !docs_basedir.writable?
|
258
|
+
Trollop::die "The specified docs directory '#{docs_basedir}' cannot be written to."
|
259
|
+
else
|
260
|
+
repo_check(docs_basedir)
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
# Set the repo root
|
265
|
+
set_docs_root_dir(File.expand_path(docs_basedir))
|
266
|
+
|
267
|
+
# Set the log level
|
268
|
+
user_log_level = :warn
|
269
|
+
unless cmd_opts.nil? or cmd_opts[:log_level].nil?
|
270
|
+
user_log_level = cmd_opts[:log_level].to_sym
|
271
|
+
unless log_levels.has_key?(user_log_level)
|
272
|
+
Trollop::die "log_level value '#{cmd_opts[:log_level]}' is not recognized. Legal values are " + log_levels.keys.map{ |lvl| "'#{lvl.to_s}'" }.join(', ')
|
273
|
+
end
|
274
|
+
end
|
275
|
+
set_log_level(user_log_level)
|
276
|
+
|
277
|
+
# Set the depth level
|
278
|
+
user_depth = 3
|
279
|
+
unless cmd_opts.nil? or cmd_opts[:toc_depth].nil?
|
280
|
+
user_depth = cmd_opts[:toc_depth].to_i
|
281
|
+
end
|
282
|
+
set_depth(user_depth)
|
283
|
+
|
284
|
+
|
285
|
+
# Cloning? Time to try it.
|
286
|
+
if cmd == 'clone'
|
287
|
+
puts "Cloning #{cmd_opts[:giturl]} to #{docs_basedir}"
|
288
|
+
system("git clone #{cmd_opts[:giturl]} #{docs_basedir}")
|
289
|
+
Trollop::die "The git URL could not be cloned: #{err}" if $?.exitstatus != 0
|
290
|
+
|
291
|
+
# Make sure this cloned repo is legit.
|
292
|
+
repo_check(docs_basedir)
|
293
|
+
|
294
|
+
if cmd_opts[:branches]
|
295
|
+
cloned_map = AsciiBinderGabrielRH::DistroMap.new(File.join(docs_basedir,DISTRO_MAP_FILENAME))
|
296
|
+
unless cloned_map.is_valid?
|
297
|
+
error_info = cloned_map.errors.join("\n")
|
298
|
+
Trollop::die "The distro map in the newly cloned repo is invalid, with the following errors:\n#{error_info}"
|
299
|
+
end
|
300
|
+
Dir.chdir(docs_basedir)
|
301
|
+
puts "Tracking branch setup:"
|
302
|
+
cloned_map.distro_branches.each do |doc_branch|
|
303
|
+
next if doc_branch == 'main'
|
304
|
+
puts "- #{doc_branch}"
|
305
|
+
system("git branch #{doc_branch} origin/#{doc_branch}")
|
306
|
+
end
|
307
|
+
else
|
308
|
+
puts "- Skipping tracking branch setup"
|
309
|
+
end
|
310
|
+
|
311
|
+
# Done and done.
|
312
|
+
puts "Cloning complete."
|
313
|
+
exit
|
314
|
+
end
|
315
|
+
|
316
|
+
# Change to the repo dir. This is necessary in order for
|
317
|
+
# AsciiDoctor to work properly.
|
318
|
+
if cmd != 'create'
|
319
|
+
Dir.chdir docs_basedir
|
320
|
+
end
|
321
|
+
|
322
|
+
# Do the things with the stuff
|
323
|
+
case cmd
|
324
|
+
when "build"
|
325
|
+
branch_group = cmd_opts[:all_branches] ? :all : :working_only
|
326
|
+
build_distro = cmd_opts[:distro] || ''
|
327
|
+
refresh_page = cmd_opts[:page] || nil
|
328
|
+
call_generate(branch_group,build_distro,refresh_page)
|
329
|
+
when "package"
|
330
|
+
clean_up
|
331
|
+
package_site = cmd_opts[:site] || ''
|
332
|
+
branch_group = package_site == '' ? :publish : "publish_#{package_site}".to_sym
|
333
|
+
call_generate(branch_group,'',nil)
|
334
|
+
package_docs(package_site)
|
335
|
+
when "watch"
|
336
|
+
if !dir_empty?(preview_dir)
|
337
|
+
guardfile_path = File.join(Gem::Specification.find_by_name("ascii_binder_gabriel_rh").full_gem_path, 'Guardfile')
|
338
|
+
exec("guard -G #{guardfile_path}")
|
339
|
+
else
|
340
|
+
Trollop::die "Run 'asciibinder build' at least once before running 'asciibinder watch'."
|
341
|
+
end
|
342
|
+
when "clean"
|
343
|
+
clean_up
|
344
|
+
puts "Cleaned up #{docs_basedir}."
|
345
|
+
when "create"
|
346
|
+
create_new_repo
|
347
|
+
puts "Created new repo in #{docs_basedir}."
|
348
|
+
end
|
349
|
+
|
350
|
+
exit
|
@@ -0,0 +1,8 @@
|
|
1
|
+
Feature: asciibinder help
|
2
|
+
|
3
|
+
Displays help information for the asciibinder utility
|
4
|
+
|
5
|
+
Scenario: A user wants to see help information for the utility
|
6
|
+
Given a nonexistent repo directory
|
7
|
+
When the user runs `asciibinder help` on that repo directory
|
8
|
+
Then the program displays help information
|
@@ -0,0 +1,8 @@
|
|
1
|
+
Feature: asciibinder version
|
2
|
+
|
3
|
+
This command returns the version of the installed utility
|
4
|
+
|
5
|
+
Scenario: A user wants to display the version of the asciibinder utility
|
6
|
+
Given a nonexistent repo directory
|
7
|
+
When the user runs `asciibinder version` on that repo directory
|
8
|
+
Then the program prints the current version of the utility
|
@@ -0,0 +1,39 @@
|
|
1
|
+
Feature: asciibinder build
|
2
|
+
|
3
|
+
Causes the utility to process one or more distro/branch combinations,
|
4
|
+
transforming AsciiDoc files to a unified docs set in HTML
|
5
|
+
|
6
|
+
Scenario: A user wants to do any build in a repo with an invalid distro map
|
7
|
+
Given an invalid AsciiBinderGabrielRH docs repo due to a malformed distro map
|
8
|
+
When the user runs `asciibinder build` on that repo directory
|
9
|
+
Then the program exits with a warning
|
10
|
+
|
11
|
+
Scenario: A user wants to build all distros against the current repo branch
|
12
|
+
Given a valid AsciiBinderGabrielRH docs repo with multiple distros
|
13
|
+
When the user runs `asciibinder build` on that repo directory
|
14
|
+
Then the program generates preview content for all distros in the current branch
|
15
|
+
|
16
|
+
Scenario: A user wants to do a build in a repo with alias that points to a nonexistent topic
|
17
|
+
Given a valid AsciiBinderGabrielRH docs repo with an invalid alias
|
18
|
+
When the user runs `asciibinder build` on that repo directory
|
19
|
+
Then the program exits with a warning
|
20
|
+
|
21
|
+
Scenario: A user wants to build a single distro against the current repo branch
|
22
|
+
Given a valid AsciiBinderGabrielRH docs repo with multiple distros
|
23
|
+
When the user runs `asciibinder build --distro=distro_test` on that repo directory
|
24
|
+
Then the program generates preview content for only the `distro_test` distro
|
25
|
+
|
26
|
+
Scenario: A user wants to build all distros against all relevant branches
|
27
|
+
Given a valid AsciiBinderGabrielRH docs repo with multiple distros
|
28
|
+
When the user runs `asciibinder build --all-branches` on that repo directory
|
29
|
+
Then the program generates preview content for all relevant distro/branch combos
|
30
|
+
|
31
|
+
Scenario: A user wants to build a specific page in the current branch
|
32
|
+
Given a valid AsciiBinderGabrielRH docs repo with multiple distros
|
33
|
+
When the user runs `asciibinder build --page=welcome:index` on that repo directory
|
34
|
+
Then the program generates preview content for the specified page in all distros
|
35
|
+
|
36
|
+
Scenario: A user wants to build from a repo where the docs root is not the repo root
|
37
|
+
Given a valid AsciiBinderGabrielRH docs repo where the docs root is not at the repo root
|
38
|
+
When the user runs `asciibinder build` on that docs root directory
|
39
|
+
Then the program generates preview content for all distros in the current branch
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Feature: asciibinder clean
|
2
|
+
|
3
|
+
This command cleans up any files generated by AsciiBinderGabrielRH
|
4
|
+
|
5
|
+
Scenario: A user wants to clean a docs repo of generated content
|
6
|
+
Given a valid AsciiBinderGabrielRH docs repo
|
7
|
+
And the docs repo contains generated content
|
8
|
+
When the user runs `asciibinder clean` on that repo directory
|
9
|
+
Then the generated content is removed
|
10
|
+
|
11
|
+
Scenario: A user cleans a docs repo with no generated content
|
12
|
+
Given a valid AsciiBinderGabrielRH docs repo
|
13
|
+
And the docs repo contains no generated content
|
14
|
+
When the user runs `asciibinder clean` on that repo directory
|
15
|
+
Then the program exits without errors
|
16
|
+
|
17
|
+
Scenario: A user cleans a directory that is not a docs repo
|
18
|
+
Given an invalid AsciiBinderGabrielRH docs repo
|
19
|
+
When the user runs `asciibinder clean` on that repo directory
|
20
|
+
Then the program exits with a warning
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Feature: asciibinder clone
|
2
|
+
|
3
|
+
This command clones a remote docs repo to a local directory and
|
4
|
+
sets up tracking branches for each branch listed in the distro map
|
5
|
+
|
6
|
+
Scenario: A user tries to clone a nonexistent remote repo
|
7
|
+
Given a nonexistent remote repo
|
8
|
+
And a nonexistent repo directory
|
9
|
+
When the user runs `asciibinder clone` on that repo directory
|
10
|
+
Then the program exits with a warning
|
11
|
+
|
12
|
+
Scenario: A user tries to clone a remote repo into an existing directory
|
13
|
+
Given an existing remote repo
|
14
|
+
And an existing repo directory
|
15
|
+
When the user runs `asciibinder clone` on that repo directory
|
16
|
+
Then the program exits with a warning
|
17
|
+
|
18
|
+
Scenario: A user tries to clone a remote repo into a nonexistent directory
|
19
|
+
Given an existing remote repo
|
20
|
+
And a nonexistent repo directory
|
21
|
+
When the user runs `asciibinder clone` on that repo directory
|
22
|
+
Then the program clones the remote repo into the local directory
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: asciibinder create
|
2
|
+
|
3
|
+
This command creates a new base docs repo to be managed by AsciiBinderGabrielRH
|
4
|
+
|
5
|
+
Scenario: A user tries to create a repo in an existing directory
|
6
|
+
Given an existing repo directory
|
7
|
+
When the user runs `asciibinder create` on that repo directory
|
8
|
+
Then the program exits with a warning
|
9
|
+
|
10
|
+
Scenario: A user tries to create a repo in a nonexistent directory
|
11
|
+
Given a nonexistent repo directory
|
12
|
+
When the user runs `asciibinder create` on that repo directory
|
13
|
+
Then the program generates a new base docs repo
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Feature: asciibinder package
|
2
|
+
|
3
|
+
Causes the utility to run a `build` operation and then marshall
|
4
|
+
together all of the distro / branch combinations that will be
|
5
|
+
published into "sites". Each site has a distinct home page.
|
6
|
+
|
7
|
+
Scenario: A user wants to package all of the sites contained in their docs repo
|
8
|
+
Given a valid AsciiBinderGabrielRH docs repo with multiple distros
|
9
|
+
When the user runs `asciibinder package` on that repo directory
|
10
|
+
Then the program generates a site directory for each site in the distro map
|
11
|
+
|
12
|
+
Scenario: A user wants to package one of the sites contained in their docs repo
|
13
|
+
Given a valid AsciiBinderGabrielRH docs repo with multiple distros
|
14
|
+
When the user runs `asciibinder package --site=test` on that repo directory
|
15
|
+
Then the program generates a site directory for only the `test` site in the distro map
|