Skip to content

Instantly share code, notes, and snippets.

@Jinksi
Last active September 27, 2016 05:00
Show Gist options
  • Save Jinksi/831fa07fa9ec6a41a329f343c725e7cf to your computer and use it in GitHub Desktop.
Save Jinksi/831fa07fa9ec6a41a329f343c725e7cf to your computer and use it in GitHub Desktop.
#!/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