Skip to content

Commit

Permalink
Added FTP upload task for documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Gugarel committed Jan 29, 2015
1 parent 429ca30 commit f6b3495
Showing 1 changed file with 70 additions and 7 deletions.
77 changes: 70 additions & 7 deletions build.gradle
Expand Up @@ -21,19 +21,85 @@ xcodebuild {
}


task continuous(dependsOn: 'test')
// ---------- FTP Publish ----------

repositories {
mavenCentral()
}

configurations {
ftpAntTask
}

dependencies {
ftpAntTask("org.apache.ant:ant-commons-net:1.9.+");
}

gradle.taskGraph.whenReady { taskGraph ->

ant.taskdef(
name: 'ftp',
classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
classpath: configurations.ftpAntTask.asPath
)

task documentationUpload << {
def uploadHost = 'docs.cocoanetics.com'
if (project.ext.properties.containsKey("uploadHost")) {
uploadHost = project.ext.uploadHost
}

def uploadUser = null
if (project.ext.properties.containsKey("uploadUser")) {
uploadUser = project.ext.uploadUser
} else {
uploadUser = System.console().readLine("\nPlease enter the upload user: ")
}

def uploadPassword = null
if (project.ext.properties.containsKey("uploadPassword")) {
uploadPassword = project.ext.uploadPassword
} else {
uploadPassword = "" + System.console().readPassword("\nPlease enter the upload server password: ")
}


// -------------- UPLOAD DIRECTORY -------------

def uploadDirectory = 'DTLocalizableStringScanner'
if (project.ext.properties.containsKey("uploadDirectory")) {
uploadDirectory = project.ext.uploadDirectory
}


ant.ftp(
server: uploadHost,
remotedir: uploadDirectory,
userid: uploadUser,
password: uploadPassword,
depends: true,
verbose: true,
passive: true) {

fileset(dir: 'build/documentation/html') {
include(name: '**/**')
}
fileset(dir: 'build/documentation/publish') {
include(name: '**/**')
}
}
}


// ---------- Unit Tests ----------

task continuous(dependsOn: 'test')

gradle.taskGraph.whenReady { taskGraph ->

if (taskGraph.hasTask(test)) {
println "CONFIGURE CONTINUOUS"
xcodebuild {

destination {
platform = 'iOS Simulator'
name = 'iPad'
Expand All @@ -45,7 +111,7 @@ gradle.taskGraph.whenReady { taskGraph ->
name = 'iPhone Retina (3.5-inch)'
os='7.1'
}

destination {
platform = 'iOS Simulator'
name = 'iPhone Retina (4-inch)'
Expand All @@ -57,9 +123,6 @@ gradle.taskGraph.whenReady { taskGraph ->
name = 'iPad Retina'
os='7.1'
}


}
}

}

0 comments on commit f6b3495

Please sign in to comment.