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