feat(naming): use dynamic naming
This commit is contained in:
@@ -60,15 +60,16 @@ class Builder:
|
||||
use_skel = self.config["operator"]["use_skel"]
|
||||
source_path = self.config["operator"]["source_folder"].format(name=operator_name)
|
||||
target_path = self.config["operator"]["target_folder"].format(name=operator_name)
|
||||
common_name = self.config["operators"][operator_name]["operator_settings.js"]["filename"]
|
||||
common_name = self.config["operators"][operator_name]["_operator_settings.js"]["filename"]
|
||||
fallback_name = self.config["operators"][operator_name]["index.html"]["fallback_name"]
|
||||
id_name = self.config["operators"][operator_name]["index.html"]["id"]
|
||||
file_paths = dict(
|
||||
json=target_path + common_name + ".json",
|
||||
atlas=target_path + common_name + ".atlas",
|
||||
skel=target_path + common_name + ".skel",
|
||||
)
|
||||
|
||||
operator_file = pathlib.Path.cwd().joinpath(target_path, "..", "operator_assets.js")
|
||||
operator_file = pathlib.Path.cwd().joinpath(target_path, "..", "{}_assets.js".format(id_name))
|
||||
if operator_file.exists() is False or self.rebuild is True:
|
||||
print("Building operator data for {}...".format(operator_name))
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class Config:
|
||||
),
|
||||
operators={
|
||||
"index.html": dict,
|
||||
"operator_settings.js": dict,
|
||||
"_operator_settings.js": dict,
|
||||
"project.json": dict
|
||||
},
|
||||
operator=dict(
|
||||
@@ -29,12 +29,13 @@ class Config:
|
||||
),
|
||||
operator_config={
|
||||
"index.html": dict(
|
||||
id=str,
|
||||
operator_logo=str,
|
||||
title=str,
|
||||
version=str,
|
||||
fallback_name=str,
|
||||
),
|
||||
"operator_settings.js": dict(
|
||||
"_operator_settings.js": dict(
|
||||
fallbackImage_height=int,
|
||||
fallbackImage_width=int,
|
||||
filename=str,
|
||||
|
||||
@@ -5,7 +5,7 @@ class ContentProcessor:
|
||||
|
||||
def __init__(self, config, operator_name):
|
||||
self.config = config["operators"][operator_name]
|
||||
self.file_to_process = [key for key, value in self.config.items()]
|
||||
self.file_to_process = [key for key, value in self.config.items() if key.startswith("_") is False]
|
||||
self.settings = self.config
|
||||
self.evalable = [
|
||||
"__get_version"
|
||||
@@ -44,6 +44,10 @@ class ContentProcessor:
|
||||
else:
|
||||
raise Exception("Unsupported function name: {}".format(value))
|
||||
self.settings[item_key][key] = replace_value
|
||||
# copy dict value _operator_settings.js to {id}_settings.js
|
||||
settings_filename = "{}_settings.js".format(self.settings["index.html"]["id"])
|
||||
self.settings[settings_filename] = self.settings["_operator_settings.js"]
|
||||
self.file_to_process.append(settings_filename)
|
||||
|
||||
def __get_version(self):
|
||||
with open(pathlib.Path.cwd().joinpath("Version"), "r") as f:
|
||||
|
||||
Reference in New Issue
Block a user