You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2020/06/05 14:54:56 UTC
[whimsy] branch master updated: Allow use of env class
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new b13407e Allow use of env class
b13407e is described below
commit b13407e086c39fe5d4a0e91cc6c4710cff66214d
Author: Sebb <se...@apache.org>
AuthorDate: Fri Jun 5 15:54:45 2020 +0100
Allow use of env class
---
lib/whimsy/asf/svn.rb | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index 93e0218..bbed5a8 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -261,14 +261,15 @@ module ASF
return self.svn('list', path, {user: user, password: password})
end
- VALID_KEYS=[:args, :user, :password, :verbose]
+ VALID_KEYS=[:args, :user, :password, :verbose, :env]
# low level SVN command
# params:
# command - info, list etc
# path - the path to be used
# options - hash of:
# :args - string or array of strings, e.g. '-v', ['--depth','empty']
- # :user, :password - auth
+ # :env - environment: source for user and password
+ # :user, :password - used if env is not present
# :verbose - show command
# Returns either:
# - stdout
@@ -297,10 +298,17 @@ module ASF
end
open_opts = {}
- # password was supplied, add credentials
- password = options[:password]
+ env = options[:env]
+ if env
+ password = env.password
+ user = env.user
+ else
+ password = options[:password]
+ user = options[:user] if password
+ end
+ # password was supplied, add credentials
if password
- cmd += ['--username', options[:user], '--no-auth-cache']
+ cmd += ['--username', user, '--no-auth-cache']
if ASF::Config[:password_from_stdin] # TODO: better way to check this?
open_opts[:stdin_data] = password
cmd << '--password-from-stdin'