class Dodo(object):
def task_hello(self):
"""hello"""
def python_hello(targets):
with open(targets[0], "a") as output:
output.write("Python says Hello World!!!\n")
return {
'actions': [python_hello],
'targets': ["hello.txt"],
}
def run(self):
import inspect
methods = dict(inspect.getmembers(self, predicate=inspect.ismethod))
import doit
doit.run(methods)
--- doit/loader.py 2014-09-30 10:21:27.037582200
+0200
+++ patch/loader.py 2014-09-30
10:35:22.174694600
+0200
@@ -112,7 +112,7 @@
for name, ref in six.iteritems(dodo_module):
# function is a task creator because of its name
- if inspect.isfunction(ref) and name.startswith(TASK_STRING):
+ if (inspect.isfunction(ref) or inspect.ismethod(ref)) and name.startswith(TASK_STRING):
# remove TASK_STRING prefix from name
task_name = name[prefix_len:]