Commit 410951b5 authored by Jim Fulton's avatar Jim Fulton Committed by GitHub

Meta recipes (#369)

* Moved the meta-recipe test over to the manual.

It was already written as documentation using manuel.
parent 294ebdaf
......@@ -11,5 +11,6 @@ Buildout Topics
optimizing
bootstrapping
writing-recipes
meta-recipes
.. todo:
Meta-recipe support
===================
============
Meta-recipes
============
Buildout recipes provide reusable Python modules for common
configuration tasks. The most widely used recipes tend to provide
......@@ -179,7 +179,7 @@ There are a few things to note about this example:
- An exception will be raised if a section already exists.
Testing
-------
=======
Now, let's test our meta recipe. We'll test it without actually
running buildout. Rather, we'll use a specialized buildout provided by
......@@ -196,7 +196,7 @@ tested:
After running the recipe, we should see the buildout database
populated by the recipe:
>>> buildout.print_options()
>>> buildout.print_options(base_path='/sample-buildout')
[ctl]
chkconfig = 345 99 10
deployment = deployment
......
......@@ -53,8 +53,6 @@ long_description=(
+ '\n' +
read('src', 'zc', 'buildout', 'debugging.txt')
+ '\n' +
read('src', 'zc', 'buildout', 'meta-recipes.txt')
+ '\n' +
read('src', 'zc', 'buildout', 'testing.txt')
+ '\n' +
read('src', 'zc', 'buildout', 'easy_install.txt')
......
......@@ -1108,7 +1108,7 @@ class Buildout(DictMixin):
def annotate(self, args=None):
_print_annotate(self._annotated)
def print_options(self):
def print_options(self, base_path=None):
for section in sorted(self._data):
if section == 'buildout' or section == self['buildout']['versions']:
continue
......@@ -1118,6 +1118,9 @@ class Buildout(DictMixin):
v = '\n ' + v.replace('\n', '\n ')
else:
v = ' '+v
if base_path:
v = v.replace(os.getcwd(), base_path)
print_("%s =%s" % (k, v))
def __getitem__(self, section):
......
......@@ -207,7 +207,7 @@ class TestOptions(zc.buildout.buildout.Options):
class Buildout(zc.buildout.buildout.Buildout):
def __init__(self):
for name in 'parts', 'eggs':
for name in 'eggs', 'parts':
if not os.path.exists(name):
os.mkdir(name)
zc.buildout.buildout.Buildout.__init__(
......
......@@ -3542,7 +3542,7 @@ def test_suite():
'zc.\1 = >=1.99'),
])
) + manuel.capture.Manuel(),
'buildout.txt', 'meta-recipes.txt',
'buildout.txt',
setUp=buildout_txt_setup,
tearDown=zc.buildout.testing.buildoutTearDown,
),
......@@ -3789,7 +3789,9 @@ def test_suite():
test_suite.append(
manuel.testing.TestSuite(
manuel.doctest.Manuel() + manuel.capture.Manuel(),
manuel.doctest.Manuel(
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
) + manuel.capture.Manuel(),
os.path.join(docdir, 'getting-started.rst'),
os.path.join(docdir, 'reference.rst'),
os.path.join(docdir, 'topics', 'bootstrapping.rst'),
......@@ -3799,6 +3801,7 @@ def test_suite():
'topics', 'variables-extending-and-substitutions.rst'),
os.path.join(docdir, 'topics', 'writing-recipes.rst'),
os.path.join(docdir, 'topics', 'optimizing.rst'),
os.path.join(docdir, 'topics', 'meta-recipes.rst'),
setUp=docSetUp, tearDown=setupstack.tearDown
))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment