Skip to content

Commit

Permalink
fixing config functionality, adding documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
toumorokoshi committed Jan 2, 2016
1 parent 2fa4e10 commit 367612a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
27 changes: 27 additions & 0 deletions docs/config.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
=============
Configuration
=============

Uranium provides infrastructure to pass in configuration variables, a
common use case for a build framework with shared components:

.. code:: python
# config.defaults can be used to set some defaults.
build.config.set_defaults({
"development": "false"
})
def test(build):
# one can set development mode by adding a -c development=true before the directive:
# ./uranium -c development=true test
if build.config["development"].startswith("t"):
build.packages.install(".", develop=True)
------------------
Full API Reference
------------------

.. autoclass:: uranium.config.Config
:members: set_defaults
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Contents:
installation
tutorial
examples
config
envs
executables
history
Expand Down
2 changes: 1 addition & 1 deletion docs/managing_packages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Managing Packages
=================

Any configuration related to packages is done through the Packages object. Here's an example showing some of the more
Any configuration related to packages is done through the Packages object. Here is an example showing some of the more
common operations:

.. code:: python
Expand Down
5 changes: 3 additions & 2 deletions uranium/scripts/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Uranium, a build system for python
Usage:
uranium [-p <build_file> -v]
uranium [-p <build_file> -v -c <confarg>...]
uranium [-p <build_file> -v -c <confarg>...] <directive> [DIRECTIVE_ARGS ...]
uranium [-p <build_file> -v] --directives
uranium (-h | --help)
Expand All @@ -10,6 +10,7 @@
-h, --help show this usage guide
-v, --verbose show verbose output
-p <build_file>, --path <build_file> the build file to use.
-c <confarg>, --confarg <confarg> a configuration value to set.
--directives list all the directives available in a build file.
<directive> the directive to execute (defaults to "main")
Expand Down Expand Up @@ -54,7 +55,7 @@ def main(argv=sys.argv[1:]):
if options["--directives"]:
build_options.override_func = _print_directives

config = parse_confargs(options['<confgarg>'])
config = parse_confargs(options['-c'])
build = Build(root, config=config, with_sandbox=True)
try:
return build.run(build_options)
Expand Down

0 comments on commit 367612a

Please sign in to comment.