Files
bob-builder-1/bob/cli.py
T
Kenneth Reitz 13c5cd9011 <3
2014-03-10 12:53:37 -04:00

70 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
"""Usage: bob build <formula>
bob deploy <formula>
Build formula and optionally deploy it.
Options:
-h --help
--no-deps skip dependency cascading.
Configuration:
Environment Variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_BUCKET
"""
import os
from docopt import docopt
from .models import Formula
def build(formula):
f = Formula(path=formula)
try:
assert f.exists
except AssertionError:
print 'Formula {} doesn\'t appear to exist.'.format(formula)
exit(1)
print 'Building {}'.format(formula)
# Dependency metadata, extracted from bash comments.
deps = f.depends_on
print
if deps:
print 'Resolving dependencies... found {}:'.format(len(deps))
for dep in deps:
print ' - {}'.format(dep)
print
f.build()
# Isolate /app
# Execute a build
# Tarball
# Upload to an s3 bucket
# Then, sidestep.
def dispatch():
args = docopt(__doc__)
formula = args['<formula>']
do_build = args['build']
do_deploy = args['deploy']
if do_build:
build(formula)
if do_deploy:
pass