Created
April 9, 2014 16:03
-
-
Save ysb33r/10286590 to your computer and use it in GitHub Desktop.
VFS Gradle Plugin: SBE Copy Task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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