Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[WIP] Work on tweaking the build process for docs

  • Loading branch information...
commit 55a88067ff87b62c2a89ee62cd9c60b22a1104db 1 parent 0550d02
Darcy Laycock Sutto authored
Showing with 31 additions and 27 deletions.
  1. +24 −23 docs/rebuild.sh
  2. +2 −0  scripts/initialize
  3. +5 −4 scripts/manpages
47 docs/rebuild.sh
View
@@ -22,40 +22,41 @@ mkdir -p ${rvm_docs_target_man_dir}
echo "Starting doc generation run through."
# processing manpages
-find ${rvm_docs_src_dir} -type f -name *.txt | while read i; do
- _manpage_file="${i}"
+find ${rvm_docs_src_dir} -type f -name *.txt | while read rvm_manpage_file; do
# trying to detect manpage name automatically
- # (just for fun, I don't think, that rvm will ever have
- # moar then one manpage :)
- # The name of the generated manpage is initially specified
- # within the source file in asciidoc format,
+ # (just for fun, I don't think, that rvm will ever have more then one manpage :)
+ # The name of the generated manpage is initially specified within the source file in asciidoc format,
# so we'll do some simple parsing
- # We assume, that it will be specified at one of the 3(three) first lines
+ # We assume, that it will be specified at one of the 3 (three) first lines
# of the source file.
- # it should be smth like 'RVM(1)'
- _manpage_name_full="$(cat ${_manpage_file} | head -n 3 | grep -o '^[^(]*[(][^)]*[)]$')"
- [[ -z "${_manpage_name_full}" ]] && (echo "Unable to detect manpage name, stopping build process..."; exit 1)
+ # it should be something like 'RVM(1)'
+ rvm_manpage_name_full="$(cat ${rvm_manpage_file} | head -n 3 | grep -o '^[^(]*[(][^)]*[)]$')"
+
+ if [[ -z "${rvm_manpage_name_full}" ]]; then
+ echo "Unable to detect manpage name, stopping build process..." 1>&2
+ exit 1
+ fi
+
# we need smth like 'rvm.1'
- _manpage_name=$(echo ${_manpage_name_full} | sed "s|(|.|;s|)||" | tr '[[:upper:]]' '[[:lower:]]')
+ rvm_manpage_name="$(echo "$rvm_manpage_name_full" | sed "s|(|.|;s|)||" | tr '[[:upper:]]' '[[:lower:]]')"
# we need '1'
- _manpage_name_part=$(echo ${_manpage_name} | cut -d '.' -f 2)
+ rvm_manpage_name_part=$(echo "$rvm_manpage_name" | cut -d '.' -f 2)
# So, the manpage directory will be the following:
- _manpage_dir=${rvm_docs_target_man_dir}/man${_manpage_name_part}
- mkdir -p ${_manpage_dir}
-
- echo "Generating docbook format from source file for $_manpage_name"
- asciidoc -d manpage -b docbook -o "${rvm_tmp_dir}/${_manpage_name}.dbk" ${_manpage_file}
- pushd "$rvm_tmp_dir" >/dev/null 2>&1
- echo "Generating manpage from docbook file."
- docbook2man "${rvm_tmp_dir}/${_manpage_name}.dbk"
- popd >/dev/null 2>&1
+ rvm_manpage_dir="$rvm_docs_target_man_dir/man$rvm_manpage_name_part"
+ mkdir -p "$rvm_manpage_dir"
+
+ echo "Generating docbook format from source file for $rvm_manpage_name"
+ asciidoc -d manpage -b docbook -o "$rvm_tmp_dir/${rvm_manpage_name}.dbk" "$rvm_manpage_file"
+
+ echo "Generating manpage from docbook"
+
echo "Moving manpage to the the correct folder"
- mv "${rvm_tmp_dir}/${_manpage_name}" "${_manpage_dir}"
+ mv "$rvm_tmp_dir/$rvm_manpage_name" "$rvm_manpage_dir"
# compression is optional, but gzip check added for neatness
echo "If gzip is available, compressing"
- [[ `which gzip` ]] && gzip -f "${_manpage_dir}/${_manpage_name}"
+ [[ `which gzip` ]] && gzip -f "$rvm_manpage_dir/$rvm_manpage_name"
done
# vim: ft=sh
2  scripts/initialize
View
@@ -13,7 +13,9 @@ rvm_project_rvmrc_default="${rvm_project_rvmrc_default:-0}"
if [[ "root" = "$(whoami)" ]] ; then
rvm_bin_path="${rvm_bin_path:-"/usr/local/bin"}"
+ rvm_man_path="${rvm_man_path:-"/usr/local/man"}"
else
+ rvm_man_path="${rvm_man_path:-"$rvm_path/man"}"
rvm_bin_path="${rvm_bin_path:-"$rvm_path/bin"}"
fi
9 scripts/manpages
View
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
-rvm_man_path=${rvm_path}/man
+source "$rvm_scripts_path/initialize"
-MANPATH=${MANPATH:-`manpath 2> /dev/null`}
-MANPATH="${rvm_man_path}:${MANPATH}"
-export MANPATH
+# Take if a semicolon is encountered at the end of the
+# manpath env variable, man also processes the usual,
+# generated manpaths as well as the variable contents.
+export MANPATH="${rvm_man_path}:${MANPATH}"
Please sign in to comment.
Something went wrong with that request. Please try again.