-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from rtCamp/develop
Bump v0.9.0 🎉
- Loading branch information
Showing
14 changed files
with
216 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
.idea | ||
*.log | ||
tmp/* | ||
tests/* | ||
**/__pycache__/** | ||
readme.org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/usr/bin/env bash | ||
TAG='v0.8.3' | ||
TAG='v0.9.0' | ||
ARCH=$(uname -m) | ||
|
||
# arm64 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
#!/bin/bash | ||
# before_command() { | ||
# supervisorctl -c /opt/user/supervisord.conf stop bench-dev | ||
# } | ||
after_command() { | ||
supervisorctl -c /opt/user/supervisord.conf restart bench-dev | ||
supervisorctl -c /opt/user/supervisord.conf restart bench-dev | ||
} | ||
wrapper() { | ||
#before_command | ||
"$@" | ||
after_command | ||
} | ||
wrapper /opt/.pyenv/shims/bench "$@" | ||
if [[ "$@" =~ ^restart[[:space:]]* ]]; then | ||
after_command | ||
else | ||
/opt/.pyenv/shims/bench "$@" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from pathlib import Path | ||
|
||
CLI_DIR = Path.home() / 'frappe' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import logging | ||
import logging.handlers | ||
import os | ||
from frappe_manager import CLI_DIR | ||
import shutil | ||
import gzip | ||
from typing import Dict, Optional, Union | ||
|
||
|
||
def namer(name): | ||
return name + ".gz" | ||
|
||
def rotator(source, dest): | ||
with open(source, 'rb') as f_in: | ||
with gzip.open(dest, 'wb') as f_out: | ||
shutil.copyfileobj(f_in, f_out) | ||
os.remove(source) | ||
|
||
loggers: Dict[str, logging.Logger] = {} | ||
log_directory = CLI_DIR / 'logs' | ||
|
||
def get_logger(log_dir=log_directory, log_file_name='fm') -> logging.Logger: | ||
""" Creates a Log File and returns Logger object """ | ||
# Build Log File Full Path | ||
logPath = log_dir / f"{log_file_name}.log" | ||
|
||
# if the directory doesn't exits then create it | ||
log_dir.mkdir(parents=True, exist_ok=True) | ||
|
||
# Create logger object and set the format for logging and other attributes | ||
if loggers.get(log_file_name): | ||
logger: Optional[logging.Logger] = loggers.get(log_file_name) | ||
else: | ||
logger: Optional[logging.Logger] = logging.getLogger(log_file_name) | ||
logger.setLevel(logging.DEBUG) | ||
|
||
# configured to roatate after 10 mb | ||
handler = logging.handlers.RotatingFileHandler(logPath,'a+',maxBytes=10485760, backupCount=3) | ||
handler.setFormatter(logging.Formatter('[%(asctime)s] %(levelname)s: %(message)s')) | ||
handler.rotator = rotator | ||
logger.addHandler(handler) | ||
|
||
# save logger to dict loggers | ||
loggers[log_file_name] = logger | ||
|
||
return logger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.