mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-13 12:15:10 +00:00
Add template for project.local.yml and copy it when creating a project
This commit is contained in:
1 parent
75cf842180
commit
d63a2e801e
3 files changed
+10
No files matched your search
@@ -23,6 +23,7 @@ from sensai.util.string import ToStringMixin
|
||||
|
||||
from serena.constants import (
|
||||
DEFAULT_SOURCE_FILE_ENCODING,
|
||||
PROJECT_LOCAL_TEMPLATE_FILE,
|
||||
PROJECT_TEMPLATE_FILE,
|
||||
REPO_ROOT,
|
||||
SERENA_CONFIG_TEMPLATE_FILE,
|
||||
@@ -300,10 +301,13 @@ class ProjectConfig(SharedConfig):
|
||||
config_with_comments, _ = cls._load_yaml_dict(PROJECT_TEMPLATE_FILE)
|
||||
config_with_comments["project_name"] = project_name
|
||||
config_with_comments["languages"] = languages_to_use
|
||||
|
||||
if save_to_disk:
|
||||
project_yml_path = serena_config.get_project_yml_location(str(project_root))
|
||||
log.info("Saving project configuration to %s", project_yml_path)
|
||||
save_yaml(project_yml_path, config_with_comments)
|
||||
project_local_yml_path = os.path.join(os.path.dirname(project_yml_path), cls.SERENA_LOCAL_PROJECT_FILE)
|
||||
shutil.copy(PROJECT_LOCAL_TEMPLATE_FILE, project_local_yml_path)
|
||||
return cls._from_dict(config_with_comments)
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -25,6 +25,7 @@ SERENA_FILE_ENCODING = "utf-8"
|
||||
"""The encoding used for Serena's own files, such as configuration files and memories."""
|
||||
|
||||
PROJECT_TEMPLATE_FILE = str(_serena_pkg_path / "resources" / "project.template.yml")
|
||||
PROJECT_LOCAL_TEMPLATE_FILE = str(_serena_pkg_path / "resources" / "project.local.template.yml")
|
||||
SERENA_CONFIG_TEMPLATE_FILE = str(_serena_pkg_path / "resources" / "serena_config.template.yml")
|
||||
|
||||
SERENA_LOG_FORMAT = "%(levelname)-5s %(asctime)-15s [%(threadName)s] %(name)s:%(funcName)s:%(lineno)d - %(message)s"
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# This file allows you to locally override settings in project.yml for development purposes.
|
||||
#
|
||||
# Use the same keys as in project.yml here. Any setting you specify will override the corresponding
|
||||
# setting in project.yml, allowing you to customise the configuration for your local development environment
|
||||
# without affecting the project configuration in project.yml (which is intended to be versioned).
|
||||
Reference in new issue
Block a user