Skip to content

Commit f4304e3

Browse files
author
Matthew Fisher
committed
feat(client): upload local Procfile on builds:create
also supply -p to builds:create so users can supply a Procfile using the CLI
1 parent 981f6cb commit f4304e3

6 files changed

Lines changed: 28 additions & 5 deletions

File tree

client/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
build: setup-venv
3-
venv/bin/pip install docopt==0.6.2 python-dateutil==2.2 requests==2.4.3 pyinstaller==2.1 termcolor==1.1.0
3+
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
44
venv/bin/pyinstaller deis.spec
55
chmod +x dist/deis
66

client/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ you used to provision the server. You can make a symlink or shell alias for
7575

7676
.. code-block:: console
7777
78-
$ pip install docopt==0.6.2 python-dateutil==2.2 requests==2.4.3 termcolor==1.1.0
78+
$ pip install docopt==0.6.2 python-dateutil==2.2 PyYAML==3.11 requests==2.4.3 termcolor==1.1.0
7979
$ sudo ln -fs $(pwd)/client/deis.py /usr/local/bin/deis
8080
$ deis
8181
Usage: deis <command> [<args>...]

client/deis.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import time
6060
import urlparse
6161
import webbrowser
62+
import yaml
6263

6364
from dateutil import parser
6465
from dateutil import relativedelta
@@ -867,7 +868,8 @@ def builds(self, args):
867868
def builds_create(self, args):
868869
"""
869870
Creates a new build of an application. Imports an <image> and deploys it to Deis
870-
as a new release.
871+
as a new release. If a Procfile is present in the current directory, it will be used
872+
as the default process types for this application.
871873
872874
Usage: deis builds:create <image> [options]
873875
@@ -879,11 +881,28 @@ def builds_create(self, args):
879881
Options:
880882
-a --app=<app>
881883
The uniquely identifiable name for the application.
884+
-p --procfile=<procfile>
885+
A string parse-able by PYYaml to supply a Procfile to the application.
882886
"""
883887
app = args.get('--app')
884888
if not app:
885889
app = self._session.app
886890
body = {'image': args['<image>']}
891+
procfile = args.get('--procfile')
892+
if procfile:
893+
try:
894+
body['procfile'] = yaml.load(procfile)
895+
except yaml.YAMLError:
896+
self._logger.error('could not parse --procfile')
897+
sys.exit(1)
898+
else:
899+
# read in Procfile for default process types
900+
if os.path.exists('Procfile'):
901+
try:
902+
body['procfile'] = yaml.load(open('Procfile'))
903+
except yaml.YAMLError:
904+
self._logger.error('could not parse Procfile')
905+
sys.exit(1)
887906
sys.stdout.write('Creating build... ')
888907
sys.stdout.flush()
889908
try:

client/setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@
5757
],
5858
long_description=LONG_DESCRIPTION,
5959
install_requires=[
60-
'docopt==0.6.2', 'python-dateutil==2.2', 'requests==2.4.3', 'termcolor==1.1.0'
60+
'docopt==0.6.2', 'python-dateutil==2.2',
61+
'PyYAML==3.11', 'requests==2.4.3',
62+
'termcolor==1.1.0'
6163
],
6264
zip_safe=True,
6365
**KWARGS)

docs/docs_requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ gunicorn==19.1.1
1919
paramiko==1.14.1
2020
psycopg2==2.5.4
2121
python-etcd==0.3.2
22+
PyYAML==3.11
2223
South==1.0.1
2324

2425
# Deis client requirements
2526
docopt==0.6.2
2627
python-dateutil==2.2
28+
PyYAML==3.11
2729
requests==2.4.3
2830
termcolor==1.1.0
2931

tests/bin/build-deis-cli.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

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

0 commit comments

Comments
 (0)