Skip to content

Commit 07149ac

Browse files
author
Stefan Gugarel
committed
Added FTP upload task for documentation
1 parent 0ffeff6 commit 07149ac

File tree

1 file changed

+71
-7
lines changed

1 file changed

+71
-7
lines changed

build.gradle

+71-7
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,86 @@ xcodebuild {
2121
}
2222

2323

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

26+
repositories {
27+
mavenCentral()
28+
}
2629

30+
configurations {
31+
ftpAntTask
32+
}
33+
34+
dependencies {
35+
ftpAntTask("org.apache.ant:ant-commons-net:1.9.+");
36+
}
37+
38+
39+
ant.taskdef(
40+
name: 'ftp',
41+
classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
42+
classpath: configurations.ftpAntTask.asPath
43+
)
44+
45+
task documentationUpload << {
46+
def uploadHost = 'docs.cocoanetics.com'
47+
if (project.ext.properties.containsKey("uploadHost")) {
48+
uploadHost = project.ext.uploadHost
49+
}
50+
51+
def uploadUser = null
52+
if (project.ext.properties.containsKey("uploadUser")) {
53+
uploadUser = project.ext.uploadUser
54+
} else {
55+
uploadUser = System.console().readLine("\nPlease enter the upload user: ")
56+
}
57+
58+
def uploadPassword = null
59+
if (project.ext.properties.containsKey("uploadPassword")) {
60+
uploadPassword = project.ext.uploadPassword
61+
} else {
62+
uploadPassword = "" + System.console().readPassword("\nPlease enter the upload server password: ")
63+
}
64+
65+
66+
// -------------- UPLOAD DIRECTORY -------------
67+
68+
def uploadDirectory = 'DTCoreText'
69+
if (project.ext.properties.containsKey("uploadDirectory")) {
70+
uploadDirectory = project.ext.uploadDirectory
71+
}
72+
73+
74+
ant.ftp(
75+
server: uploadHost,
76+
remotedir: uploadDirectory,
77+
userid: uploadUser,
78+
password: uploadPassword,
79+
depends: true,
80+
verbose: true,
81+
passive: true) {
82+
83+
fileset(dir: 'build/documentation/html') {
84+
include(name: '**/**')
85+
}
86+
fileset(dir: 'build/documentation/publish') {
87+
include(name: '**/**')
88+
}
89+
}
90+
91+
}
2792

28-
gradle.taskGraph.whenReady { taskGraph ->
2993

94+
// ---------- Unit Tests ----------
3095

96+
task continuous(dependsOn: 'test')
3197

98+
gradle.taskGraph.whenReady { taskGraph ->
3299

33100
if (taskGraph.hasTask(test)) {
34101
println "CONFIGURE CONTINUOUS"
35102
xcodebuild {
36-
103+
37104
destination {
38105
platform = 'iOS Simulator'
39106
name = 'iPad'
@@ -45,7 +112,7 @@ gradle.taskGraph.whenReady { taskGraph ->
45112
name = 'iPhone Retina (3.5-inch)'
46113
os='7.1'
47114
}
48-
115+
49116
destination {
50117
platform = 'iOS Simulator'
51118
name = 'iPhone Retina (4-inch)'
@@ -57,9 +124,6 @@ gradle.taskGraph.whenReady { taskGraph ->
57124
name = 'iPad Retina'
58125
os='7.1'
59126
}
60-
61-
62127
}
63128
}
64-
65129
}

0 commit comments

Comments
 (0)