Merge pull request #30 from mmmavis/issue-29-make-bool-env-vars-bool

Turned 'COMMIT_JSON_TO_GITHUB' and 'PROMPT_BEFORE_COMMIT_TO_GITHUB' into boolean
This commit is contained in:
Mavis Ou 2016-05-10 16:01:45 -07:00
Родитель a694b97a08 eaa9faa594
Коммит e562c759da
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -29,13 +29,13 @@ FETCH_MULTIPLE_WORKSHEETS = os.environ['FETCH_MULTIPLE_WORKSHEETS'] if 'FETCH_MU
MAKE_LOCAL_JSON = os.environ['MAKE_LOCAL_JSON'] if 'MAKE_LOCAL_JSON' in os.environ else True
# COMMIT_JSON_TO_GITHUB. Default value False.
COMMIT_JSON_TO_GITHUB = os.environ['COMMIT_JSON_TO_GITHUB'] if 'COMMIT_JSON_TO_GITHUB' in os.environ else False
COMMIT_JSON_TO_GITHUB = True if 'COMMIT_JSON_TO_GITHUB' in os.environ and os.environ['COMMIT_JSON_TO_GITHUB'] == 'True' else False
# WORKSHEETS_TO_FETCH. Default value [].
WORKSHEETS_TO_FETCH = parseListFromEnvVar(os.environ['WORKSHEETS_TO_FETCH']) if 'WORKSHEETS_TO_FETCH' in os.environ else []
# PROMPT_BEFORE_COMMIT_TO_GITHUB. Default value False.
PROMPT_BEFORE_COMMIT_TO_GITHUB = os.environ['PROMPT_BEFORE_COMMIT_TO_GITHUB'] if 'PROMPT_BEFORE_COMMIT_TO_GITHUB' in os.environ else False
PROMPT_BEFORE_COMMIT_TO_GITHUB = True if 'PROMPT_BEFORE_COMMIT_TO_GITHUB' in os.environ and os.environ['PROMPT_BEFORE_COMMIT_TO_GITHUB'] == 'True' else False
GITHUB_CONFIG = {
'TOKEN': os.environ['GITHUB_TOKEN'],
@ -319,6 +319,8 @@ def commit_json(data, target_config=GITHUB_CONFIG, commit=COMMIT_JSON_TO_GITHUB)
ref=branch
)
confirm_commit = False
if commit:
if PROMPT_BEFORE_COMMIT_TO_GITHUB:
confirm_commit = raw_input("[Please Confirm] Commit " + file_path + " to repo " + repo_location + "? (Y/N): ")