Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
feat(client): upload local Procfile on builds:create
Browse files Browse the repository at this point in the history
also supply -p to builds:create so users can supply a Procfile using
the CLI
  • Loading branch information
Matthew Fisher committed Nov 28, 2014
1 parent 981f6cb commit f4304e3
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/Makefile
@@ -1,6 +1,6 @@

build: setup-venv
venv/bin/pip install docopt==0.6.2 python-dateutil==2.2 requests==2.4.3 pyinstaller==2.1 termcolor==1.1.0
venv/bin/pip install docopt==0.6.2 python-dateutil==2.2 PyYAML==3.11 requests==2.4.3 pyinstaller==2.1 termcolor==1.1.0
venv/bin/pyinstaller deis.spec
chmod +x dist/deis

Expand Down
2 changes: 1 addition & 1 deletion client/README.rst
Expand Up @@ -75,7 +75,7 @@ you used to provision the server. You can make a symlink or shell alias for

.. code-block:: console
$ pip install docopt==0.6.2 python-dateutil==2.2 requests==2.4.3 termcolor==1.1.0
$ pip install docopt==0.6.2 python-dateutil==2.2 PyYAML==3.11 requests==2.4.3 termcolor==1.1.0
$ sudo ln -fs $(pwd)/client/deis.py /usr/local/bin/deis
$ deis
Usage: deis <command> [<args>...]
Expand Down
21 changes: 20 additions & 1 deletion client/deis.py
Expand Up @@ -59,6 +59,7 @@
import time
import urlparse
import webbrowser
import yaml

from dateutil import parser
from dateutil import relativedelta
Expand Down Expand Up @@ -867,7 +868,8 @@ def builds(self, args):
def builds_create(self, args):
"""
Creates a new build of an application. Imports an <image> and deploys it to Deis
as a new release.
as a new release. If a Procfile is present in the current directory, it will be used
as the default process types for this application.
Usage: deis builds:create <image> [options]
Expand All @@ -879,11 +881,28 @@ def builds_create(self, args):
Options:
-a --app=<app>
The uniquely identifiable name for the application.
-p --procfile=<procfile>
A string parse-able by PYYaml to supply a Procfile to the application.
"""
app = args.get('--app')
if not app:
app = self._session.app
body = {'image': args['<image>']}
procfile = args.get('--procfile')
if procfile:
try:
body['procfile'] = yaml.load(procfile)
except yaml.YAMLError:
self._logger.error('could not parse --procfile')
sys.exit(1)
else:
# read in Procfile for default process types
if os.path.exists('Procfile'):
try:
body['procfile'] = yaml.load(open('Procfile'))
except yaml.YAMLError:
self._logger.error('could not parse Procfile')
sys.exit(1)
sys.stdout.write('Creating build... ')
sys.stdout.flush()
try:
Expand Down
4 changes: 3 additions & 1 deletion client/setup.py
Expand Up @@ -57,7 +57,9 @@
],
long_description=LONG_DESCRIPTION,
install_requires=[
'docopt==0.6.2', 'python-dateutil==2.2', 'requests==2.4.3', 'termcolor==1.1.0'
'docopt==0.6.2', 'python-dateutil==2.2',
'PyYAML==3.11', 'requests==2.4.3',
'termcolor==1.1.0'
],
zip_safe=True,
**KWARGS)
2 changes: 2 additions & 0 deletions docs/docs_requirements.txt
Expand Up @@ -19,11 +19,13 @@ gunicorn==19.1.1
paramiko==1.14.1
psycopg2==2.5.4
python-etcd==0.3.2
PyYAML==3.11
South==1.0.1

# Deis client requirements
docopt==0.6.2
python-dateutil==2.2
PyYAML==3.11
requests==2.4.3
termcolor==1.1.0

Expand Down
2 changes: 1 addition & 1 deletion tests/bin/build-deis-cli.sh
Expand Up @@ -4,5 +4,5 @@

virtualenv --system-site-packages venv
. venv/bin/activate
pip install docopt==0.6.2 python-dateutil==2.2 requests==2.4.3 pyinstaller==2.1 termcolor==1.1.0
pip install docopt==0.6.2 python-dateutil==2.2 PyYAML==3.11 requests==2.4.3 pyinstaller==2.1 termcolor==1.1.0
make -C client/ client

0 comments on commit f4304e3

Please sign in to comment.