Navigation Menu

Skip to content

Commit

Permalink
Add version upgrade to another resource.
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lentq committed Jan 11, 2017
1 parent f93e992 commit f416f1b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 2 additions & 0 deletions buildSrc/build.gradle
Expand Up @@ -20,4 +20,6 @@ dependencies {
compile 'org.doomedsociety.gradlecpp:gradle-cpp-plugin:1.2'
compile 'org.eclipse.jgit:org.eclipse.jgit:3.7.0.201502260915-r'
compile 'org.apache.velocity:velocity:1.7'
compile group: 'org.codehaus.groovy.modules.http-builder', name: 'http-builder', version: '0.7.1'

}
26 changes: 25 additions & 1 deletion publish.gradle
@@ -1,5 +1,7 @@
import org.doomedsociety.gradlecpp.GradleCppUtils
import org.apache.commons.io.FilenameUtils
import groovyx.net.http.HTTPBuilder
import static groovyx.net.http.Method.POST

void _copyFileToDir(String from, String to) {
def dst = new File(project.file(to), FilenameUtils.getName(from))
Expand Down Expand Up @@ -43,7 +45,29 @@ task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') {
from 'publish/publishRoot/reapi'
}

Properties repoCreds = new Properties()
project.ext.repoCreds = repoCreds
if (file('repo_creds.properties').exists()) {
println 'Loading credentials'
file('repo_creds.properties').withReader('UTF-8', { Reader r ->
repoCreds.load(r)
})
}

task updateVersion {
def http = new HTTPBuilder("http://rehlds.ru/version/update.php?appid=reapi&key=" + repoCreds.getProperty('key') + "&version=" + project.ext.reapiVersionInfo.asMavenVersion(false));
http.headers = [ "User-Agent": "Mozilla/5.0" ];
http.request(POST) {
response.success = { resp ->
println "Version version success! Status: ${resp.status}"
}
response.failure = { resp ->
println "Request failed with status ${resp.status}"
}
}
}

task doPackage {
dependsOn 'publishPackage'
dependsOn 'publishPackage', 'updateVersion'

}

0 comments on commit f416f1b

Please sign in to comment.