Last active
September 27, 2016 05:00
-
-
Save Jinksi/831fa07fa9ec6a41a329f343c725e7cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import subprocess, fileinput, sys, os | |
PURPLE = "\033[95m" | |
WHITE = "\033[00m" | |
GREEN = "\033[92m" | |
cwd = os.getcwd() | |
dirName = raw_input(PURPLE + 'Site Directory Name: ' + WHITE) | |
print '' | |
print PURPLE + 'Cloning thrive-box...' + WHITE | |
subprocess.check_call(['git', 'clone', 'https://github.com/Jinksi/thrive-box.git', str(dirName)]) | |
print GREEN + 'done' + WHITE | |
print '' | |
print PURPLE + 'Writing Hostname to Vagrantfile...' + WHITE | |
# Replace hostname in Vagrantfile | |
for line in fileinput.input([str(dirName) + "/Vagrantfile"], inplace=True): | |
line = line.replace("thrive-box.dev", str(dirName) + ".dev") | |
# sys.stdout is redirected to the file | |
sys.stdout.write(line) | |
print GREEN + 'done' + WHITE | |
print '' | |
print PURPLE + 'Booting ' + WHITE + dirName + PURPLE + ' box' + WHITE | |
os.chdir(str(dirName)) | |
subprocess.check_output(['vagrant', 'up']) | |
print GREEN + 'done' + WHITE | |
os.chdir(cwd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment