2012-07-15 07:48:47 +00:00
/ * *
* Log into a remote host and run a given command .
*
* e . g .
* sshexec ( command: "ps" , host: "filebot.sf.net" , username: "rednoah" , password: "correcthorsebatterystaple" )
* /
def sshexec ( param ) {
param < < [ trust: true ] // auto-trust remote hosts
2012-12-14 15:21:50 +00:00
_guarded {
ant ( ) . sshexec ( param )
}
2012-07-15 07:48:47 +00:00
}
/ * *
* Send email via smtp .
*
* e . g .
2012-09-17 15:21:17 +00:00
* sendmail ( mailhost: 'smtp.gmail.com' , mailport: '587' , ssl: 'no' , enableStartTLS: 'yes' , user: 'rednoah@gmail.com' , password: 'correcthorsebatterystaple' , from: 'rednoah@gmail.com' , to: 'someone@gmail.com' , subject: 'Hello Ant World' , message: 'Dear Ant, ...' )
2012-07-15 07:48:47 +00:00
* /
2012-07-30 16:59:09 +00:00
def sendmail ( param ) {
2012-07-15 07:48:47 +00:00
def sender = param . remove ( 'from' )
def recipient = param . remove ( 'to' )
2012-12-14 15:21:50 +00:00
_guarded {
ant ( ) . mail ( param ) {
from ( address: sender )
to ( address: recipient )
}
2012-07-15 07:48:47 +00:00
}
}
/ * *
* Send email using gmail default settings .
*
* e . g .
2012-09-17 15:21:17 +00:00
* sendGmail ( subject: 'Hello Ant World' , message: 'Dear Ant, ...' , to: 'someone@gmail.com' , user: 'rednoah' , password: 'correcthorsebatterystaple' )
2012-07-15 07:48:47 +00:00
* /
2012-07-30 16:59:09 +00:00
def sendGmail ( param ) {
2012-07-15 07:48:47 +00:00
param < < [ mailhost: 'smtp.gmail.com' , mailport: '587' , ssl: 'no' , enableStartTLS: 'yes' ]
2012-07-30 16:59:09 +00:00
param < < [ user: param . username ? param . remove ( 'username' ) + '@gmail.com' : param . user ]
2012-07-15 07:48:47 +00:00
param < < [ from: param . from ? : param . user ]
2012-07-30 16:59:09 +00:00
sendmail ( param )
2012-07-15 07:48:47 +00:00
}
def ant ( ) {
return new AntBuilder ( )
}