git-issue 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/git_issue.rb +2 -2
- data/lib/git_issue/redmine.rb +54 -18
- data/lib/git_issue/version.rb +1 -1
- metadata +4 -4
data/lib/git_issue.rb
CHANGED
data/lib/git_issue/redmine.rb
CHANGED
@@ -278,7 +278,7 @@ class Redmine < GitIssue::Base
|
|
278
278
|
add_prop_name = Proc.new{|name|
|
279
279
|
title = property_title(name)
|
280
280
|
value = ''
|
281
|
-
value = issue[name]['name'] if issue[name] && issue[name]['name']
|
281
|
+
value = "#{issue[name]['name']}(#{issue[name]['id']})" if issue[name] && issue[name]['name']
|
282
282
|
props << [title, value]
|
283
283
|
}
|
284
284
|
|
@@ -396,22 +396,53 @@ class Redmine < GitIssue::Base
|
|
396
396
|
end
|
397
397
|
|
398
398
|
def format_issue_tables(issues_json)
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
399
|
+
name_of = lambda{|issue, name| issue[name]['name'] rescue ""}
|
400
|
+
|
401
|
+
issues = issues_json.map{ |issue|{
|
402
|
+
:id => sprintf("#%-4d", issue['id']), :subject => issue['subject'],
|
403
|
+
:project => name_of.call(issue, 'project'),
|
404
|
+
:tracker => name_of.call(issue, 'tracker'),
|
405
|
+
:status => name_of.call(issue, 'status'),
|
406
|
+
:assigned_to => name_of.call(issue, 'assigned_to'),
|
407
|
+
:version => name_of.call(issue, 'fixed_version'),
|
408
|
+
:priority => name_of.call(issue, 'priority'),
|
409
|
+
:category => name_of.call(issue, 'category'),
|
410
|
+
:updated_on => issue['updated_on'].to_date
|
411
|
+
}}
|
412
|
+
|
413
|
+
max_of = lambda{|name, limit|
|
414
|
+
max = issues.map{|i| mlength(i[name])}.max
|
415
|
+
[max, limit].min
|
416
|
+
}
|
417
|
+
max_length = {
|
418
|
+
:project => max_of.call(:project, 20),
|
419
|
+
:tracker => max_of.call(:tracker, 20),
|
420
|
+
:status => max_of.call(:status, 20),
|
421
|
+
:assigned_to => max_of.call(:assigned_to, 20),
|
422
|
+
:version => max_of.call(:version, 20),
|
423
|
+
:priority => max_of.call(:priority, 20),
|
424
|
+
:category => max_of.call(:category, 20),
|
425
|
+
:subject => 80
|
405
426
|
}
|
406
427
|
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
428
|
+
fmt = configured_value('defaultformat', false)
|
429
|
+
fmt_chars = { :I => :id, :S => :subject,
|
430
|
+
:A => :assigned_to, :s => :status, :T => :tracker,
|
431
|
+
:P => :priority, :p => :project, :V => :version,
|
432
|
+
:C => :category, :U => :updated_on }
|
433
|
+
|
434
|
+
format_to = lambda{|i|
|
435
|
+
res = fmt.dup
|
436
|
+
fmt_chars.each do |k, v|
|
437
|
+
res.gsub!(/\%(\d*)#{k}/) do |s|
|
438
|
+
max = $1.blank? ? max_length[v] : $1.to_i
|
439
|
+
max ? mljust(i[v], max) : i[v]
|
440
|
+
end
|
441
|
+
end
|
442
|
+
res
|
414
443
|
}
|
444
|
+
|
445
|
+
issues.map{|i| format_to.call(i) }
|
415
446
|
end
|
416
447
|
|
417
448
|
def output_issues(issues)
|
@@ -445,7 +476,10 @@ class Redmine < GitIssue::Base
|
|
445
476
|
end
|
446
477
|
|
447
478
|
def read_issue_from_editor(issue, options = {})
|
448
|
-
id_of = lambda{|name| issue[name] ? issue[name]["id"] : ""}
|
479
|
+
id_of = lambda{|name| issue[name] ? sprintf('%2s : %s', issue[name]["id"] , issue[name]['name'] ): ""}
|
480
|
+
|
481
|
+
memofile = configured_value('memofile')
|
482
|
+
memo = File.open(memofile).read.lines.map{|l| "# #{l}"}.join("") unless memofile.blank?
|
449
483
|
|
450
484
|
message = <<-MSG
|
451
485
|
#{issue["subject"].present? ? issue["subject"].chomp : "### subject here ###"}
|
@@ -458,14 +492,16 @@ Category : #{id_of.call("category")}
|
|
458
492
|
Assigned : #{id_of.call("assigned_to")}
|
459
493
|
Version : #{id_of.call("fixed_version")}
|
460
494
|
|
461
|
-
|
495
|
+
# Please enter the notes for your changes. Lines starting
|
496
|
+
# with '#' will be ignored, and an empty message aborts.
|
497
|
+
#{memo}
|
462
498
|
MSG
|
463
499
|
body = get_body_from_editor(message)
|
464
500
|
|
465
501
|
subject, dummy, project_id, tracker_id, status_id, priority_id, category_id, assigned_to_id, fixed_version_id, dummy, *notes = body.lines.to_a
|
466
502
|
|
467
503
|
notes = if notes.present?
|
468
|
-
notes.reject{|
|
504
|
+
notes.reject{|l| l =~ /^#/}.join("")
|
469
505
|
else
|
470
506
|
nil
|
471
507
|
end
|
@@ -485,7 +521,7 @@ MSG
|
|
485
521
|
end
|
486
522
|
|
487
523
|
take_id = lambda{|s|
|
488
|
-
x, i = s.chomp.split(":")
|
524
|
+
x, i, name = s.chomp.split(":")
|
489
525
|
i.present? ? i.strip.to_i : nil
|
490
526
|
}
|
491
527
|
|
data/lib/git_issue/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-issue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 61
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 1
|
10
|
+
version: 0.8.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tomohito Ozaki
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-04-11 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|