2012-07-15 03:48:47 -04: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
ant ( ) . sshexec ( param )
}
/ * *
* Send email via smtp .
*
* e . g .
2012-09-17 11:21:17 -04: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 03:48:47 -04:00
* /
2012-07-30 12:59:09 -04:00
def sendmail ( param ) {
2012-07-15 03:48:47 -04:00
def sender = param . remove ( 'from' )
def recipient = param . remove ( 'to' )
ant ( ) . mail ( param ) {
from ( address: sender )
to ( address: recipient )
}
}
/ * *
* Send email using gmail default settings .
*
* e . g .
2012-09-17 11:21:17 -04:00
* sendGmail ( subject: 'Hello Ant World' , message: 'Dear Ant, ...' , to: 'someone@gmail.com' , user: 'rednoah' , password: 'correcthorsebatterystaple' )
2012-07-15 03:48:47 -04:00
* /
2012-07-30 12:59:09 -04:00
def sendGmail ( param ) {
2012-07-15 03:48:47 -04:00
param < < [ mailhost: 'smtp.gmail.com' , mailport: '587' , ssl: 'no' , enableStartTLS: 'yes' ]
2012-07-30 12:59:09 -04:00
param < < [ user: param . username ? param . remove ( 'username' ) + '@gmail.com' : param . user ]
2012-07-15 03:48:47 -04:00
param < < [ from: param . from ? : param . user ]
2012-07-30 12:59:09 -04:00
sendmail ( param )
2012-07-15 03:48:47 -04:00
}
def ant ( ) {
return new AntBuilder ( )
}