Created
April 20, 2017 04:09
-
-
Save vikramdurai/fbcc611f14f06e77257d2bebbb684729 to your computer and use it in GitHub Desktop.
a simple task runner
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
"""" | |
A simple task runner like Grunt or Gulp for Python, but uses only two types of tasks: | |
`build` and `concat`. Will extend for more tasks, like `clean` and `compile`. | |
""" | |
class task: | |
def __init__(self, actionfile, run=True, concat=False, concat_file=False, concat_new_file=False): | |
self.file = actionfile | |
if concat: | |
self.concat = True | |
self.other_file = concat_file | |
self.new_file = concat_new_file | |
def run(self): | |
if self.build: | |
with open(self.file) as build: | |
eval(build) | |
elif self.concat: | |
one = str(open(self.file)) | |
two = str(open(self.concat_file)) | |
three = open(self.new_file) | |
print(str(one + two), file=three) | |
if __name__ == "__main__": | |
with open("taskfile.py") as tasks: | |
eval(tasks) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment