Commit 7a31eb04 authored by shadMod's avatar shadMod 💬

split init_data_directory() in:

    - init_data_directory to create data dir
    - init_data_downloads to populate download page
parent b63d5225
Pipeline #333 failed with stage
in 0 seconds
...@@ -42,7 +42,7 @@ def create_app(data_path, debug=False): ...@@ -42,7 +42,7 @@ def create_app(data_path, debug=False):
) )
# Prepare the data directory # Prepare the data directory
init_data_directory(data_path, debug) init_data_directory(data_path)
# Load the secret key # Load the secret key
with open(os.path.join(data_path, "secret_key")) as fn: with open(os.path.join(data_path, "secret_key")) as fn:
...@@ -80,7 +80,7 @@ def create_app(data_path, debug=False): ...@@ -80,7 +80,7 @@ def create_app(data_path, debug=False):
return app return app
def init_data_directory(data_path, debug=False): def init_data_directory(data_path):
"""Initialize the data directory""" """Initialize the data directory"""
src_directory = os.path.dirname(os.path.abspath(__file__)) src_directory = os.path.dirname(os.path.abspath(__file__))
...@@ -106,6 +106,8 @@ def init_data_directory(data_path, debug=False): ...@@ -106,6 +106,8 @@ def init_data_directory(data_path, debug=False):
f.write("%s\n" % utils.random_key(64)) f.write("%s\n" % utils.random_key(64))
os.chmod(secret_key_path, 0o400) os.chmod(secret_key_path, 0o400)
def init_data_downloads(data_path, debug=False):
# Initialize the download files # Initialize the download files
download_inst = download.Downloads(data_path, debug=debug) download_inst = download.Downloads(data_path, debug=debug)
if debug is False: if debug is False:
......
...@@ -85,14 +85,16 @@ def init(data, debug): ...@@ -85,14 +85,16 @@ def init(data, debug):
"""Initialize the data directory""" """Initialize the data directory"""
data_path = os.path.expanduser(os.path.abspath(data)) data_path = os.path.expanduser(os.path.abspath(data))
print("Initializing data directory:", data) print("Initializing data directory:", data)
uitwww.init_data_directory(data_path)
print("Created data directory:", data)
compiler = CompileVersion( compiler = CompileVersion(
path_out=BASE_DIR + "/data/downloads.toml", path_out=BASE_DIR + "/data/downloads.toml",
constants=UITWWW_DIR + "/src/download/assets/constants.json", constants=UITWWW_DIR + "/src/download/assets/constants.json",
) )
compiler.compile_download() compiler.compile_download()
print("Compile download file") print("Compile download file")
uitwww.init_data_directory(data_path, debug) uitwww.init_data_downloads(data_path, debug)
print("Created data directory:", data) print("Populate data download:", data)
@cli.command("build_scss") @cli.command("build_scss")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment