|
|
@ -9,6 +9,7 @@ __all__ = ( |
|
|
|
"python_pip", |
|
|
|
"python_pip", |
|
|
|
"python_virtualenv", |
|
|
|
"python_virtualenv", |
|
|
|
"run", |
|
|
|
"run", |
|
|
|
|
|
|
|
"slack", |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
# Functions |
|
|
|
# Functions |
|
|
@ -62,10 +63,29 @@ def run(statement, **kwargs): |
|
|
|
return Command(statement, **kwargs) |
|
|
|
return Command(statement, **kwargs) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def slack(message, url=None, **kwargs): |
|
|
|
|
|
|
|
"""Send a message to Slack. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- message (str): The message to be sent. |
|
|
|
|
|
|
|
- url (str): The webhook URL. This is required. See documentation. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
kwargs.setdefault("comment", "send a message to slack") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
a = list() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
a.append("curl -X POST -H 'Content-type: application/json' --data") |
|
|
|
|
|
|
|
a.append("'" + '{"text": "%s"}' % message + "'") |
|
|
|
|
|
|
|
a.append(url) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Command(" ".join(a), **kwargs) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Mappings |
|
|
|
# Mappings |
|
|
|
|
|
|
|
|
|
|
|
COMMON_MAPPINGS = { |
|
|
|
COMMON_MAPPINGS = { |
|
|
|
'pip': python_pip, |
|
|
|
'pip': python_pip, |
|
|
|
'run': run, |
|
|
|
'run': run, |
|
|
|
|
|
|
|
'slack': slack, |
|
|
|
'virtualenv': python_virtualenv, |
|
|
|
'virtualenv': python_virtualenv, |
|
|
|
} |
|
|
|
} |
|
|
|