jirarest2 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,14 @@
1
+ === 0.0.9 / 2012-07-27
2
+
3
+ * 1 major enhancement:
4
+
5
+ * Refactored jira_create_issue. Moved some reusable code to new module Jirarest2Bin
6
+
7
+ * 1 minor enhancement:
8
+
9
+ * Added new script jira_watcher to work with watchers closes #18 , closes #14
10
+
11
+
1
12
  === 0.0.8 / 2012-07-25
2
13
 
3
14
  * 1 minor enhancement:
data/Manifest.txt CHANGED
@@ -7,6 +7,7 @@ Rakefile
7
7
  bin/create_issue.rb
8
8
  bin/jira_create_issue
9
9
  bin/jira_create_issue.rb
10
+ bin/jira_watcher
10
11
  copyright
11
12
  lib/jirarest2.rb
12
13
  lib/jirarest2/connect.rb
@@ -19,6 +20,7 @@ lib/jirarest2/services.rb
19
20
  lib/jirarest2/services/issuelink.rb
20
21
  lib/jirarest2/services/issuelinktype.rb
21
22
  lib/jirarest2/services/watcher.rb
23
+ lib/jirarest2bin.rb
22
24
  test/data/issuespec.txt
23
25
  test/data/test.config.data
24
26
  test/data/test.json
data/README.txt CHANGED
@@ -8,9 +8,9 @@ jirarest2 is yet another implementation of the JIRA(tm) REST-API[https://develop
8
8
 
9
9
  It is intended to be called within the shell to create and verify JIRA(tm) issues fast without a browser. There was no particular need for perfomance at the time of writing.
10
10
 
11
- This implementation is still a for cry from others like http://rubygems.org/gems/jira-ruby which required oauth authentification.
11
+ This implementation is still a for cry from others like http://rubygems.org/gems/jira-ruby which requires oauth authentification.
12
12
 
13
- The script allows you to create new issues with watchers and link those to existing issues.
13
+ There are scripts to create new issues with watchers and link those to existing issues and to manipulate watchers on existing issues.
14
14
 
15
15
  *Use it at your own risk. Most of the API features are not implemented.*
16
16
 
@@ -20,11 +20,13 @@ The script allows you to create new issues with watchers and link those to exist
20
20
  == FEATURES/PROBLEMS:
21
21
 
22
22
  * Still in the alpha stages. The classes are still pretty volatile.
23
- * The script allows you to create new issues with watchers and link those to existing issues
23
+ * jira_create_issue allows you to create new issues with watchers and link those to existing issues
24
+ * jira_watcher allows you to manipulate watchers on existing issues
24
25
 
25
26
  == SYNOPSIS:
26
27
 
27
28
  jira_create_issue -h
29
+ jira_watcher -h
28
30
 
29
31
  == REQUIREMENTS:
30
32
 
@@ -17,21 +17,12 @@
17
17
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
  #
19
19
 
20
-
21
-
22
- if RUBY_VERSION < "1.9"
23
- puts "Sorry, I need ruby 1.9.1 or higher!"
24
- exit1
25
- end
26
-
27
- require "highline/import"
28
- require "jirarest2"
29
- require "optparse"
30
- require "ostruct"
31
- require "jirarest2/madbitconfig"
32
- require "uri"
20
+ require "jirarest2bin"
33
21
  require "pp"
34
22
 
23
+ # Check for the minimum ruby version we need
24
+ Jirarest2Bin::check_ruby_version
25
+
35
26
  class ParseOptions
36
27
 
37
28
  #print to Variants of a JSON file that we both take in as input with -C
@@ -67,13 +58,8 @@ class ParseOptions
67
58
  end
68
59
 
69
60
 
70
- def self.required_argument(name)
71
- puts "Argument \"#{name}\" is mandatory."
72
- exit 1
73
- end
74
-
75
61
  =begin
76
- parse resturn two Hashes. The first one contains the options for the issue the second one the options for the execution of the script.
62
+ parse returns two Hashes. The first one contains the options for the issue the second one the options for the execution of the script.
77
63
  =end
78
64
  def self.parse(args)
79
65
  issueopts = OpenStruct.new
@@ -86,7 +72,6 @@ class ParseOptions
86
72
 
87
73
  opts = OptionParser.new do |opts|
88
74
  opts.banner = "Usage: #{__FILE__} [options]"
89
- opts.separator ""
90
75
 
91
76
  opts.on("-p", "--project PROJECT", "Projectname") do |p|
92
77
  issueopts.project = p
@@ -124,51 +109,15 @@ class ParseOptions
124
109
  opts.on("-F", "--field-seperator CHAR", "A fieldseperator if one of the fields is an array (Default \"|\")") do |fs|
125
110
  scriptopts.arrayseperator = fs
126
111
  end
127
-
128
-
129
- opts.on("--config-file CONFIGFILE", "Config file containing the jira credentials. (Default: ~/.jiraconfig)") do |conffile|
130
- scriptopts.configfile = conffile
131
- end
132
-
133
- opts.on("--write-config-file", "Writes the configfile with the data given if it does not alredy exist.") do |wc|
134
- scriptopts.writeconf = :write
135
- end
136
-
137
- opts.on("--force-write-config-file", "Writes the configfile with the data given even if it does alredy exist.") do |wc|
138
- scriptopts.writeconf = :forcewrite
139
- end
140
112
 
141
-
142
- opts.on("-u", "--username USERNAME", "Your Jira Username if you don't want to use the one in the master file") do |u|
143
- scriptopts.username = u
144
- end
145
-
146
- opts.on("-H", "--jira-url URL", "URL to rest api (without \"/rest/api/2\").") do |url|
147
- uri = URI(url)
148
- splitURI = URI.split(url)
149
- if splitURI[3] then
150
- url = splitURI[0].to_s + "://" + splitURI[2].to_s + ":" + splitURI[3].to_s + splitURI[5].to_s
151
- else
152
- url = splitURI[0].to_s + "://" + splitURI[2].to_s + splitURI[5].to_s
153
- end
154
- scriptopts.url = url
155
- end
156
-
157
113
  opts.on_tail("--help-C", "Example input for -C") do
158
114
  print_json_input
159
115
  exit
160
116
  end
161
- opts.on_tail("-h", "--help", "Display this screen") do
162
- puts opts
163
- exit
164
- end
117
+ #get the options we need every time
118
+ scriptopts = Jirarest2Bin::defaultoptions(opts,scriptopts)
165
119
 
166
- opts.on_tail("--version", "Show version") do
167
- puts OptionParser::Version.join(".")
168
- exit
169
- end
170
120
  end
171
-
172
121
 
173
122
  opts.parse!(args)
174
123
  return issueopts, scriptopts
@@ -186,84 +135,21 @@ def no_issue(type,issue)
186
135
  exit 1
187
136
  end
188
137
 
189
- =begin
190
- Get the password from an interactive shell
191
- =end
192
- def get_password
193
- ask("Enter your password for user \"#{@scriptopts.username}\": ") { |q|
194
- q.echo = "*"
195
- }
196
- end
197
-
198
- =begin
199
- Gather all the credentials and build the credentials file
200
- =end
201
- def get_credentials
202
- filefail = false
203
- begin
204
- fileconf = MadbitConfig::read_configfile(@scriptopts.configfile)
205
- # We don't want to set the Values from the configfile if we have them already set.
206
- @scriptopts.username = fileconf["username"] if ( @scriptopts.username.nil? && fileconf["username"] )
207
- @scriptopts.pass = fileconf["password"] if ( @scriptopts.pass.nil? && fileconf["password"] )
208
- if ( @scriptopts.url.nil? && fileconf["URL"] ) then
209
- @scriptopts.url = fileconf["URL"]
210
- end
211
- rescue IOError => e
212
- puts e
213
- filefail = false
214
- end
215
- @scriptopts.url = @scriptopts.url + "/rest/api/2/"
216
-
217
- if @scriptopts.pass.nil? && !( @scriptopts.username.nil?) then
218
- @scriptopts.pass = get_password
219
- end
220
-
221
- missing = Array.new
222
- missing << "URL" if @scriptopts.url.nil?
223
- missing << "username" if @scriptopts.username.nil?
224
- # missing << "password" if @scriptopts.pass.nil?
225
- if missing != [] then
226
- puts "Missing essential parameter(s) #{missing.join(",")}. Exiting..."
227
- exit 1
228
- else
229
- return Credentials.new(@scriptopts.url, @scriptopts.username, @scriptopts.pass)
230
- end
231
- end
232
-
233
- =begin
234
- If there is already a conenction known returns that connection. If not or if the parameter is true it tries to create a new Connect object
235
- =end
236
- def get_connection(reconnect = false)
237
- if ! @connection || reconnect then
238
- begin
239
- @connection = Connect.new(get_credentials)
240
- @connection.heal_uri! # We want to be sure so we try to heal the connection_url if possible
241
- return @connection
242
- rescue Jirarest2::CouldNotHealURIError => e
243
- puts "REST API not found at #{e.to_s}"
244
- exit 3
245
- end
246
- else
247
- return @connection
248
- end
249
- end
250
-
251
138
  =begin
252
139
  create the issue on our side
253
140
  =end
254
141
  def open_issue
255
142
  begin
256
143
  if @issueopts.project.nil? then
257
- ParseOptions::required_argument("project")
144
+ Jirarest2Bin::required_argument("project")
258
145
  end
259
146
  if @issueopts.issue.nil? then
260
- ParseOptions::required_argument("issue")
147
+ Jirarest2Bin::required_argument("issue")
261
148
  end
262
- credentials = get_credentials
263
- issue=Issue.new(@issueopts.project,@issueopts.issue,get_connection)
149
+ issue=Issue.new(@issueopts.project,@issueopts.issue,Jirarest2Bin::get_connection(@scriptopts,@connection))
264
150
  rescue Jirarest2::AuthentificationError => e
265
151
  puts "Password not accepted."
266
- @scriptopts.pass = get_password
152
+ @scriptopts.pass = Jirarest2Bin.get_password(@scriptopts.username)
267
153
  retry
268
154
  rescue Jirarest2::AuthentificationCaptchaError => e
269
155
  puts "Wrong Password too many times.\nCaptcha time at #{e.to_s} to reenable your account."
@@ -373,7 +259,7 @@ end
373
259
  =end
374
260
  def create_new_ticket(issue)
375
261
  begin
376
- connection = get_connection # We need it so often in the next few lines that I prefer to get the result in a variable
262
+ connection = Jirarest2Bin::get_connection(@scriptopts,@connection) # We need it so often in the next few lines that I prefer to get the result in a variable
377
263
  result = issue.persist(connection).result
378
264
  # Set the watchers
379
265
  if @issueopts.watchers then
@@ -410,43 +296,12 @@ def create_new_ticket(issue)
410
296
  end
411
297
  end
412
298
 
413
- =begin
414
- called to write the config file
415
- =end
416
- def write_configfile
417
- text = Hash.new
418
- if @scriptopts.url.nil? then
419
- text["#URL"] = "https://host.domain.com:port/path/"
420
- else
421
- text["URL"] = "#{@scriptopts.url}"
422
- end
423
- if @scriptopts.username.nil? then
424
- text["#username"] = "USERNAME"
425
- else
426
- text["username"] = "#{@scriptopts.username}"
427
- end
428
- text["#password"] = "Your!PassW0rd"
429
- begin
430
- if @scriptopts.writeconf == :forcewrite then
431
- MadbitConfig::write_configfile(@scriptopts.configfile,text,:force)
432
- else
433
- MadbitConfig::write_configfile(@scriptopts.configfile,text)
434
- end
435
- puts "Configfile written to #{@scriptopts.configfile}. Exiting."
436
- exit 0
437
- rescue MadbitConfig::FileExistsException => e
438
- puts "Configfile #{e} already exists. Use \"--force-write-config-file\" to replace."
439
- exit 1
440
- end
441
- end
442
-
443
-
444
299
  # The "main function"
445
300
  if @scriptopts.show != [] then
446
301
  show_scheme
447
302
  end
448
303
  if @scriptopts.writeconf then
449
- write_configfile
304
+ Jirarest2Bin::write_configfile(@scriptopts)
450
305
  end
451
306
  if ! (@scriptopts.contentfile.nil? and @issueopts.content.nil?) then # If there is no content set it makes no sense to try to build a ticket
452
307
  content = prepare_new_ticket
data/bin/jira_watcher ADDED
@@ -0,0 +1,121 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Copyright (C) 2012 Cyril Bitterich
4
+ #
5
+ # This program is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # This program is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+
19
+ require "jirarest2bin"
20
+ require "pp"
21
+
22
+ # Check for the minimum ruby version we need
23
+ Jirarest2Bin::check_ruby_version
24
+
25
+ class ParseOptions
26
+
27
+ =begin
28
+ Parse the command line parameters
29
+ @return [Array] returns two hashes. The first one contains the options for the issue, the second one for the execution of the script
30
+ =end
31
+ def self.parse(args)
32
+ issueopts = OpenStruct.new
33
+ scriptopts = OpenStruct.new
34
+ scriptopts.configfile = "~/.jiraconfig"
35
+
36
+ opts = OptionParser.new do |opts|
37
+ opts.banner = "Usage: #{__FILE__} [options]"
38
+ scriptopts = Jirarest2Bin::defaultoptions(opts,scriptopts)
39
+
40
+ opts.on("-i", "--issue ISSUE,ISSUE,...", Array, "Issues to work on") do |i|
41
+ issueopts.issues = i
42
+ end
43
+
44
+ opts.on("-w", "--watcher USERNAME,USERNAME,...", Array, "Watchers to add") do |w|
45
+ issueopts.watchers = w
46
+ end
47
+
48
+ opts.on("-c", "--command [command]",[:add,:remove,:view,:get,:set], "What to do with the watcher on the issues (add, remove,set)") do |c|
49
+ scriptopts.command = c
50
+ end
51
+
52
+ opts.on("-v", "--verbose", "Tell what I did in great detail") do |v|
53
+ scriptopts.verbose = v
54
+ end
55
+ end # OptionParser.new
56
+
57
+ opts.parse!(args)
58
+ return issueopts, scriptopts
59
+
60
+ end #parse
61
+ end # class
62
+
63
+ @issueopts, @scriptopts = ParseOptions.parse(ARGV)
64
+
65
+
66
+ # Calls the issues and get the watchers of each issue in return.
67
+ # It will then print those issues and their watchers to STDOUT
68
+ # @param [Array] issues An Array containing the issuekeys
69
+ def view_watchers(issues)
70
+ connection = Jirarest2Bin::get_connection(@scriptopts,@connection)
71
+ issues.each { |issue|
72
+ connectedissue = Watcher.new(connection, issue)
73
+ watchers = connectedissue.get_watchers
74
+ if watchers != [] then
75
+ puts "Issue #{issue} has the following watchers:"
76
+ watchers.each { |watcher|
77
+ puts "#{watcher}"
78
+ }
79
+ else
80
+ puts "Issue #{issue} has no watchers."
81
+ end
82
+ }
83
+ end
84
+
85
+ # Calls the issues and runs the needed work on it with the given users by opening the connection to the server, looking for the issue identified by the key and executing the string
86
+ # @param [Array] issues Issues to work with
87
+ # @param [Array] users Users to work with
88
+ # @param [Array] toto Kind of work to be done
89
+ def work_watchers(issues,users,todo)
90
+ connection = Jirarest2Bin::get_connection(@scriptopts,@connection)
91
+ issues.each{ |issue|
92
+ connectedissue = Watcher.new(connection, issue)
93
+ method = todo + "_watcher" # the name of the method we want to call with send
94
+ users.each { |user|
95
+ connectedissue.send method, user
96
+ puts "Used #{todo} on Watcher #{user} to issue #{issue}" if @scriptopts.verbose
97
+ }
98
+ }
99
+ end
100
+
101
+ if @scriptopts.writeconf then
102
+ Jirarest2Bin::write_configfile(@scriptopts)
103
+ end
104
+
105
+ Jirarest2Bin::required_argument("issue") if @issueopts.issues.nil?
106
+ case @scriptopts.command
107
+ when :add
108
+ Jirarest2Bin::required_argument("watcher") if @issueopts.watchers.nil?
109
+ work_watchers(@issueopts.issues,@issueopts.watchers,"add")
110
+ when :remove
111
+ Jirarest2Bin::required_argument("watcher") if @issueopts.watchers.nil?
112
+ work_watchers(@issueopts.issues,@issueopts.watchers,"remove")
113
+ when :set
114
+ puts "set is not implemented yet. If you want to give me a hint as to how I should do that please go to https://github.com/cybit/jirarest2/issues/18"
115
+ when :view
116
+ view_watchers(@issueopts.issues)
117
+ when :get
118
+ view_watchers(@issueopts.issues)
119
+ else
120
+ puts "Don't know what to do. Please set -c"
121
+ end
data/lib/jirarest2.rb CHANGED
@@ -17,7 +17,7 @@
17
17
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
  #
19
19
 
20
- VERSION = "0.0.8"
20
+ VERSION = "0.0.9"
21
21
 
22
22
  require_relative "jirarest2/connect"
23
23
  require_relative "jirarest2/issue"
@@ -0,0 +1,194 @@
1
+ # Copyright (C) 2012 Cyril Bitterich
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+ #
16
+
17
+ #This file keeps the require for the shell UI scripts together
18
+
19
+ require "highline/import"
20
+ require "jirarest2"
21
+ require "optparse"
22
+ require "ostruct"
23
+ require "jirarest2/madbitconfig"
24
+ require "uri"
25
+
26
+
27
+ module Jirarest2Bin
28
+ # Checks for the minimum jira version (1.9.1)
29
+ def self.check_ruby_version
30
+ if RUBY_VERSION < "1.9"
31
+ puts "Sorry, I need ruby 1.9.1 or higher!"
32
+ exit 1
33
+ end
34
+ end
35
+
36
+
37
+ # write the config file for the conenction to jira
38
+ # @param [Openstruct] scriptopts Openstruct object that contains all the paramters needed to create the config file
39
+ def self.write_configfile(scriptopts)
40
+ text = Hash.new
41
+ if scriptopts.url.nil? then
42
+ text["#URL"] = "https://host.domain.com:port/path/"
43
+ else
44
+ text["URL"] = "#{scriptopts.url}"
45
+ end
46
+ if scriptopts.username.nil? then
47
+ text["#username"] = "USERNAME"
48
+ else
49
+ text["username"] = "#{scriptopts.username}"
50
+ end
51
+ text["#password"] = "Your!PassW0rd"
52
+ begin
53
+ if scriptopts.writeconf == :forcewrite then
54
+ MadbitConfig::write_configfile(scriptopts.configfile,text,:force)
55
+ else
56
+ MadbitConfig::write_configfile(scriptopts.configfile,text)
57
+ end
58
+ puts "Configfile written to #{scriptopts.configfile}. Exiting."
59
+ exit 0
60
+ rescue MadbitConfig::FileExistsException => e
61
+ puts "Configfile #{e} already exists. Use \"--force-write-config-file\" to replace."
62
+ exit 1
63
+ end
64
+ end
65
+
66
+ # Output a message if a required argument is not set
67
+ # @param [String] name Name of the argument
68
+ def self.required_argument(name)
69
+ puts "Argument \"#{name}\" is mandatory."
70
+ exit 1
71
+ end
72
+
73
+
74
+ # Get the password from an interactive shell
75
+ # @param [String] username The Username to show
76
+ # @return [String] the password as read from the command line
77
+ def self.get_password(username)
78
+ password = ask("Enter your password for user \"#{username}\": ") { |q|
79
+ q.echo = "*"
80
+ }
81
+ return password
82
+ end
83
+
84
+ # Gather all the credentials and build the credentials file
85
+ # @param [Openstruct] scriptopts The Openstruct object that contains all the options relevant for the script
86
+ # @return [Credentials] a credentials object
87
+ def self.get_credentials(scriptopts)
88
+ filefail = false
89
+ begin
90
+ fileconf = MadbitConfig::read_configfile(scriptopts.configfile)
91
+ # We don't want to set the Values from the configfile if we have them already set.
92
+ scriptopts.username = fileconf["username"] if ( scriptopts.username.nil? && fileconf["username"] )
93
+ scriptopts.pass = fileconf["password"] if ( scriptopts.pass.nil? && fileconf["password"] )
94
+ if ( scriptopts.url.nil? && fileconf["URL"] ) then
95
+ scriptopts.url = fileconf["URL"]
96
+ end
97
+ rescue IOError => e
98
+ puts e
99
+ filefail = false
100
+ end
101
+ scriptopts.url = scriptopts.url + "/rest/api/2/"
102
+
103
+ if scriptopts.pass.nil? && !( scriptopts.username.nil?) then
104
+ scriptopts.pass = Jirarest2Bin::get_password(scriptopts.username)
105
+ end
106
+
107
+ missing = Array.new
108
+ missing << "URL" if scriptopts.url.nil?
109
+ missing << "username" if scriptopts.username.nil?
110
+ if missing != [] then
111
+ puts "Missing essential parameter(s) #{missing.join(",")}. Exiting..."
112
+ exit 1
113
+ else
114
+ return Credentials.new(scriptopts.url, scriptopts.username, scriptopts.pass)
115
+ end
116
+ end # get_credentials
117
+
118
+
119
+ # If there is already a connection known returns that connection. If not or if the parameter is true it tries to create a new Connect object
120
+ # @param [Openstruct] scriptopts The Openstruct object that contains all the options relevant for the script
121
+ # @param [Connect] connection An existing connection. Will be nil the first time we use it.
122
+ # @param [Boolean] reconnect Loose an existing connection and build a new one
123
+ # @return [Connection] A connection object that contains all the parameters needed to connect to JIRA(tm)
124
+ def self.get_connection(scriptopts, connection, reconnect = false)
125
+ if ! connection || reconnect then
126
+ begin
127
+ connection = Connect.new(get_credentials(scriptopts))
128
+ connection.heal_uri! # We want to be sure so we try to heal the connection_url if possible
129
+ return connection
130
+ rescue Jirarest2::CouldNotHealURIError => e
131
+ puts "REST API not found at #{e.to_s}"
132
+ exit 3
133
+ end
134
+ else
135
+ return connection
136
+ end
137
+ end # get_connection
138
+
139
+
140
+ # This method is here because I am to lazy to rewrite the options every time
141
+ # use it with scriptopts = Jirarest2Bin::defaultoptions(opts,scriptopts)
142
+ # fills out the part of the options we output every time
143
+ # @param [OptionParser] opts The OptionParser object we added before
144
+ # @param [Openstruct] scriptopts The Openstruct object that contains all the options relevant for the script
145
+ # @return [Openstruct] The same scriptopts but extended with the parameters set here.
146
+ def self.defaultoptions(opts,scriptopts)
147
+ #header
148
+ opts.separator ""
149
+
150
+ #tail
151
+ opts.on_tail("--config-file CONFIGFILE", "Config file containing the jira credentials. (Default: ~/.jiraconfig)") do |conffile|
152
+ scriptopts.configfile = conffile
153
+ end
154
+
155
+ opts.on_tail("--write-config-file", "Writes the configfile with the data given if it does not alredy exist.") do |wc|
156
+ scriptopts.writeconf = :write
157
+ end
158
+
159
+ opts.on_tail("--force-write-config-file", "Writes the configfile with the data given even if it does alredy exist.") do |wc|
160
+ scriptopts.writeconf = :forcewrite
161
+ end
162
+
163
+
164
+ opts.on_tail("-u", "--username USERNAME", "Your Jira Username if you don't want to use the one in the master file") do |u|
165
+ scriptopts.username = u
166
+ end
167
+
168
+ opts.on_tail("-H", "--jira-url URL", "URL to rest api (without \"/rest/api/2\").") do |url|
169
+ uri = URI(url)
170
+ splitURI = URI.split(url)
171
+ if splitURI[3] then
172
+ url = splitURI[0].to_s + "://" + splitURI[2].to_s + ":" + splitURI[3].to_s + splitURI[5].to_s
173
+ else
174
+ url = splitURI[0].to_s + "://" + splitURI[2].to_s + splitURI[5].to_s
175
+ end
176
+ scriptopts.url = url
177
+ end
178
+
179
+ opts.on_tail("-h", "--help", "Display this screen") do
180
+ puts opts
181
+ exit
182
+ end
183
+
184
+ opts.on_tail("--version", "Show version") do
185
+ puts OptionParser::Version.join(".")
186
+ exit
187
+ end
188
+
189
+ return scriptopts
190
+ end #defaultoptions
191
+
192
+ end # JiraRest2Bin
193
+
194
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jirarest2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -50,7 +50,7 @@ cert_chain:
50
50
  -----END CERTIFICATE-----
51
51
 
52
52
  '
53
- date: 2012-07-24 00:00:00.000000000 Z
53
+ date: 2012-07-26 00:00:00.000000000 Z
54
54
  dependencies:
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: json
@@ -136,16 +136,18 @@ description: ! "jirarest2 is yet another implementation of the JIRA(tm) REST-API
136
136
  . This one for Ruby1.9.1\n\nIt is intended to be called within the shell to create
137
137
  and verify JIRA(tm) issues fast without a browser. There was no particular need
138
138
  for perfomance at the time of writing.\n\nThis implementation is still a for cry
139
- from others like http://rubygems.org/gems/jira-ruby which required oauth authentification.
140
- \n\nThe script allows you to create new issues with watchers and link those to existing
141
- issues.\n\n *Use it at your own risk. Most of the API features are not implemented.*\n\n
142
- *Ruby1.9.1 is needed. Ruby1.8 doesn't work!*"
139
+ from others like http://rubygems.org/gems/jira-ruby which requires oauth authentification.
140
+ \n\nThere are scripts to create new issues with watchers and link those to existing
141
+ issues and to manipulate watchers on existing issues.\n\n *Use it at your own risk.
142
+ Most of the API features are not implemented.*\n\n *Ruby1.9.1 is needed. Ruby1.8
143
+ doesn't work!*"
143
144
  email:
144
145
  - cebit-jirarest@gunnet.de
145
146
  executables:
146
147
  - create_issue.rb
147
148
  - jira_create_issue
148
149
  - jira_create_issue.rb
150
+ - jira_watcher
149
151
  extensions: []
150
152
  extra_rdoc_files:
151
153
  - History.txt
@@ -161,6 +163,7 @@ files:
161
163
  - bin/create_issue.rb
162
164
  - bin/jira_create_issue
163
165
  - bin/jira_create_issue.rb
166
+ - bin/jira_watcher
164
167
  - copyright
165
168
  - lib/jirarest2.rb
166
169
  - lib/jirarest2/connect.rb
@@ -173,6 +176,7 @@ files:
173
176
  - lib/jirarest2/services/issuelink.rb
174
177
  - lib/jirarest2/services/issuelinktype.rb
175
178
  - lib/jirarest2/services/watcher.rb
179
+ - lib/jirarest2bin.rb
176
180
  - test/data/issuespec.txt
177
181
  - test/data/test.config.data
178
182
  - test/data/test.json
metadata.gz.sig CHANGED
Binary file