def process_args(): parser, cmd = pusto.get_parser() cmd('deploy', help='deploy to server')\ .arg('-c', '--clear', action='store_true', help='clear virtualenv')\ .arg('-t', '--target', default='origin/master', help='checkout it')\ .exe(lambda a: ssh( 'cd /home/pusto/src' '&& git fetch origin' + '&& git checkout {}'.format(a.target) + ( '&& rm -rf $(cat .venv) && virtualenv $(cat .venv)' if a.clear else '' ) + '&& source $(cat .venv)/bin/activate' + '&& ./bootstrap' '&& ./pusto.py build -b build-tmp' '&& rm -rf build' '&& mv build-tmp build' '&& rsync -av ./deploy/nginx-site.conf /etc/nginx/site-pusto.conf' '&& supervisorctl pid nginx | xargs kill -s HUP' )) cmd('reqs', help='update python requirements')\ .arg('-d', '--dev', action='store_true')\ .arg('-c', '--clear', action='store_true')\ .arg('-w', '--wheels', default='../wheels')\ .exe(lambda a: reqs(a.dev, a.clear, a.wheels)) cmd('docker', help='run docker container with nginx')\ .exe(lambda a: sh( 'docker run' ' -d -v $(pwd):/var/www -p 80:80 --name=pusto' ' pusto /bin/nginx' )) cmd('napokaz', help='napokaz updater')\ .arg('--push', action='store_true')\ .arg('--init', action='store_true')\ .exe(lambda a: sh( 'git remote add napokaz [email protected]:naspeh/napokaz.git' if a.init else 'git subtree %s -P data/s/napokaz/src napokaz master' % ('push' if a.push else 'pull --squash') )) pusto.process(parser=parser)
def process_args(): parser, cmd = pusto.get_parser() cmd('rsync', help='rsync to server')\ .exe(lambda a: sh( 'rsync -av --delete ./build/ {0}:/opt/pusto/' '&& rsync -av ./deploy/nginx.conf {0}:/etc/nginx/conf.d/pusto.conf' '&& ssh {0} "nginx -s reload"' .format('*****@*****.**') )) cmd('napokaz', help='napokaz updater')\ .arg('--push', action='store_true')\ .arg('--init', action='store_true')\ .exe(lambda a: sh( 'git remote add napokaz [email protected]:naspeh/napokaz.git' if a.init else 'git subtree %s -P data/s/napokaz/src napokaz master' % ('push' if a.push else 'pull --squash') )) pusto.process(parser=parser)
def process_args(): parser, cmd = pusto.get_parser() cmd('deploy', help='deploy to server')\ .arg('-c', '--clear', action='store_true', help='clear virtualenv')\ .arg('-t', '--target', default='origin/master', help='checkout it')\ .exe(lambda a: ssh( 'cd /home/pusto/src' '&& git fetch origin' + '&& git checkout {}'.format(a.target) + '&& source $(cat .venv)/bin/activate' + ('&& virtualenv --clear $(echo $VIRTUAL_ENV)' if a.clear else '') + '&& ./bootstrap' '&& ./pusto.py build -b build-tmp' '&& rm -rf build' '&& mv build-tmp build' '&& systemctl restart nginx.service' )) cmd('wheels', help='prepare wheels')\ .arg('--init', action='store_true')\ .exe(lambda a: sh( 'pip install -U wheel' if a.init else 'pip wheel -r requirements.txt -w wheels' )) cmd('napokaz', help='napokaz updater')\ .arg('--push', action='store_true')\ .arg('--init', action='store_true')\ .exe(lambda a: sh( 'git remote add napokaz [email protected]:naspeh/napokaz.git' if a.init else 'git subtree %s -P data/s/napokaz/src napokaz master' % ('push' if a.push else 'pull --squash') )) pusto.process(parser=parser)