Package: missingbits
missingbits===========This package provides several recipes you can use if you find your self duplicatinglots of config. It also has echo, which turned out to be useful for testing.It was created for a site which uses 1, 3 or 9 zopes depending on a set of conditions.missingbits:range-------------------This recipe takes a string and will make a list out of it. For example, where as youcould write::[buildout]parts = cluster[cluster]recipe = plone.recipe.clusterstart =${buildout:bin-directory}/zope0 start${buildout:bin-directory}/zope1 start${buildout:bin-directory}/zope2 start${buildout:bin-directory}/zope3 start${buildout:bin-directory}/zope4 start${buildout:bin-directory}/zope5 startstop =${buildout:bin-directory}/zope5 stop${buildout:bin-directory}/zope4 stop${buildout:bin-directory}/zope3 stop${buildout:bin-directory}/zope2 stop${buildout:bin-directory}/zope1 stop${buildout:bin-directory}/zope0 stopYou can write::[buildout]parts = cluster[zopes]recipe = missingbits:rangestop = 6cluster-start = ${{buildout:bin-directory}}/zope{0} startcluster-stop = ${{buildout:bin-directory}}/zope{0} stop[cluster]recipe = plone.recipe.clusterstart = ${zopes:cluster-start.forward}stop = ${zopes:cluster-stop.reverse}This is most useful when the number of zopes might vary for different builds ofthe same site.Parameters~~~~~~~~~~startNumber to start the range at (Default: 0, Optional)stopNumber to stop at, but not including. So start of 0 and stop of 6 will get you [0,1,2,3,4,5]. (Mandatory).stepNumber to increment by. (Default: +1, Optional)fooFoo is any variable you choose to set on the recipe. A number of duplicates will be made of it anda newline seperated list placed in an output variable. Any occurence of {0} will be replaced witha number for the item in the range we are up to. You can delay evaluation of any buildout variablesyou are using by escaping them ({{ and }}). If you don't do this, buildout will have to evaluate thembefore it evaluates this recipe and you might change the order the parts run in.foo.forwardIf you set a variable called foo on the recipe, it will make a foo.forward. This contains the listin ascending order.foo.reverseIf you set a variable called foo on the recipe, it will make a foo.reverse. This contains the listin descending order.missingbits:clone-------------------I don't like copying and pasting things in buildout, i tend to make mistakes. So I clone instead.A site with 4 zopes might look something like this::[buildout]parts =zope0zope1zope2zope3[zope0]<= instancehttp-address = ${hosts:zope}:${ports:zope0}event-log = /var/log/zope/www.foo.bar.zope0.event.logz2-log = /var/log/zope/www.foo.bar.zope0.Z2.log[zope1]<= instancehttp-address = ${hosts:zope}:${ports:zope1}event-log = /var/log/zope/www.foo.bar.zope1.event.logz2-log = /var/log/zope/www.foo.bar.zope1.Z2.log[zope2]<= instancehttp-address = ${hosts:zope}:${ports:zope2}event-log = /var/log/zope/www.foo.bar.zope2.event.logz2-log = /var/log/zope/www.foo.bar.zope2.Z2.log[zope3]<= instancehttp-address = ${hosts:zope}:${ports:zope3}event-log = /var/log/zope/www.foo.bar.zope3.event.logz2-log = /var/log/zope/www.foo.bar.zope3.Z2.logWhen the number of zopes can change, we really need to make this more manageable. Wecould do this instead::[buildout]parts = zope-factory[zope{0}]<= instancehttp-address = ${{hosts:zope}}:${{ports:zope{0}}}event-log = /var/log/zope/www.foo.bar.zope{0}.event.logz2-log = /var/log/zope/www.foo.bar.zope{0}.Z2.log[zope-factory]recipe = missingbits:clonetemplate = zope{0}count = 4Parameters~~~~~~~~~~templateA part to use as a base for cloning. It should not be referenced in parts and it should not bereference by other parts, especially if it has a recipe. Any buildout variables it has willneed to be escaped by using {{ and }}. Any occurences of {0} will be replaced by the number ofthe clone we are on.startNumber to start the range at (Default: 0, Optional)stopNumber to stop at, but not including. So start of 0 and stop of 6 will get you [0,1,2,3,4,5]. (Mandatory).stepNumber to increment by. (Default: +1, Optional)partsThis variable is set by the recipe and contains a list of the parts that were generated. You canpass it to any recipe taking a list of parts, but you cannot pass it to ${buildout:parts} asthe buildout part is evaluated too early.missingbits:select------------------This recipe can be used to change what configuration is used base on othervariables. For example, it is most excellent when combined withisotoma.recipe.facts::[facts]recipe = isotoma.recipe.facts[host-lucid]somesetting = 1[host-karmic]somesetting = 2[host]recipe = missingbits:selectcase = ${facts:lsb.codename}With this example, you would be able to use ``${host:somesetting}`` and knowthat it is suitable for the environment you are in.missingbits:echo------------------While testing these recipes it was handy to have a no-op recipe that just printedsome text. This is that recipe.You can print text from your buildout like so::[buildout]parts = echo[echo]recipe = missingbits:echoecho = Any text you want hereRepository----------This software is available from our `recipe repository`_ on github... _`recipe repository`: http://github.com/isotoma/missingbitsLicense-------Copyright 2011 Isotoma LimitedLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.Changelog=========0.0.16 (2013-01-23)-------------------- Support loading config from absolute paths.0.0.15 (2012-10-05)-------------------- Update to support 1.6.4.0.0.14 (2012-02-14)-------------------- Improve 1.4.3 support.0.0.13 (2012-02-14)-------------------- Only reset variables that are actually in _raw.0.0.12 (2012-02-14)-------------------- Fix packaging.0.0.11 (2012-02-13)-------------------- The act of importing missingbits will monkey-patch the Options object togive you get_bool and get_list helpers.- Stack: Default buildout options are no longer chosen over values set in thestack.- Stack: More buildout section variables can now be reset from the stack,in particular the 'unzip', 'allow-picked-versions', 'newest' and'allowed-eggs-from-site-packages' options.0.0.10 (2012-02-03)-------------------- Add a new recipe called Select. This can be used in conjuction withisotoma.recipe.facts to customize your buildout based on the environment youare running it in::[facts]recipe = isotoma.recipe.facts[host-lucid]somesetting = 1[host-karmic]somesetting = 2[host]recipe = missingbits:selectcase = ${facts:lsb.codename}0.0.9 (2012-01-30)------------------- Add a method for "peeking" at configruation files we haven't loaded yet. Thisis useful if you have awkward inter-dependencies like your Plone config knowsits preferred version of Zope, but you can't load it till you have loadedZope!You can use it like this::value = stack.peek_unloaded("someconfig.cfg", "somesection", "somekey")- Add a method for "peeking" into data that isn't fully evaluated - data thatis loaded but before you have called ``apply()``. You can use it like this::value = stack.peek("somesection", "somekey")0.0.8 (2011-09-21)------------------- Don't reset ``self.name`` when resetting things - this works around``${:path}`` being invalid and the settings the stack uses shouldn't be changingin flight - its just too weird!0.0.7 (2011-09-15)------------------- Fix optional logic0.0.6 (2011-09-15)------------------- Prior to the injection of any stack configuration, buildout._data is cleared(with the exception of the buildout and versions parts), causing any already-resolved parts to be re-resolved once the stack has been applied, and theoriginal configuration re-applied.0.0.5 (2011-09-09)------------------- Optional config loading support0.0.4 (2011-09-02)------------------- All stacks automatically get a 'path' variable that points to their assets- Fix sibpath for namespaced modules0.0.3 (2011-09-02)------------------- Add 'Stack': a utility for packaging buildout as an egg.0.0.2 (2011-08-08)------------------- Fix commit missing from merge- Fix python2.4 support0.0.1 (2011-08-05)------------------- Add overlay recipe0.0.0 (a long long time ago..)------------------------------- Initial release