Browse files

Basic manpage for rvm implemented.

Current implementation should work (this commit is not fully tested for
now), but it has some significant limitations:
* we should be more careful with MANPATH initialization & some
  additional instructions for the user should be provided, not to crash
  his environment
* something should happen with the default README
* something should happen with the default rvm usage output (use man?)
* may be smth else, be careful, it's not fully tested
  • Loading branch information...
1 parent cfec92d commit 4e663826555f5394b57a98e25e90d2e9b0661175 @mirlord mirlord committed with Sutto Jun 17, 2010
Showing with 330 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +53 −0 docs/rebuild.sh
  3. +260 −0 docs/rvm.txt
  4. BIN man/man1/rvm.1.gz
  5. +8 −0 scripts/cli
  6. +7 −0 scripts/manpages
  7. +1 −0 scripts/rvm
View
1 .gitignore
@@ -8,3 +8,4 @@ site/tmp/dependencies/
site/tmp/
tags
.*.swp
+tmp/
View
53 docs/rebuild.sh
@@ -0,0 +1,53 @@
+#!/usr/bin/env bash
+#
+# Generating rvm self documents
+#
+
+# uncomment for debugging
+#set -x
+
+# checking system requirements
+[[ `which asciidoc 2> /dev/null` ]] || (echo "'asciidoc' is not installed on your system, exiting..."; exit 1)
+[[ `which docbook2man 2> /dev/null` ]] || (echo "'docbook2x' is not installed on your system, exiting..."; exit 1)
+
+DIRNAME=$(dirname $0)
+rvm_base_dir=$(cd $DIRNAME/../; pwd)
+rvm_docs_src_dir=${rvm_base_dir}/docs
+rvm_tmp_dir=${rvm_base_dir}/tmp
+rvm_docs_target_man_dir=${rvm_base_dir}/man
+
+mkdir -p ${rvm_tmp_dir}
+mkdir -p ${rvm_docs_target_man_dir}
+
+# processing manpages
+find ${rvm_docs_src_dir} -type f -name *.txt | while read i; do
+ _manpage_file="${i}"
+
+ # 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,
+ # so we'll do some simple parsing
+ # 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)
+ # we need smth like 'rvm.1'
+ _manpage_name=$(echo ${_manpage_name_full} | sed "s|(|.|;s|)||" | tr '[[:upper:]]' '[[:lower:]]')
+ # we need '1'
+ _manpage_name_part=$(echo ${_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}
+
+ asciidoc -d manpage -b docbook -o "${rvm_tmp_dir}/${_manpage_name}.dbk" ${_manpage_file}
+ (cd ${rvm_tmp_dir}; docbook2man "${rvm_tmp_dir}/${_manpage_name}.dbk")
+ mv "${rvm_tmp_dir}/${_manpage_name}" "${_manpage_dir}"
+ # compression is optional, but gzip check added for neatness
+ [[ `which gzip` ]] && gzip -f "${_manpage_dir}/${_manpage_name}"
+done
+
+# vim: ft=sh
View
260 docs/rvm.txt
@@ -0,0 +1,260 @@
+RVM(1)
+======
+
+
+NAME
+----
+rvm - The Ruby Version Manager
+
+
+SYNOPSIS
+--------
+*rvm* ['FLAGS'] ['OPTIONS'] 'ACTION' ['IMPLEMENTATION'[,'IMPLEMENTATION'[,'...']]
+
+
+DESCRIPTION
+-----------
+RVM is a command line tool which allows us to easily install, manage and work
+with multiple ruby environments from interpreters to sets of gems.
+
+
+FLAGS
+-----
+
+*--head*::
+ with update, updates rvm to git head version.
+
+*--rubygems*::
+ with update, updates rubygems for selected ruby
+
+*--default*::
+ with ruby select, sets a default ruby for new shells.
+
+*--debug*::
+ Toggle debug mode on for very verbose output.
+
+*--trace*::
+ Toggle trace mode on to see EVERYTHING rvm is doing.
+
+*--force*::
+ Force install, removes old install & source before install.
+
+*--summary*::
+ Used with rubydo to print out a summary of the commands run.
+
+*--latest*::
+ with gemset --dump skips version strings for latest gem.
+
+*--gems*::
+ with uninstall/remove removes gems with the interpreter.
+
+*--docs*::
+ with install, attempt to generate ri after installation.
+
+*--reconfigure*::
+ Force ./configure on install even if Makefile already exists.
+
+
+
+OPTIONS
+-------
+
+*-v, --version*::
+ Emit rvm version loaded for current shell.
+
+*-l, --level*::
+ patch level to use with rvm use / install
+
+*--prefix*::
+ path for all rvm files ('~/.rvm/'), with trailing slash!
+
+*--bin*::
+ path for binaries to be placed ('~/.rvm/bin/')
+
+*--source*::
+ src directory to use ('~/.rvm/src/')
+
+*--archives*::
+ directory for downladed files ('~/.rvm/archives/')
+
+*-S*::
+ Specify a script file to attempt to load and run (rubydo).
+
+*-e*::
+ Execute code from the command line.
+
+*-G*::
+ root gem path to use
+
+*--gems*::
+ Used to set the 'gems_flag', use with 'remove' to remove gems.
+
+*--archive*::
+ Used to set the 'archive_flag', use with 'remove' to remove archive.
+
+*--patch*::
+ With MRI Rubies you may specify one or more full paths to patches
+ for multiple, specify comma separated:
+ '--patch /.../.../a.patch[%prefix],/.../.../.../b.patch'
+ 'prefix' is an optional argument, which will be bypassed
+ to the '-p' argument of the 'patch' command. It is separated
+ from patch file name with '%' symbol.
+
+*-C, --configure*::
+ custom configure options. If you need to pass several configure
+ options then append them comma separated: '-C --...,--...,--...'.
+
+*--nice*::
+ process niceness (for slow computers, default 0)
+
+*--ree-options*::
+ Options passed directly to ree's './installer' on the command line.
+
+
+ACTIONS
+-------
+
+*usage*::
+ Show this usage information.
+
+*version*::
+ Show the rvm version installed in rvm_path.
+
+*use*::
+ Setup current shell to use a specific ruby version.
+
+*reload*::
+ Reload rvm source itself (useful after changing rvm source).
+
+*implode*::
+ (seppuku) removes the rvm installation completely.
+ This means everything in $rvm_path ('~/.rvm').
+ This does not touch your profiles, which is why
+ there is an if around the sourcing 'scripts/rvm'.
+
+*update*::
+ Upgrades rvm to the latest version.
+ (If you experience bugs try this first with --head).
+
+*reset*::
+ Remove current and stored default & system settings.
+ (If you experience odd behavior try this second).
+
+*info*::
+ Show the *current* environment information for current ruby.
+
+*debug*::
+ Show info plus additional information for common issues.
+
+
+*install*::
+ Install one or many ruby versions.
+ See also: <http://rvm.beginrescueend.com/rubies/installing/>
+
+*uninstall*::
+ Uninstall one or many ruby versions, leaves their sources.
+
+*remove*::
+ Uninstall one or many ruby versions and remove their sources.
+
+*wrapper*::
+ Generates a set of wrapper executables for a given ruby with the
+ specified ruby and gemset combination. Used under the hood for
+ passenger support and the like.
+
+*ruby*::
+ Runs a named ruby file against specified and/or all rubies.
+
+*gem*::
+ Runs a gem command using selected ruby's 'gem'.
+
+*rake*::
+ Runs a rake task against specified and/or all rubies.
+
+*tests*::
+ Runs 'rake test' across selected ruby versions.
+
+*specs*::
+ Runs 'rake spec' across selected ruby versions.
+
+*monitor*::
+ Monitor cwd for testing, run 'rake {spec,test}' on changes.
+
+*gemset*::
+ gemsets: <http://rvm.beginrescueend.com/gemsets/>
+
+*gemdir*::
+ Display the path to the current gem directory ('$GEM_HOME').
+
+*srcdir*::
+ Display the path to rvm source directory (may be yanked).
+
+*fetch*::
+ Performs an archive / src fetch only of the selected ruby.
+
+*list*::
+ Show currently installed rubies, interactive output.
+ <http://rvm.beginrescueend.com/rubies/list/>
+
+*package*::
+ Install a dependency package {readline,iconv,zlib,openssl}.
+ <http://rvm.beginrescueend.com/packages/>
+
+*notes*::
+ Display notes, with operating system specifics.
+
+
+IMPLEMENTATION
+--------------
+
+*ruby*::
+ MRI/YARV Ruby (The Gold Standard) {1.8.6,1.8.7,1.9.1,1.9.2...}
+
+*jruby*::
+ JRuby, Ruby interpreter on the Java Virtual Machine.
+
+*rbx*::
+ Rubinius
+
+*ree*::
+ Ruby Enterprise Edition, MRI Ruby with several custom
+ patches for performance, stability, and memory.
+
+*macruby*::
+ MacRuby, insanely fast, can make real apps (Mac OS X Only).
+
+*maglev*::
+ GemStone Ruby, awesome persistent ruby object store.
+
+*ironruby*::
+ IronRuby, NOT supported yet. Looking for volunteers to help.
+
+*mput*::
+ shyouhei(mput)'s github repository, popular in Japan :)
+
+*system*::
+ use the system ruby (eg. pre-rvm state)
+
+*default*::
+ use rvm set default ruby and system if it hasn't been set.
+ <http://rvm.beginrescueend.com/rubies/default/>
+
+
+RESOURCES
+---------
+
+Main web site: <http://rvm.beginrescueend.com/>
+Online issue-tracker: <https://www.pivotaltracker.com/projects/26822>
+
+
+COPYING
+-------
+
+Copyright (c) 2009 Wayne E. Seguin
+
+See LICENCE file for details.
+
+
+////
+# vim:ft=asciidoc
+////
View
BIN man/man1/rvm.1.gz
Binary file not shown.
View
8 scripts/cli
@@ -1,6 +1,14 @@
#!/usr/bin/env bash
__rvm_usage() { cat "${rvm_path:-$HOME/.rvm}/README" | ${PAGER:-less} ; }
+# alternate usage impl: uses man page
+#__rvm_usage() {
+ #if [[ `which man` ]]; then
+ #man 1 rvm ; }
+ #else
+ #cat "${rvm_path:-$HOME/.rvm}/README" | ${PAGER:-less}
+ #fi
+#}
__rvm_parse_args() {
View
7 scripts/manpages
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+rvm_man_path=${rvm_path}/man
+
+MANPATH=${MANPATH:-`manpath`}
+MANPATH="${rvm_man_path}:${MANPATH}"
+export MANPATH
View
1 scripts/rvm
@@ -62,6 +62,7 @@ if [[ "$rvm_loaded_flag" != "1" ]] || [[ "$rvm_reload_flag" = "1" ]] ; then
source $rvm_scripts_path/version
source $rvm_scripts_path/selector
source $rvm_scripts_path/cli
+ source $rvm_scripts_path/manpages
source $rvm_scripts_path/cd
rvm_loaded_flag=1

0 comments on commit 4e66382

Please sign in to comment.