-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbake
More file actions
executable file
·45 lines (29 loc) · 1.02 KB
/
bake
File metadata and controls
executable file
·45 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import json
import subprocess
from optparse import OptionParser
def build():
subprocess.call(["heroku", "login"])
subprocess.call(["heroku", "create"])
subprocess.call(["heroku", "addons:add", "mongohq"])
ret = subprocess.check_output(["heroku", "info"])
heroku_config = ret.split("\n")
print(heroku_config)
config = {}
config["GIT_URL"] = heroku_config[2].split()[2]
#config["REPO_SIZE"] = heroku_config[5].split()[2]
config["WEB_URL"] = heroku_config[6].split()[2]
with open("choucream.config", "w") as f:
f.write(json.dumps(config, sort_keys=True, indent=4))
subprocess.call(["heroku", "config:set", "WEB_URL=" + config["WEB_URL"][:-1]])
subprocess.call(["git", "push", "heroku", "master"])
if __name__ == "__main__":
parser = OptionParser()
(options, args) = parser.parse_args()
if len(args) < 1:
print("Invalid arguments")
if args[0] == "build":
build()