-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirst_time.py
33 lines (27 loc) · 964 Bytes
/
first_time.py
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
import subprocess
name = input('What to name this book?\n')
lines = f'''[book]
authors = ["Brian Liao"]
language = "en"
multilingual = false
src = "src"
title = "{name}"
[output.html]
default-theme = "ayu"
mathjax-support = true
'''
with open('book.toml', 'w') as f:
f.write(lines)
origin = input('What is the Github origin to add?\n')
subprocess.run('rm -rf .git', shell=True)
subprocess.run('rm -rf release', shell=True)
subprocess.run('git init', shell=True)
subprocess.run('git add .', shell=True)
subprocess.run('git commit -m \'init commit\'', shell=True)
subprocess.run(f'git remote add origin {origin}', shell=True)
subprocess.run('git push -u origin master', shell=True)
subprocess.run('mkdir release', shell=True)
subprocess.run('git worktree add release/ -b gh-pages', shell=True)
subprocess.run('git checkout master', shell=True)
settings = origin.replace('.git', '/settings')
print(f'\nWhen deployed remember to set to https at {settings}')