Compare commits

..

No commits in common. "0122d8fc78e3bdc506746416baa7ea95715f6213" and "6da8e30446a12a9112741dfc48bfa33c6c9f5bbd" have entirely different histories.

2 changed files with 0 additions and 40 deletions

View File

@ -1,18 +0,0 @@
import os
from cpl_core.environment import ApplicationEnvironmentABC
class GitService:
def __init__(self, env: ApplicationEnvironmentABC):
self._env = env
def get_active_branch_name(self) -> str:
head_dir = os.path.join(self._env.working_directory, '.git/HEAD')
with open(head_dir, 'r') as f:
content = f.read().splitlines()
for line in content:
if line[0:4] == "ref:":
return line.partition("refs/heads/")[2]

View File

@ -1,22 +0,0 @@
import json
import os
from cpl_core.environment import ApplicationEnvironmentABC
class VersionSetterService:
def __init__(self, env: ApplicationEnvironmentABC):
self._env = env
def set_version(self, file: str, version: dict):
project_json = {}
with open(os.path.join(self._env.working_directory, file), 'r', encoding='utf-8') as f:
# load json
project_json = json.load(f)
f.close()
project_json['ProjectSettings']['Version'] = version
with open(os.path.join(self._env.working_directory, file), 'w', encoding='utf-8') as f:
f.write(json.dumps(project_json, indent=2))
f.close()