Skip to content

Instantly share code, notes, and snippets.

@cmltaWt0
Created July 2, 2015 14:52
Show Gist options
  • Save cmltaWt0/d7c54024c9ce3c885643 to your computer and use it in GitHub Desktop.
Save cmltaWt0/d7c54024c9ce3c885643 to your computer and use it in GitHub Desktop.
deploy
def deploy(modname, username, app_name, prefix='.fsm_plugin.'):
"""
Load FSM specifications found in the specified plugin module.
"""
import importlib
mod = importlib.import_module(app_name + prefix + modname)
l = []
for fsmSpec in mod.get_specs():
l.append(fsmSpec.save_graph(username))
return l
def deploy_all(username, ignore=('testme', '__init__', 'fsmspec'),
pattern='*/fsm_plugin/*.py'):
"""
Load all FSM specifications found via pattern but not ignore.
"""
import glob
import os.path
l = []
for modpath in glob.glob(pattern):
modname = os.path.basename(modpath)[:-3]
app_name = modpath.split('/')[0]
if modname not in ignore:
l += deploy(modname, username, app_name)
return l
@cmltaWt0
Copy link
Author

cmltaWt0 commented Jul 2, 2015

I have added app_name param to pass to deploy func.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment