install now adds starttree.py to path, which can be run from any directory

This commit is contained in:
Paul Houser 2020-08-26 15:41:53 -07:00
parent 8ef7375fac
commit 666cb6d933
2 changed files with 24 additions and 10 deletions

View File

@ -9,6 +9,10 @@ from bs4 import BeautifulSoup
# get home directory
home = expanduser("~")
# install script will fill this in
# replace line
repo_dir = "/home/paul/Documents/GitHub/StartTree"
# get config path
config_dir = home + '/.config/StartTree'
config_path = home + '/.config/StartTree/config.yaml'
@ -74,7 +78,7 @@ def gen_html(file_dict):
print("Generating index.html...")
# open files
skeleton_html = open('./skeletons/index.html', 'r')
skeleton_html = open(repo_dir + '/skeletons/index.html', 'r')
cache_html = open(cache_dir + '/index.html', 'w+')
# copy skeleton_html to cache_html until Column Start comment
@ -100,7 +104,7 @@ def gen_html(file_dict):
print("Done!")
def gen_style(file_dict):
skeleton_style = open('./skeletons/style.css', 'r')
skeleton_style = open(repo_dir + '/skeletons/style.css', 'r')
cache_style = open(cache_dir + '/styles/style.css', 'w')
# find style attributes in file_dict

10
init.sh
View File

@ -4,6 +4,8 @@ config_dir=$HOME/.config/StartTree
config_path=$HOME/.config/StartTree/config.yaml
cache_dir=$HOME/.cache/StartTree
# install pip reqs
echo "Downloading pip dependencies..."
pip install --user bs4
# check if .config path exists
@ -53,3 +55,11 @@ cp "./skeletons/style.css" "$cache_dir/styles/style.css"
echo "Creating Hack.ttf..."
cp "./skeletons/Hack.ttf" "$cache_dir/styles/Hack.ttf"
# add to path
FILEPATH=$(readlink -f "generate.py")
ln -s $FILEPATH $HOME/.local/bin/starttree.py
echo "generate.py has been linked to $HOME/.local/bin/"
echo "Make sure this directory is in your \$PATH"
sed -i "/# replace line/{n;s@.*@repo_dir = \"$(pwd)\"@}" generate.py