summaryrefslogtreecommitdiffstats
path: root/extra/svn/reposman.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-11-27 17:42:19 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-11-27 17:42:19 +0000
commita26db9f08c237173b14b24ed3acdb960aedf871b (patch)
treee69534921afb9e14f67e74ab960783ec58864567 /extra/svn/reposman.rb
parent5ac8020801724a8a5a5dcc95e684e918f81cdcd9 (diff)
downloadredmine-a26db9f08c237173b14b24ed3acdb960aedf871b.tar.gz
redmine-a26db9f08c237173b14b24ed3acdb960aedf871b.zip
Adds an option to reposman for reading the API key from a file.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7957 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'extra/svn/reposman.rb')
-rwxr-xr-xextra/svn/reposman.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/extra/svn/reposman.rb b/extra/svn/reposman.rb
index 349f303b7..cb623bfc2 100755
--- a/extra/svn/reposman.rb
+++ b/extra/svn/reposman.rb
@@ -19,7 +19,8 @@
# -r redmine.example.net
# -r http://redmine.example.net
# -r https://example.net/redmine
-# -k, --key=KEY use KEY as the Redmine API key
+# -k, --key=KEY use KEY as the Redmine API key (you can use the
+# --key-file option as an alternative)
#
# == Options
#
@@ -50,6 +51,9 @@
# and subversion.
# -f, --force force repository creation even if the project
# repository is already declared in Redmine
+# --key-file=PATH path to a file that contains the Redmine API key
+# (use this option instead of --key if you don't
+# the key to appear in the command line)
# -t, --test only show what should be done
# -h, --help show help and exit
# -v, --verbose verbose
@@ -73,6 +77,7 @@ opts = GetoptLong.new(
['--svn-dir', '-s', GetoptLong::REQUIRED_ARGUMENT],
['--redmine-host', '-r', GetoptLong::REQUIRED_ARGUMENT],
['--key', '-k', GetoptLong::REQUIRED_ARGUMENT],
+ ['--key-file', GetoptLong::REQUIRED_ARGUMENT],
['--owner', '-o', GetoptLong::REQUIRED_ARGUMENT],
['--group', '-g', GetoptLong::REQUIRED_ARGUMENT],
['--url', '-u', GetoptLong::REQUIRED_ARGUMENT],
@@ -134,6 +139,13 @@ begin
when '--svn-dir'; $repos_base = arg.dup
when '--redmine-host'; $redmine_host = arg.dup
when '--key'; $api_key = arg.dup
+ when '--key-file'
+ begin
+ $api_key = File.read(arg).strip
+ rescue Exception => e
+ $stderr.puts "Unable to read the key from #{arg}: #{e.message}"
+ exit 1
+ end
when '--owner'; $svn_owner = arg.dup; $use_groupid = false;
when '--group'; $svn_group = arg.dup; $use_groupid = false;
when '--url'; $svn_url = arg.dup