##// END OF EJS Templates
Adds an option to reposman for reading the API key from a file....
Jean-Philippe Lang -
r7837:a26db9f08c23
parent child
Show More
@@ -19,7 +19,8
19 # -r redmine.example.net
19 # -r redmine.example.net
20 # -r http://redmine.example.net
20 # -r http://redmine.example.net
21 # -r https://example.net/redmine
21 # -r https://example.net/redmine
22 # -k, --key=KEY use KEY as the Redmine API key
22 # -k, --key=KEY use KEY as the Redmine API key (you can use the
23 # --key-file option as an alternative)
23 #
24 #
24 # == Options
25 # == Options
25 #
26 #
@@ -50,6 +51,9
50 # and subversion.
51 # and subversion.
51 # -f, --force force repository creation even if the project
52 # -f, --force force repository creation even if the project
52 # repository is already declared in Redmine
53 # repository is already declared in Redmine
54 # --key-file=PATH path to a file that contains the Redmine API key
55 # (use this option instead of --key if you don't
56 # the key to appear in the command line)
53 # -t, --test only show what should be done
57 # -t, --test only show what should be done
54 # -h, --help show help and exit
58 # -h, --help show help and exit
55 # -v, --verbose verbose
59 # -v, --verbose verbose
@@ -73,6 +77,7 opts = GetoptLong.new(
73 ['--svn-dir', '-s', GetoptLong::REQUIRED_ARGUMENT],
77 ['--svn-dir', '-s', GetoptLong::REQUIRED_ARGUMENT],
74 ['--redmine-host', '-r', GetoptLong::REQUIRED_ARGUMENT],
78 ['--redmine-host', '-r', GetoptLong::REQUIRED_ARGUMENT],
75 ['--key', '-k', GetoptLong::REQUIRED_ARGUMENT],
79 ['--key', '-k', GetoptLong::REQUIRED_ARGUMENT],
80 ['--key-file', GetoptLong::REQUIRED_ARGUMENT],
76 ['--owner', '-o', GetoptLong::REQUIRED_ARGUMENT],
81 ['--owner', '-o', GetoptLong::REQUIRED_ARGUMENT],
77 ['--group', '-g', GetoptLong::REQUIRED_ARGUMENT],
82 ['--group', '-g', GetoptLong::REQUIRED_ARGUMENT],
78 ['--url', '-u', GetoptLong::REQUIRED_ARGUMENT],
83 ['--url', '-u', GetoptLong::REQUIRED_ARGUMENT],
@@ -134,6 +139,13 begin
134 when '--svn-dir'; $repos_base = arg.dup
139 when '--svn-dir'; $repos_base = arg.dup
135 when '--redmine-host'; $redmine_host = arg.dup
140 when '--redmine-host'; $redmine_host = arg.dup
136 when '--key'; $api_key = arg.dup
141 when '--key'; $api_key = arg.dup
142 when '--key-file'
143 begin
144 $api_key = File.read(arg).strip
145 rescue Exception => e
146 $stderr.puts "Unable to read the key from #{arg}: #{e.message}"
147 exit 1
148 end
137 when '--owner'; $svn_owner = arg.dup; $use_groupid = false;
149 when '--owner'; $svn_owner = arg.dup; $use_groupid = false;
138 when '--group'; $svn_group = arg.dup; $use_groupid = false;
150 when '--group'; $svn_group = arg.dup; $use_groupid = false;
139 when '--url'; $svn_url = arg.dup
151 when '--url'; $svn_url = arg.dup
General Comments 0
You need to be logged in to leave comments. Login now