jiraa 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/bin/jiraa +28 -18
  2. data/jiraa.gemspec +0 -2
  3. data/lib/jiraa/version.rb +1 -1
  4. metadata +2 -34
data/bin/jiraa CHANGED
@@ -20,14 +20,6 @@ desc 'The port your Jira instance is running on'
20
20
  arg_name 'PORT'
21
21
  flag [:P, :port]
22
22
 
23
- desc 'Your Jira username (if using HTTP basic authentication)'
24
- arg_name 'USERNAME'
25
- flag [:u,:username]
26
-
27
- desc 'Your Jira password (if using HTTP basic authentication)'
28
- arg_name 'PASSWORD'
29
- flag [:p,:password]
30
-
31
23
  desc 'Your Jira certificate (if using SSL authentication)'
32
24
  arg_name 'CERTIFICATE'
33
25
  flag [:C,:certificate]
@@ -108,6 +100,8 @@ arg_name 'ISSUE'
108
100
  command "start-progress" do |c|
109
101
  c.action do |global_options,options,args|
110
102
  help_now! "Missing issue key" if args.length == 0
103
+ # Assign the issue to me
104
+ assign_issue(args[0], @username)
111
105
  JiraClient.start_progress_on_issue args[0]
112
106
  puts "Progress started on #{args[0]}"
113
107
  end
@@ -191,6 +185,21 @@ command :current do |c|
191
185
  end
192
186
  end
193
187
 
188
+ desc 'Assign an issue to you or a specified USER'
189
+ arg_name 'ISSUE [USER]'
190
+ command :assign do |c|
191
+ c.action do |global_options,options,args|
192
+ help_now! "Missing issue key" if args.length == 0
193
+ username = args[1] || @username
194
+ assign_issue(args[0], username)
195
+ end
196
+ end
197
+
198
+ def assign_issue(issue, username)
199
+ JiraClient.assign_issue issue, username
200
+ puts "Assigned #{issue} to #{username}"
201
+ end
202
+
194
203
  desc 'Comment on an issue'
195
204
  arg_name 'ISSUE COMMENT'
196
205
  command :comment do |c|
@@ -213,6 +222,8 @@ end
213
222
  pre do |global,command,options,args|
214
223
  config = load_config(global)
215
224
  configure_client(config)
225
+ add_user_to_config if config["username"].nil?
226
+ @username = config["username"]
216
227
  true
217
228
  end
218
229
 
@@ -224,7 +235,6 @@ def load_config(global_config)
224
235
  else
225
236
  create_config_file(config_filename, global_config)
226
237
  end
227
-
228
238
  config.merge! global_config
229
239
  end
230
240
 
@@ -234,19 +244,12 @@ end
234
244
 
235
245
  def create_config_file(filename, config)
236
246
  url = config[:url] || "https://jira.example.com"
237
- username = config[:username] || "username"
238
- password = config[:password] || "password"
239
247
  certificate = config[:certificate] || "/usr/local/certificates/my_cert.pem"
240
248
  File.open(filename, 'w') do |file|
241
249
  file.write <<-EOF
242
250
  ---
243
251
  # Enter the URL of your Jira instance here:
244
252
  #{'#' unless config[:url]}url: #{url}
245
-
246
- # If your Jira server uses HTTP basic authentication then fill in your username and password:
247
- #{'#' unless config[:username]}username: #{username}
248
- #{'#' unless config[:password]}password: #{password}
249
-
250
253
  # If your Jira server users SSL certificate authentication then provide a path to your certificate:
251
254
  #{'#' unless config[:certificate]}certificate: #{certificate}
252
255
  EOF
@@ -258,11 +261,18 @@ def configure_client(config)
258
261
  JiraClient.configure do |c|
259
262
  c.base_url = config["url"]
260
263
  c.certificate = config["certificate"]
261
- c.username = config["username"]
262
- c.password = config["password"]
263
264
  c.port = config["port"]
264
265
  c.proxy = ENV['https_proxy']
265
266
  end
266
267
  end
267
268
 
269
+ def add_user_to_config
270
+ puts "Attempting to guess your Jira username..."
271
+ username = JiraClient.current_user.username
272
+ puts "Adding username '#{username}' to config"
273
+ File.open(File.join(ENV['HOME'], ".jiraa"), 'a') do |file|
274
+ file.write "username: #{username}\n"
275
+ end
276
+ end
277
+
268
278
  exit run(ARGV)
@@ -20,8 +20,6 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
- spec.add_development_dependency "aruba"
24
- spec.add_development_dependency "cucumber"
25
23
 
26
24
  spec.add_runtime_dependency "jira_client", ">= 1.0.2"
27
25
  spec.add_runtime_dependency "gli", "2.5.6"
@@ -1,3 +1,3 @@
1
1
  module Jiraa
2
- VERSION = '1.0.5'
2
+ VERSION = '1.0.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jiraa
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-16 00:00:00.000000000 Z
12
+ date: 2013-08-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -43,38 +43,6 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: aruba
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: cucumber
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
46
  - !ruby/object:Gem::Dependency
79
47
  name: jira_client
80
48
  requirement: !ruby/object:Gem::Requirement