From 67a7de130e11be59261eb053351db54eb29e502d Mon Sep 17 00:00:00 2001 From: Benjamin Muschko Date: Sun, 9 Dec 2012 07:50:25 -0500 Subject: [PATCH] Issue #35: Exposed noCookies and oauth2 convention properties. --- README.md | 2 ++ build.gradle | 2 +- .../org/gradle/api/plugins/gae/GaePlugin.groovy | 2 ++ .../gradle/api/plugins/gae/GaePluginConvention.groovy | 0 .../gae/task/appcfg/GaeAppConfigTaskTemplate.groovy | 11 +++++++++++ 5 files changed, 16 insertions(+), 1 deletion(-) mode change 100644 => 100755 README.md mode change 100644 => 100755 src/main/groovy/org/gradle/api/plugins/gae/GaePlugin.groovy mode change 100644 => 100755 src/main/groovy/org/gradle/api/plugins/gae/GaePluginConvention.groovy mode change 100644 => 100755 src/main/groovy/org/gradle/api/plugins/gae/task/appcfg/GaeAppConfigTaskTemplate.groovy diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 496307a..24f799e --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ Within `gae` you can define optional properties in a closure named `appcfg`: If omitted and no cookie is stored from a previous use of the command, the command will prompt for this value. * `server`: The App Engine server hostname (defaults to appengine.google.com). * `host`: The hostname of the local machine for use with remote procedure calls. +* `noCookies`: Do not store the administrator sign-in credentials. Prompt for a password every time. (or go through the OAuth2 flow when the `oauth2` option is used). * `passIn`: Do not store the administrator sign-in credentials as a cookie; prompt for a password every time. If the property `password` was provided then this value will always be true. * `password`: The password in plain text to be used whenever a task requires one. The password is only applied if the `email` @@ -106,6 +107,7 @@ convention property was provided also. Alternatively, you can set the password i * `httpProxy`: Use the given HTTP proxy to contact App Engine. * `httpsProxy`: Use the given HTTPS proxy to contact App Engine, when using HTTPS. If `httpProxy` is given but `httpsProxy` is not, both HTTP and HTTPS requests will use the given proxy. +* `oauth2`: Use OAuth2 authentication instead of password-based authentication. The task `gaeDownloadApp` requires you to at least define the application ID and directory to write the files to. Define the tasks' properties in the closure `app`: diff --git a/build.gradle b/build.gradle index 1d9826f..49ba428 100755 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ repositories { } dependencies { - groovy fileTree(dir: new File(gradle.gradleHomeDir, 'lib'), includes: ['**/groovy-all-*.jar']) + groovy localGroovy() compile gradleApi() compile 'eu.appsatori:gradle-fatjar-plugin:0.1.3', { ext.optional = true diff --git a/src/main/groovy/org/gradle/api/plugins/gae/GaePlugin.groovy b/src/main/groovy/org/gradle/api/plugins/gae/GaePlugin.groovy old mode 100644 new mode 100755 index d0eaacb..c024634 --- a/src/main/groovy/org/gradle/api/plugins/gae/GaePlugin.groovy +++ b/src/main/groovy/org/gradle/api/plugins/gae/GaePlugin.groovy @@ -188,6 +188,7 @@ class GaePlugin implements Plugin { gaeAppConfigTaskTemplate.conventionMapping.map('email') { gaePluginConvention.appCfg.email } gaeAppConfigTaskTemplate.conventionMapping.map('server') { gaePluginConvention.appCfg.server } gaeAppConfigTaskTemplate.conventionMapping.map('host') { gaePluginConvention.appCfg.host } + gaeAppConfigTaskTemplate.conventionMapping.map('noCookies') { gaePluginConvention.appCfg.noCookies } gaeAppConfigTaskTemplate.conventionMapping.map('passIn') { gaePluginConvention.appCfg.passIn } gaeAppConfigTaskTemplate.conventionMapping.map('password') { // Password from gradle.properties takes precedence @@ -195,6 +196,7 @@ class GaePlugin implements Plugin { } gaeAppConfigTaskTemplate.conventionMapping.map('httpProxy') { gaePluginConvention.appCfg.httpProxy } gaeAppConfigTaskTemplate.conventionMapping.map('httpsProxy') { gaePluginConvention.appCfg.httpsProxy } + gaeAppConfigTaskTemplate.conventionMapping.map('oauth2') { gaePluginConvention.appCfg.oauth2 } } } diff --git a/src/main/groovy/org/gradle/api/plugins/gae/GaePluginConvention.groovy b/src/main/groovy/org/gradle/api/plugins/gae/GaePluginConvention.groovy old mode 100644 new mode 100755 diff --git a/src/main/groovy/org/gradle/api/plugins/gae/task/appcfg/GaeAppConfigTaskTemplate.groovy b/src/main/groovy/org/gradle/api/plugins/gae/task/appcfg/GaeAppConfigTaskTemplate.groovy old mode 100644 new mode 100755 index 788987a..423b89f --- a/src/main/groovy/org/gradle/api/plugins/gae/task/appcfg/GaeAppConfigTaskTemplate.groovy +++ b/src/main/groovy/org/gradle/api/plugins/gae/task/appcfg/GaeAppConfigTaskTemplate.groovy @@ -29,10 +29,12 @@ abstract class GaeAppConfigTaskTemplate extends GaeWebAppDirTask { String email String server String host + Boolean noCookies Boolean passIn String password String httpProxy String httpsProxy + Boolean oauth2 @Override void executeTask() { @@ -86,6 +88,10 @@ abstract class GaeAppConfigTaskTemplate extends GaeWebAppDirTask { params << "--host=${getHost()}" } + if(getNoCookies()) { + params << '--no_cookies' + } + if(getPassIn() || getPassword()) { params << '--passin' } @@ -97,6 +103,11 @@ abstract class GaeAppConfigTaskTemplate extends GaeWebAppDirTask { if(getHttpsProxy()) { params << "--proxy_https=${getHttpsProxy()}" } + + if(getOauth2()) { + params << '--oauth2' + } + } private class AppConfigRunnable implements Runnable {