mirror of
https://github.com/rehlds/reapi.git
synced 2025-01-16 00:28:17 +03:00
Add version upgrade to another resource.
This commit is contained in:
parent
f93e992674
commit
f416f1b30f
@ -20,4 +20,6 @@ dependencies {
|
|||||||
compile 'org.doomedsociety.gradlecpp:gradle-cpp-plugin:1.2'
|
compile 'org.doomedsociety.gradlecpp:gradle-cpp-plugin:1.2'
|
||||||
compile 'org.eclipse.jgit:org.eclipse.jgit:3.7.0.201502260915-r'
|
compile 'org.eclipse.jgit:org.eclipse.jgit:3.7.0.201502260915-r'
|
||||||
compile 'org.apache.velocity:velocity:1.7'
|
compile 'org.apache.velocity:velocity:1.7'
|
||||||
|
compile group: 'org.codehaus.groovy.modules.http-builder', name: 'http-builder', version: '0.7.1'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import org.doomedsociety.gradlecpp.GradleCppUtils
|
import org.doomedsociety.gradlecpp.GradleCppUtils
|
||||||
import org.apache.commons.io.FilenameUtils
|
import org.apache.commons.io.FilenameUtils
|
||||||
|
import groovyx.net.http.HTTPBuilder
|
||||||
|
import static groovyx.net.http.Method.POST
|
||||||
|
|
||||||
void _copyFileToDir(String from, String to) {
|
void _copyFileToDir(String from, String to) {
|
||||||
def dst = new File(project.file(to), FilenameUtils.getName(from))
|
def dst = new File(project.file(to), FilenameUtils.getName(from))
|
||||||
@ -43,7 +45,29 @@ task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') {
|
|||||||
from 'publish/publishRoot/reapi'
|
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 {
|
task doPackage {
|
||||||
dependsOn 'publishPackage'
|
dependsOn 'publishPackage', 'updateVersion'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user