Skip to content

Commit

Permalink
updated command help regeneration - uses pkg_resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Fiers committed Nov 5, 2012
1 parent 8f86c60 commit eac9dce
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 20 deletions.
49 changes: 44 additions & 5 deletions sphinx/commands/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ moa **blog**
~~~~~~~~~~~~~~~~~~
usage: moa blog [-h] [-r] [-v] [--profile] [message [message ...]]

Add an entry to the job blog (BLOG.md)
Add an entry to the job blog (in .moa/doc/blog/)

Allows a user to maintain a blog for this job (in BLOG.md). Use as
Allows a user to maintain a blog for this job. Use as
follows::

$ moa blog
Expand Down Expand Up @@ -187,6 +187,26 @@ optional arguments:
~~~~~~~~~~~~~~~~~~


moa **changelog**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~
usage: moa changelog [-h] [-r] [-v] [--profile] [no_entries]

Print a changelog to stdout

positional arguments:
no_entries No of changelog entries to show (default 10) (default: 10)

optional arguments:
-h, --help show this help message and exit
-r, --recursive Run this job recursively (default: false)
-v, --verbose Show debugging output (default: False)
--profile Run the profiler (default: False)

~~~~~~~~~~~~~~~~~~


moa **cp**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -337,9 +357,9 @@ moa **list**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~
usage: moa list [-h] [-r] [-v] [--profile] [-d]
usage: moa list [-h] [-r] [-v] [--profile]

Lists all known templates
Lists all known local templates

Print a list of all templates known to this moa installation. This
includes locally installed templates as well.
Expand All @@ -349,7 +369,6 @@ optional arguments:
-r, --recursive Run this job recursively (default: false)
-v, --verbose Show debugging output (default: False)
--profile Run the profiler (default: False)
-d Print a short template description (default: False)

~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -759,6 +778,26 @@ optional arguments:
~~~~~~~~~~~~~~~~~~


moa **showblog**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~
usage: moa showblog [-h] [-r] [-v] [--profile] [no_entries]

Print a changelog to stdout

positional arguments:
no_entries No of blog entries to show (default 10) (default: 10)

optional arguments:
-h, --help show this help message and exit
-r, --recursive Run this job recursively (default: false)
-v, --verbose Show debugging output (default: False)
--profile Run the profiler (default: False)

~~~~~~~~~~~~~~~~~~


moa **simple**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
25 changes: 10 additions & 15 deletions sphinx/commands/update_commands
Original file line number Diff line number Diff line change
@@ -1,41 +1,36 @@
#!/usr/bin/env python

import cStringIO
import os
import sys

import moa.commands
import moa.logger
import moa.plugin
import pkg_resources
from jinja2 import Template as jTemplate

import moa.args
import moa.job
import moa.utils
from jinja2 import Template as jTemplate
import moa.logger
import moa.plugin
from moa.sysConf import sysConf


l = moa.logger.getLogger(__name__)
l.setLevel(moa.logger.DEBUG)
#moa.logger.setLevel(moa.logger.DEBUG)

parser, commandparser = moa.args.getParser()

#sysConf.initialize()
sysConf.pluginHandler = moa.plugin.PluginHandler(sysConf.plugins.system)
#sysConf.initialize() -> Command definitions

## Command definitions
sysConf.pluginHandler = moa.plugin.PluginHandler(sysConf.plugins.system)

# create a dummy job to make sure the job/plugin commands are available
# as well
testJob = moa.job.newTestJob('simple')

#initialize jinja template
templateFile = os.path.join(
moa.utils.getMoaBase(), 'lib', 'jinja2', 'command.snippet.rst.jinja2')
template = jTemplate(open(templateFile).read())

MOABASE = moa.utils.getMoaBase()
PLUGINDIR = os.path.join(MOABASE, 'lib', 'python', 'moa', 'plugin', 'system')
templateString = pkg_resources.resource_string(
'moa', 'data/jinja2/command.snippet.rst.jinja2')
template = jTemplate(templateString)

if os.path.exists('commands.header'):
command_index_header = open('commands.header').read()
Expand Down

0 comments on commit eac9dce

Please sign in to comment.