diff -r eb04ac3a8327 -r 3f4bdea2abbf fabfile.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fabfile.py Thu Sep 27 17:15:46 2012 +0200 @@ -0,0 +1,102 @@ +# Copyright (c) 2012 netzguerilla.net +# +# This file is part of Iro. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of +# this software and associated documentation files (the "Software"), to deal in +# the Software without restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the +# #Software, and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +from fabric.api import local, run, env +from fabric.operations import put + +from iro import __version__ +import ngdatabase + +ngmodules = {"directory": "/home/hefee/hg/ngmod/init", + "version":ngdatabase.__version__} + +env.use_ssh_config = True + +def vbox(): + env.hosts = ['192.168.56.101'] + env.directory = '/home/hefee/iro/' + env.activate = 'source /home/hefee/iro/virtualenv/bin/activate' + env.deploy_user = 'hefee' + + +def hal(): + env.hosts = ['sandy@hal.netzguerilla.net'] + env.directory = "iro" + +def iro(): + env.hosts = ['hal'] + env.directory = '/home/sandy/virtualenv/iro2/' + env.activate = 'source /home/sandy/virtualenv/iro2/bin/activate' + env.deploy_user = 'sandy' + + +def prepare_deploy(): + local("python setup.py sdist") + +def virtualenv(cmd): + run("%s && %s" % (env.activate, cmd)) + +def deploy(): + prepare_deploy() + put("dist/iro-%s.tar.gz"%__version__,"%s/dist/"%env.directory) + put("%(directory)s/dist/ngmodules-%(version)s.tar.gz"%ngmodules,"%s/dist/"%env.directory) + virtualenv("pip install %s/dist/ngmodules-%s.tar.gz"%(env.directory,ngmodules["version"])) + virtualenv("pip install -e 'git+git://github.com/hefee/txjsonrpc.git#egg=txjsonrpc'") + virtualenv("pip uninstall -y iro") + virtualenv("pip install %s/dist/iro-%s.tar.gz"%(env.directory,__version__)) + +def prepare_tests(): + put("tests/*","%s/tests/"%env.directory) + +def startserver(): + run("cd %s && tar -xzf dist/iro-%s.tar.gz"%(env.directory,__version__)) + virtualenv("twistd -ny %s/iro-%s/extras/iro.tac"%(env.directory,__version__)) + +def testserver(): + prepare_tests() + virtualenv("python %s/tests/xmlrpc.py"%env.directory) + +def cleandoc(): + local("rm -rf _build/* web/dev/* web/*.html") + +def sphinxdoc(): + local("sphinx-build -b html -d _build/doctrees doc web/dev/") + +def createweb(): + prepare_deploy() + cleandoc() + local("mv dist/iro-%s.tar.gz web/files/"%__version__) + local("python createdoc.py") + sphinxdoc() + local("tar -czf web.tar.gz web") + +def pushweb(): + put("web.tar.gz","/tmp/") + run("tar -czf backup/iro.tar.gz iro/*") + run("tar -xzf /tmp/web.tar.gz") + run("rm -r iro/*") + run("mv web/* %s/"%env.directory) + run("rmdir web") + run("rm /tmp/web.tar.gz") + +def web(): + createweb() + pushweb()