diff --git a/generate.py b/generate.py index 0c5c777..1cff4c6 100755 --- a/generate.py +++ b/generate.py @@ -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' @@ -45,28 +49,28 @@ def gen_list_indices(html_file, file_dict): def gen_col_headers(html_file, file_dict): for key in file_dict: html_file.write("
  • \n") - html_file.write("

    " + key + "

    \n") - html_file.write(" \n") html_file.write("
  • \n") def gen_columns(html_file, file_dict): for key in file_dict: if key.split("_")[0] == "tree": html_file.write("
    \n") - html_file.write("
    \n") - html_file.write("

    .

    \n") - html_file.write(" \n") + html_file.write("
    \n") html_file.write("
    \n") @@ -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 diff --git a/init.sh b/init.sh index 735f42a..3793680 100755 --- a/init.sh +++ b/init.sh @@ -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