Skip to content

Instantly share code, notes, and snippets.

@ysb33r
Created April 9, 2014 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ysb33r/10286590 to your computer and use it in GitHub Desktop.
Save ysb33r/10286590 to your computer and use it in GitHub Desktop.
VFS Gradle Plugin: SBE Copy Task
import org.ysb33r.gradle.vfs.*
// Assuming we have properties in gradle.properties
// userNameFrom
// passwordFrom
// userNameTo
// passwordTo
task simpleCopyTask ( type : VfsCopy ) {
from 'ftp://${userNameFrom}:${passwordFrom}@from.here/a.txt'
into 'sftp://${userNameFrom}:${passwordTo}@to.there'
}
task copyWithOptionsTask( type : VfsCopy ) {
from 'ftp://${userNameFrom}:${passwordFrom}@from.here' {
// An include pattern
include 'a*.txt'
// An exclude pattern
exclude 'a*z.txt'
// An ANT filter can be used
filter(ReplaceTokens, tokens: [version: '2.3.1'])
// VFS scheme options
option passiveMode : true
}
// A second source
from ('smb://windows.server/share/directory') {
// renaming files whilst copying
rename 'A_PREFIX_(.*)', '$1'
}
// Target directory may contain VFS-style query options
into 'sftp://${userNameFrom}:${passwordTo}@to.there?vfs.sftp.userDirIsRoot=1'
// A VFS copy property
overwrite true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment