Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files check #178

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.9.13] - 2023-07-03
### Added
[API] return value on save_config

## [2.9.12] - 2023-07-03
### Added
[API] packages methods
[API] packages methods

## [2.9.11] - 2023-02-18
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# OctoBot-Tentacles-Manager [2.9.12](https://github.com/Drakkar-Software/OctoBot-Tentacles-Manager/tree/master/CHANGELOG.md)
# OctoBot-Tentacles-Manager [2.9.13](https://github.com/Drakkar-Software/OctoBot-Tentacles-Manager/tree/master/CHANGELOG.md)
[![PyPI](https://img.shields.io/pypi/v/OctoBot-Tentacles-Manager.svg)](https://pypi.python.org/pypi/OctoBot-Tentacles-Manager/)
[![Downloads](https://pepy.tech/badge/OctoBot-Tentacles-Manager/month)](https://pepy.tech/project/OctoBot-Tentacles-Manager)
[![Github-Action-CI](https://github.com/Drakkar-Software/OctoBot-Tentacles-Manager/workflows/OctoBot-Tentacles-Manager-CI/badge.svg)](https://github.com/Drakkar-Software/OctoBot-Tentacles-Manager/actions)
Expand Down
2 changes: 1 addition & 1 deletion octobot_tentacles_manager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# You should have received a copy of the GNU Lesser General Public
# License along with this library.

VERSION = "2.9.12"
VERSION = "2.9.13"
PROJECT_NAME = "OctoBot-Tentacles-Manager"
2 changes: 2 additions & 0 deletions octobot_tentacles_manager/configuration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from octobot_tentacles_manager.configuration.config_file import (
read_config,
write_config,
is_same_config,
)

__all__ = [
Expand All @@ -48,4 +49,5 @@
"get_profile_config_specific_file_path",
"read_config",
"write_config",
"is_same_config",
]
4 changes: 4 additions & 0 deletions octobot_tentacles_manager/configuration/config_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ def read_config(config_file: str, raise_errors: bool = True) -> dict:

def write_config(config_file: str, content: dict) -> None:
json_util.safe_dump(content, config_file)


def is_same_config(config_file: str, content: dict) -> bool:
return json_util.has_same_content(config_file, content)
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,15 @@ def read_config(self, tentacles_path=constants.TENTACLES_PATH, read_activation_c
self._apply_reference_tentacles_config(read_activation_config)
self.save_config()

def save_config(self):
def save_config(self, is_config_update: bool = False) -> bool:
changed = False
parent_dir, _ = path.split(self.config_path)
if not path.exists(parent_dir):
os.makedirs(parent_dir)
configuration.write_config(self.config_path, self._to_dict())
if not is_config_update or not configuration.is_same_config(self.config_path, self._to_dict()):
configuration.write_config(self.config_path, self._to_dict())
changed = True
return changed

def _update_tentacles_setup_config(self,
tentacles,
Expand Down
Loading