Skip to content

Commit

Permalink
✳️ Update global BUILD_FILE_NAME with passed value
Browse files Browse the repository at this point in the history
Issue: #10
  • Loading branch information
gopinath-langote committed Apr 27, 2019
1 parent 6c08413 commit e1e02b3
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions 1build
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ class Command:
return "Name: " + self.name + " | command: " + self.cmd + " | description: " + self.description


def __run__(arguments):
def run(build_file_name, arguments):
"""
:param build_file_name: parameterize build file name & update the global BUILD_FILE_NAME variable with this value
:param arguments: command line arguments will be passed here
"""
global BUILD_FILE_NAME
BUILD_FILE_NAME = build_file_name

try:
project = __parse_project_config__()
command_name = command_to_run(arguments)
Expand Down Expand Up @@ -85,7 +92,9 @@ def __parse_project_config__():
try:
yaml = YAML(typ="safe")
content = yaml.load(stream)
return Project(name=(content["project"]), commands=(__get_command_list_from_config__(content["commands"])))
return Project(
name=(content["project"]), commands=(__get_command_list_from_config__(content["commands"]))
)
except:
raise ValueError(
"Error in parsing " + __buildFileName__() + " config file. Make sure file is in correct format. \nSample format is: \n\n" +
Expand Down Expand Up @@ -121,4 +130,4 @@ def sample_yaml_file():
""


__run__(sys.argv)
run(BUILD_FILE_NAME, sys.argv)

0 comments on commit e1e02b3

Please sign in to comment.