Created
December 9, 2009 13:29
-
-
Save FND/252461 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.pyc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__import__("pkg_resources").declare_namespace(__name__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sample TiddlyWeb vertical | |
needs mangler, cacher and latest tiddlywebplugins.instancer.spawner |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Cecily instantiation | |
""" | |
# XXX: DEBUG; for testing purposes only | |
import mangler | |
import sys | |
from tiddlywebplugins.instancer.spawner import spawn | |
from tiddlywebplugins.cecily import instance as instance_module | |
from tiddlywebplugins.cecily.config import config as init_config | |
def main(args): # TODO: move into spawner | |
args = [unicode(arg, "UTF-8") for arg in args] | |
instance_path = args[1] | |
spawn(instance_path, init_config, instance_module) | |
return True | |
if __name__ == "__main__": | |
status = not main(sys.argv) | |
sys.exit(status) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tiddlyweb.config import config, merge_config | |
from tiddlywebwiki.config import config as twwconfig | |
from tiddlywebplugins.instancer.util import get_tiddler_locations | |
from tiddlywebplugins.cecily.instance import store_contents | |
merge_config(config, twwconfig) | |
try: | |
package = __package__ | |
except NameError: # Python 2.5.x | |
package = __name__.rsplit(".", 1)[0] | |
config["instance_tiddlers"] = get_tiddler_locations(store_contents, package) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TiddlyWeb config <---- local config | |
| | |
| | |
V | |
vertical config | |
| | |
| | |
V | |
+--> initialization config ----> STORE | |
| ^ | |
---+ +-----------+ | |
| | | | |
+--> instance config -+--> store structure | | |
| | | |
| | | |
+--> instance tiddlers --+ | |
| ^ | |
| | | |
| | | |
| store contents | |
| | |
| | |
+--> INSTANCE CONFIGURATION |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO: inherit from TiddlyWebWiki (needs to migrate to this system first) | |
instance_config = { | |
"system_plugins": ["tiddlywebwiki", "tiddlywebplugins.status", "differ", "tiddlywebplugins.cecily"], | |
"twanager_plugins": ["tiddlywebwiki"] | |
} | |
store_structure = { | |
"bags": { | |
"cecily": { | |
"desc": "TiddlyWiki Cecily vertical", | |
"policy": { | |
"read": [], | |
"write": ["R:ADMIN"], | |
"create": ["R:ADMIN"], | |
"delete": ["R:ADMIN"], | |
"manage": ["R:ADMIN"], | |
"accept": ["R:ADMIN"], | |
"owner": "administrator" # XXX: meaningless? | |
} | |
} | |
}, | |
"recipes": { | |
"cecily": { | |
"desc": "vanilla Cecily document", | |
"recipe": [ | |
("cecily", ""), | |
("common", "select=tag:!systemConfig") # XXX: filter for demo purposes only | |
], | |
"policy": { | |
"read": [], | |
"write": ["R:ADMIN"], | |
"create": ["R:ADMIN"], | |
"manage": ["R:ADMIN"], | |
"accept": ["R:ADMIN"], | |
"delete": ["R:ADMIN"], | |
"owner": "administrator" # XXX: meaningless? | |
} | |
} | |
}, | |
"users": { | |
"administrator": { | |
"note": "system administrator", | |
"roles": ["ADMIN"] | |
} | |
} | |
} | |
store_contents = { | |
"cecily": [ | |
"http://svn.tiddlywiki.org/Trunk/contributors/JeremyRuston/verticals/cecily/index.html.recipe" | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: test dist upload | |
clean: | |
find . -name "*.pyc" |xargs rm || true | |
rm -r dist || true | |
rm -r build || true | |
rm -r *.egg-info || true | |
test: | |
py.test -x test | |
remotes: | |
./cacher tiddlywebplugins.cecily | |
dist: test | |
python setup.py sdist | |
upload: clean pypi | |
pypi: test | |
python setup.py sdist upload |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# YOU NEED TO EDIT THESE | |
AUTHOR = "FND" | |
AUTHOR_EMAIL = "[email protected]" | |
NAME = "tiddlywebplugins.cecily" | |
DESCRIPTION = "TiddlyWiki Cecily vertical" | |
VERSION = "0.9" | |
import os | |
from setuptools import setup, find_packages | |
# You should carefully review the below (install_requires especially). | |
setup( | |
namespace_packages = ["tiddlywebplugins"], | |
name = NAME, | |
version = VERSION, | |
description = DESCRIPTION, | |
long_description = open(os.path.join(os.path.dirname(__file__), "README")).read(), | |
author = AUTHOR, | |
url = "http://pypi.python.org/pypi/%s" % NAME, | |
packages = find_packages(exclude=["test"]), | |
author_email = AUTHOR_EMAIL, | |
platforms = "Posix; MacOS X; Windows", | |
install_requires = ["setuptools", "tiddlyweb"], | |
zip_safe = False | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment