ruby-issues 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/bin/issues +107 -98
- metadata +30 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c2f16149fa0033a0ca606aed7249589ab61d16b3cb1211ea8ea268d31fd8c721
|
4
|
+
data.tar.gz: fad585559cf6d01921ba26fe5a487990cd3ecaa61cb7e4134e2649dd71a50abf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46b70effb8c7619ffa8bc08bc0da30b38b601c94cad1a3f80e6a6305c9b21ac0aa00a85252a23ffe3cd3748b20019d16f270435a4a8654a8ddeba37a9980594b
|
7
|
+
data.tar.gz: 36a12a234dc934e7b5f88ff437f10330426b694543c05fa58ae8248501f4e2ff18e9af6de49ee3b08bf2d7ac230ecf44f2c85161a6a0f9fd0cc99a8e8c6e2f94
|
data/bin/issues
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# encoding: utf-8
|
2
|
+
# encoding: utf-8
|
3
3
|
#===========================================================================================
|
4
4
|
require 'rubygems'
|
5
5
|
require 'fattr'
|
6
6
|
require 'io/console'
|
7
7
|
require 'securerandom'
|
8
8
|
require 'PrettyComment'
|
9
|
-
require '
|
9
|
+
require 'optimist'
|
10
10
|
require 'yaml'
|
11
11
|
require 'git'
|
12
12
|
|
@@ -16,11 +16,11 @@ require 'git'
|
|
16
16
|
|
17
17
|
def git_get_current_branch()
|
18
18
|
current_branch = `git branch`.split(/\n/).find{ |l| l.start_with?("*") }
|
19
|
-
|
19
|
+
|
20
20
|
if current_branch
|
21
21
|
current_branch =~ /\*\s+(.+)/
|
22
22
|
$~[1]
|
23
|
-
end
|
23
|
+
end
|
24
24
|
end
|
25
25
|
|
26
26
|
#-------------------------------------------------------------------------------------------
|
@@ -37,10 +37,17 @@ end
|
|
37
37
|
|
38
38
|
#-------------------------------------------------------------------------------------------
|
39
39
|
|
40
|
+
def get_system_editor()
|
41
|
+
default_editor = 'editor'
|
42
|
+
ENV['EDITOR'] || `git var GIT_EDITOR`.rstrip || default_editor
|
43
|
+
end
|
44
|
+
|
45
|
+
#-------------------------------------------------------------------------------------------
|
46
|
+
|
40
47
|
def edit_string(aString)
|
48
|
+
editor = get_system_editor
|
41
49
|
tempfile_name = "/tmp/issues-" << SecureRandom.hex.force_encoding("UTF-8")
|
42
|
-
|
43
|
-
system("$EDITOR #{tempfile_name}")
|
50
|
+
system("#{editor} #{tempfile_name}")
|
44
51
|
new_string = File.read(tempfile_name)
|
45
52
|
File.unlink(tempfile_name)
|
46
53
|
new_string
|
@@ -50,7 +57,7 @@ end
|
|
50
57
|
|
51
58
|
class LogEntry
|
52
59
|
fattr :date, :message
|
53
|
-
|
60
|
+
|
54
61
|
def initialize(message)
|
55
62
|
@date = Time.new
|
56
63
|
@message = message.dup
|
@@ -63,7 +70,7 @@ end
|
|
63
70
|
class Issue
|
64
71
|
fattr :id, :created, :type, :title, :description, :status, :milestone, :estimate
|
65
72
|
attr_accessor :history
|
66
|
-
|
73
|
+
|
67
74
|
#-------------------------------------------------------------------------------------------
|
68
75
|
|
69
76
|
def initialize
|
@@ -91,7 +98,7 @@ class Issue
|
|
91
98
|
new_value = value.is_a?(Numeric) || value == nil ? value : value.dup
|
92
99
|
a_issue.send(a) && self.send(a, new_value)
|
93
100
|
end
|
94
|
-
end
|
101
|
+
end
|
95
102
|
|
96
103
|
#-------------------------------------------------------------------------------------------
|
97
104
|
|
@@ -99,36 +106,36 @@ class Issue
|
|
99
106
|
@history ||= []
|
100
107
|
@history << LogEntry.new(message)
|
101
108
|
end
|
102
|
-
|
109
|
+
|
103
110
|
#-------------------------------------------------------------------------------------------
|
104
|
-
|
111
|
+
|
105
112
|
def format_verbose(opts)
|
106
113
|
milestone = @milestone ? "#{@milestone}" : "NO MILESTONE"
|
107
114
|
estimate = @estimate ? "#{@estimate}h" : "NO ESTIMATE"
|
108
115
|
milestone_estimate = "[#{estimate}, #{milestone}]"
|
109
|
-
|
116
|
+
|
110
117
|
result = []
|
111
118
|
result << PrettyComment.separator
|
112
119
|
result << PrettyComment.comment("#{@id[0,6]} #{@type.capitalize} (#{@status}) #{milestone_estimate} #{@created.to_s[0,16]}")
|
113
120
|
result << PrettyComment.comment("")
|
114
121
|
result << PrettyComment.format_line(@title, "#", false, "#")
|
115
|
-
|
122
|
+
|
116
123
|
if @description
|
117
124
|
result << PrettyComment.sub_heading("Description:")
|
118
125
|
@description.split("\n").each do |l|
|
119
126
|
result << PrettyComment.format_line(l, "#", false, "#")
|
120
127
|
end
|
121
128
|
end
|
122
|
-
|
129
|
+
|
123
130
|
if @history && @history.count > 0
|
124
131
|
result << PrettyComment.sub_heading("Log:")
|
125
132
|
@history.each { |l| result << PrettyComment.format_line("#{l.message}", "# #{l.date.to_s[0,16]}", true, "#", "#") }
|
126
133
|
end
|
127
|
-
|
134
|
+
|
128
135
|
result << PrettyComment.separator
|
129
136
|
result << ""
|
130
137
|
result << ""
|
131
|
-
|
138
|
+
|
132
139
|
result.join("\n")
|
133
140
|
end
|
134
141
|
|
@@ -148,8 +155,8 @@ class Issue
|
|
148
155
|
end
|
149
156
|
|
150
157
|
#suffix = estimate_milestone.count > 0 ? "[#{estimate_milestone.join(' => ')}]" : ""
|
151
|
-
|
152
|
-
PrettyComment.format_line(entry, info_string, true)
|
158
|
+
|
159
|
+
PrettyComment.format_line(entry, info_string, true)
|
153
160
|
end
|
154
161
|
|
155
162
|
#-------------------------------------------------------------------------------------------
|
@@ -170,12 +177,12 @@ class Issue
|
|
170
177
|
def edit_all
|
171
178
|
original_yaml = self.to_yaml
|
172
179
|
new_yaml = edit_string(original_yaml)
|
173
|
-
|
180
|
+
|
174
181
|
if (new_yaml != original_yaml)
|
175
182
|
self.copy_from(YAML::parse(new_string))
|
176
183
|
return true
|
177
|
-
end
|
178
|
-
|
184
|
+
end
|
185
|
+
|
179
186
|
return false
|
180
187
|
end
|
181
188
|
|
@@ -184,7 +191,7 @@ class Issue
|
|
184
191
|
def short_id
|
185
192
|
@id[0,6]
|
186
193
|
end
|
187
|
-
|
194
|
+
|
188
195
|
end
|
189
196
|
|
190
197
|
#===========================================================================================
|
@@ -193,60 +200,63 @@ end
|
|
193
200
|
|
194
201
|
class IssuesDb
|
195
202
|
fattr :issues_array
|
196
|
-
|
203
|
+
|
197
204
|
#-------------------------------------------------------------------------------------------
|
198
205
|
|
199
206
|
def initialize(database_file)
|
200
207
|
@database_file = database_file
|
201
|
-
@issues_array =
|
208
|
+
@issues_array = []
|
209
|
+
if FileTest.exists?(database_file)
|
210
|
+
@issues_array = YAML.safe_load_file(database_file, permitted_classes: [Issue, Date, Time, LogEntry])
|
211
|
+
end
|
202
212
|
end
|
203
|
-
|
213
|
+
|
204
214
|
#-------------------------------------------------------------------------------------------
|
205
215
|
|
206
216
|
def select_issues(&select_proc)
|
207
217
|
return @issues_array.select(&select_proc)
|
208
218
|
end
|
209
|
-
|
219
|
+
|
210
220
|
#-------------------------------------------------------------------------------------------
|
211
221
|
|
212
222
|
def select_issue(&select_proc)
|
213
223
|
result = select_issues(&select_proc)
|
214
|
-
|
224
|
+
|
215
225
|
if result.count == 1
|
216
226
|
return result[0]
|
217
|
-
|
227
|
+
|
218
228
|
elsif result.count > 1
|
219
229
|
puts "Found more than one issue that match this query:"
|
220
230
|
result.each{|i| puts("#{i.id} #{i.title}")}
|
221
231
|
exit
|
222
|
-
|
232
|
+
|
223
233
|
else
|
224
234
|
puts "Error: No issue found for query."
|
225
235
|
exit
|
226
236
|
end
|
227
237
|
|
228
238
|
nil
|
229
|
-
end
|
239
|
+
end
|
230
240
|
|
231
241
|
#-------------------------------------------------------------------------------------------
|
232
242
|
|
233
243
|
def has_issue(issue_id)
|
234
244
|
@issues_array.any? { |issue| issue.id.start_with?(issue_id) }
|
235
245
|
end
|
236
|
-
|
246
|
+
|
237
247
|
#-------------------------------------------------------------------------------------------
|
238
248
|
|
239
249
|
def save_db()
|
240
250
|
FileTest.exists?('.issues') || Dir.mkdir('.issues')
|
241
251
|
File.open(@database_file, 'w' ) { |out| YAML.dump(@issues_array, out) }
|
242
252
|
end
|
243
|
-
|
253
|
+
|
244
254
|
#-------------------------------------------------------------------------------------------
|
245
255
|
|
246
256
|
def determine_issue_type(opts)
|
247
257
|
issue_types = %w{bug improvement task feature}
|
248
258
|
issue_type = opts[:type] ? opts[:type].downcase : nil
|
249
|
-
|
259
|
+
|
250
260
|
issue_type && (return issue_type)
|
251
261
|
|
252
262
|
case opts[:title]
|
@@ -269,19 +279,19 @@ class IssuesDb
|
|
269
279
|
new_issue.milestone = opts[:milestone]
|
270
280
|
new_issue.estimate = opts[:estimate]
|
271
281
|
@issues_array << new_issue
|
272
|
-
save_db()
|
282
|
+
save_db()
|
273
283
|
puts "Created issue #{new_issue.short_id} #{new_issue.title}"
|
274
284
|
end
|
275
285
|
|
276
286
|
#-------------------------------------------------------------------------------------------
|
277
|
-
|
287
|
+
|
278
288
|
def select_issues_with_opts(opts)
|
279
|
-
did_select_issue_types = opts[:type]
|
289
|
+
did_select_issue_types = opts[:type]
|
280
290
|
status_regex = opts[:all] ? /^(open|resolved|duplicate|wontfix)/ : /^open$/
|
281
291
|
did_select_milestone = opts[:milestone] != nil
|
282
292
|
milestone = opts[:milestone]
|
283
|
-
|
284
|
-
return @issues_array.select do |issue|
|
293
|
+
|
294
|
+
return @issues_array.select do |issue|
|
285
295
|
(status_regex =~ issue.status) \
|
286
296
|
&& (issue.type == opts[:type] || !did_select_issue_types) \
|
287
297
|
&& (issue.milestone == opts[:milestone] \
|
@@ -362,7 +372,7 @@ class IssuesDb
|
|
362
372
|
|
363
373
|
duplicate_of_id = opts[:cmd] == "duplicate" && select_issue {|i| i.id.start_with?(opts[:duplicate_of_id]) }.id
|
364
374
|
|
365
|
-
status, message =
|
375
|
+
status, message =
|
366
376
|
case opts[:cmd]
|
367
377
|
when "resolve"
|
368
378
|
["resolved", "Resolved"]
|
@@ -376,17 +386,17 @@ class IssuesDb
|
|
376
386
|
|
377
387
|
resolved_issue.status = status
|
378
388
|
resolved_issue.log "Changed status to #{status}"
|
379
|
-
|
389
|
+
|
380
390
|
message = "#{message} issue #{resolved_issue.short_id}: #{resolved_issue.title}"
|
381
391
|
puts message
|
382
|
-
|
392
|
+
|
383
393
|
save_db()
|
384
394
|
|
385
395
|
if opts[:commit]
|
386
396
|
system "git add .issues"
|
387
397
|
system "git commit -m \"#{message}\""
|
388
398
|
end
|
389
|
-
|
399
|
+
|
390
400
|
if opts[:close_branch] == true
|
391
401
|
issue_branch = git_get_current_branch()
|
392
402
|
system "git checkout dev"
|
@@ -403,17 +413,17 @@ class IssuesDb
|
|
403
413
|
opts[:issue_ids].each do |issue_id|
|
404
414
|
delete_issues << select_issue{|i| i.id.start_with?(issue_id)}
|
405
415
|
end
|
406
|
-
|
416
|
+
|
407
417
|
puts "Ok to delete issues: "
|
408
418
|
delete_issues.each { |issue| puts "#{issue.short_id} \"#{issue.title}\"" }
|
409
419
|
puts "[y/N]"
|
410
|
-
|
420
|
+
|
411
421
|
answer = STDIN.getch
|
412
|
-
|
422
|
+
|
413
423
|
if /y/i =~ answer
|
414
424
|
@issues_array -= delete_issues
|
415
425
|
save_db()
|
416
|
-
|
426
|
+
|
417
427
|
if delete_issues.count == 1
|
418
428
|
puts "Removed issue #{delete_issues[0].short_id} \"#{delete_issues[0].title}\" from database."
|
419
429
|
else
|
@@ -429,16 +439,16 @@ class IssuesDb
|
|
429
439
|
|
430
440
|
def edit_issue(opts)
|
431
441
|
issue_id = opts[:issue_id]
|
432
|
-
issue = select_issue { |i| i.id.start_with?(issue_id) }
|
433
|
-
|
442
|
+
issue = select_issue { |i| i.id.start_with?(issue_id) }
|
443
|
+
|
434
444
|
did_change_issue = false
|
435
|
-
|
445
|
+
|
436
446
|
if (opts[:description])
|
437
447
|
did_change_issue = issue.edit_description && issue.log("Edited description")
|
438
448
|
else
|
439
449
|
did_change_issue = issue.edit_all && issue.log("Edited issue")
|
440
450
|
end
|
441
|
-
|
451
|
+
|
442
452
|
did_change_issue && save_db()
|
443
453
|
end
|
444
454
|
|
@@ -453,9 +463,9 @@ class IssuesDb
|
|
453
463
|
end
|
454
464
|
|
455
465
|
#-------------------------------------------------------------------------------------------
|
456
|
-
|
466
|
+
|
457
467
|
def get_milestones_for_pattern(pattern)
|
458
|
-
result_hash = {}
|
468
|
+
result_hash = {}
|
459
469
|
issues_array.each { |i| select_issue_for_estimate?(i, pattern) && result_hash[i.milestone] = true }
|
460
470
|
result_hash.keys.sort
|
461
471
|
end
|
@@ -465,24 +475,24 @@ class IssuesDb
|
|
465
475
|
def estimate(opts)
|
466
476
|
milestone = opts[:milestone]
|
467
477
|
total = 0.0
|
468
|
-
|
478
|
+
|
469
479
|
issues_to_estimate = @issues_array.select { |i| select_issue_for_estimate?(i, milestone) }
|
470
480
|
issues_without_estimates = @issues_array.select { |i| select_issue_for_estimate?(i, milestone) && !i.estimate }
|
471
481
|
|
472
|
-
if issues_to_estimate.empty?
|
482
|
+
if issues_to_estimate.empty?
|
473
483
|
puts "No open issues found for milestone " << milestone << "!"
|
474
484
|
exit
|
475
485
|
end
|
476
486
|
|
477
|
-
if issues_without_estimates.count > 0
|
487
|
+
if issues_without_estimates.count > 0
|
478
488
|
puts PrettyComment.h3("Warning: Found issues without estimates")
|
479
489
|
issues_without_estimates.each {|i| puts i.format_list(opts)}
|
480
490
|
puts PrettyComment.separator("-")
|
481
491
|
puts
|
482
492
|
end
|
483
|
-
|
493
|
+
|
484
494
|
issues_to_estimate.each { |i| (i.estimate && total += i.estimate) }
|
485
|
-
|
495
|
+
|
486
496
|
milestones = get_milestones_for_pattern(milestone)
|
487
497
|
|
488
498
|
result_str = "Milestone" << (milestones.length > 1 ? "s" : "")
|
@@ -497,12 +507,12 @@ class IssuesDb
|
|
497
507
|
new_type = opts[:type]
|
498
508
|
new_milestone = opts[:milestone]
|
499
509
|
new_estimate = opts[:estimate]
|
500
|
-
|
510
|
+
|
501
511
|
opts[:issue_ids].each do |issue_id|
|
502
512
|
did_update = false
|
503
513
|
issue = select_issue { |i| i.id.start_with?(issue_id) }
|
504
514
|
|
505
|
-
if new_type
|
515
|
+
if new_type
|
506
516
|
if issue.type != new_type
|
507
517
|
issue.type = new_type
|
508
518
|
issue.log("Changed type to #{issue.type}")
|
@@ -542,14 +552,14 @@ class IssuesDb
|
|
542
552
|
#-------------------------------------------------------------------------------------------
|
543
553
|
|
544
554
|
def start_branch(opts)
|
545
|
-
git_get_current_branch() == "dev" ||
|
546
|
-
|
555
|
+
git_get_current_branch() == "dev" || Optimist::die("Must be on dev branch to start new issue branch.")
|
556
|
+
|
547
557
|
issue_id = opts[:issue_id]
|
548
558
|
issue = select_issue{|i| i.id.start_with?(issue_id) && i.status == "open"}
|
549
559
|
|
550
560
|
system("git checkout -b #{issue.type}/#{issue.short_id}")
|
551
561
|
end
|
552
|
-
|
562
|
+
|
553
563
|
#-------------------------------------------------------------------------------------------
|
554
564
|
|
555
565
|
|
@@ -563,11 +573,11 @@ end
|
|
563
573
|
def get_issue_ids(num_ids, usage)
|
564
574
|
result = []
|
565
575
|
count = num_ids >= 0 ? num_ids : ARGV.count
|
566
|
-
|
576
|
+
|
567
577
|
begin
|
568
578
|
count.times do
|
569
|
-
ARGV.count > 0 && /^\h{1,32}$/ =~ ARGV[0] || raise
|
570
|
-
result << ARGV.shift
|
579
|
+
ARGV.count > 0 && /^\h{1,32}$/ =~ ARGV[0] || raise
|
580
|
+
result << ARGV.shift
|
571
581
|
end
|
572
582
|
|
573
583
|
result.count == 1 && num_ids > 0 ? result[0] : result
|
@@ -596,21 +606,21 @@ SUB_COMMANDS = {
|
|
596
606
|
"update" => "update issue fields.",
|
597
607
|
"startbranch" => "start a new git branch with to work on issue"}
|
598
608
|
|
599
|
-
LeftFieldLength =
|
609
|
+
LeftFieldLength =
|
600
610
|
SUB_COMMANDS.collect { |key, value| key.length }.max
|
601
|
-
|
611
|
+
|
602
612
|
SubCommandHelp =
|
603
613
|
SUB_COMMANDS.collect {|key,value| " #{key.ljust(LeftFieldLength)} #{value}"}.join("\n")
|
604
614
|
|
605
|
-
|
606
|
-
global_opts =
|
615
|
+
|
616
|
+
global_opts = Optimist::options do
|
607
617
|
banner <<-EOL
|
608
618
|
issues: lightweight distributed issue management.
|
609
|
-
|
619
|
+
|
610
620
|
Usage:
|
611
621
|
------
|
612
622
|
issues [<command>] [<options] [<args>]
|
613
|
-
|
623
|
+
|
614
624
|
Commands are:
|
615
625
|
-------------
|
616
626
|
#{SubCommandHelp}
|
@@ -628,37 +638,37 @@ cmd ||= 'list'
|
|
628
638
|
cmd_opts = {}
|
629
639
|
|
630
640
|
if cmd == 'list' || cmd == 'count'
|
631
|
-
cmd_opts =
|
632
|
-
|
641
|
+
cmd_opts =
|
642
|
+
Optimist::options do
|
633
643
|
opt :all, "#{cmd} all issues", :short => 'a'
|
634
644
|
opt :newest, "#{cmd} newest issues first" if cmd == 'list'
|
635
645
|
opt :oldest, "#{cmd} oldest issues first" if cmd == 'list'
|
636
646
|
opt :verbose, "verbose list of issues", :short => 'v' if cmd == 'list'
|
637
|
-
opt :type, "#{cmd} issues of given type (bug, improvement, task, feature)", :short => 't', :type => String
|
647
|
+
opt :type, "#{cmd} issues of given type (bug, improvement, task, feature)", :short => 't', :type => String
|
638
648
|
opt :milestone, "#{cmd} issues for given milestone", :short => 'm', :type => String
|
639
649
|
opt "no-milestone", "#{cmd} all issues not assigned to any milestone"
|
640
650
|
end
|
641
|
-
|
651
|
+
|
642
652
|
if cmd == 'list'
|
643
653
|
ARGV.count > 0 && cmd_opts[:issue_id] = get_issue_ids(1, "list ID")
|
644
654
|
end
|
645
655
|
|
646
656
|
elsif cmd == "create"
|
647
|
-
cmd_opts =
|
648
|
-
|
657
|
+
cmd_opts =
|
658
|
+
Optimist::options do
|
649
659
|
opt :type, "create issue of specific type (e.g. bug, feature, improvement, task)", :short => 't', :type => String
|
650
660
|
opt :milestone, "specify the milestone of the new issue", :short => 'm', :type => String
|
651
661
|
opt :estimate, "specify the estimated effort", :short => 'e', :type => Float
|
652
662
|
end
|
653
|
-
cmd_opts[:title] = ARGV.shift ||
|
663
|
+
cmd_opts[:title] = ARGV.shift || Optimist::die( "Please enter a title for the new issue!")
|
654
664
|
|
655
665
|
|
656
666
|
elsif cmd == "resolve" || cmd == "wontfix" || cmd == "duplicate" || cmd == "cantreproduce"
|
657
|
-
cmd_opts =
|
658
|
-
|
667
|
+
cmd_opts =
|
668
|
+
Optimist::options do
|
659
669
|
opt :commit, "do a git commit", :short => 'c'
|
660
670
|
end
|
661
|
-
|
671
|
+
|
662
672
|
if cmd == "duplicate"
|
663
673
|
cmd_opts[:issue_id], cmd_opts[:duplicate_of_id] = get_issue_ids(2, "duplicate ID(issue) ID(duplicate of)")
|
664
674
|
elsif cmd == "resolve" && is_issue_branch()
|
@@ -668,17 +678,17 @@ elsif cmd == "resolve" || cmd == "wontfix" || cmd == "duplicate" || cmd == "cant
|
|
668
678
|
else
|
669
679
|
cmd_opts[:issue_id] = get_issue_ids(1, "#{cmd} [-c] ID")
|
670
680
|
end
|
671
|
-
|
672
|
-
|
681
|
+
|
682
|
+
|
673
683
|
elsif cmd == "edit"
|
674
|
-
cmd_opts =
|
675
|
-
|
684
|
+
cmd_opts =
|
685
|
+
Optimist::options do
|
676
686
|
opt :description, "edit the issue description", :short => 'd'
|
677
687
|
end
|
678
|
-
cmd_opts[:issue_id] = get_issue_ids(1, "edit ID")
|
679
|
-
|
688
|
+
cmd_opts[:issue_id] = get_issue_ids(1, "edit ID")
|
689
|
+
|
680
690
|
elsif cmd == "estimate"
|
681
|
-
|
691
|
+
Optimist::options do
|
682
692
|
banner <<-EOL
|
683
693
|
Usage:
|
684
694
|
------
|
@@ -689,7 +699,7 @@ Options:
|
|
689
699
|
EOL
|
690
700
|
end
|
691
701
|
|
692
|
-
ARGV.count > 0 ||
|
702
|
+
ARGV.count > 0 || Optimist::die("Usage: issues estmiate MILSTONE")
|
693
703
|
cmd_opts[:milestone] = ARGV.shift
|
694
704
|
|
695
705
|
elsif cmd == "update"
|
@@ -706,15 +716,15 @@ Options:
|
|
706
716
|
--------
|
707
717
|
EOL
|
708
718
|
|
709
|
-
cmd_opts =
|
719
|
+
cmd_opts = Optimist::options do
|
710
720
|
banner my_banner
|
711
721
|
opt :type, "update the issue type", :short => 't', :type => String
|
712
722
|
opt :milestone, "update the milestone", :short => 'm', :type => String
|
713
723
|
opt :estimate, "update the estimate", :short => 'e', :type => Float
|
714
724
|
end
|
715
725
|
|
716
|
-
cmd_opts[:type] && (%w{bug improvement task feature}.include?(cmd_opts[:type]) ||
|
717
|
-
cmd_opts[:type] || cmd_opts[:milestone] || cmd_opts[:estimate] ||
|
726
|
+
cmd_opts[:type] && (%w{bug improvement task feature}.include?(cmd_opts[:type]) || Optimist::die("Please specify one of [bug, improvement, task, freature] as new issue type"))
|
727
|
+
cmd_opts[:type] || cmd_opts[:milestone] || cmd_opts[:estimate] || Optimist::die("You must specify one of (--type, --milestone, --estimate)")
|
718
728
|
|
719
729
|
ARGV.count > 0 && cmd_opts[:issue_ids] = get_issue_ids(-1, "set-type {bug|improvement|task|feature} ID")
|
720
730
|
|
@@ -724,14 +734,14 @@ elsif cmd == "delete"
|
|
724
734
|
|
725
735
|
|
726
736
|
elsif cmd == "startbranch"
|
727
|
-
cmd_opts[:issue_id] = get_issue_ids(1, "list ID") ||
|
737
|
+
cmd_opts[:issue_id] = get_issue_ids(1, "list ID") || Optimist::die( "Please enter an id for the issue to work on in the new branch!")
|
728
738
|
|
729
739
|
else
|
730
|
-
|
740
|
+
Optimist::die "unknown command #{cmd.inspect}"
|
731
741
|
end
|
732
742
|
|
733
743
|
|
734
|
-
cmd_opts[:cmd] = cmd
|
744
|
+
cmd_opts[:cmd] = cmd
|
735
745
|
|
736
746
|
|
737
747
|
#===========================================================================================
|
@@ -744,9 +754,9 @@ cmd_opts[:milestone_column_width] = Issues.milestone_column_width()
|
|
744
754
|
cmd_opts[:list_milestone] = Issues.has_open_issues_with_milestone?()
|
745
755
|
|
746
756
|
case cmd
|
747
|
-
when "create"
|
757
|
+
when "create"
|
748
758
|
Issues.create_issue(cmd_opts)
|
749
|
-
when "list"
|
759
|
+
when "list"
|
750
760
|
Issues.list_issues(cmd_opts)
|
751
761
|
when "count"
|
752
762
|
Issues.count_issues(cmd_opts)
|
@@ -765,4 +775,3 @@ case cmd
|
|
765
775
|
end
|
766
776
|
|
767
777
|
#===========================================================================================
|
768
|
-
|
metadata
CHANGED
@@ -1,19 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-issues
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wolfgang Steiner
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: PrettyComment
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.1'
|
17
20
|
- - ">="
|
18
21
|
- !ruby/object:Gem::Version
|
19
22
|
version: 0.1.2
|
@@ -21,37 +24,52 @@ dependencies:
|
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.1'
|
24
30
|
- - ">="
|
25
31
|
- !ruby/object:Gem::Version
|
26
32
|
version: 0.1.2
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
34
|
+
name: optimist
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3.0'
|
31
40
|
- - ">="
|
32
41
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
42
|
+
version: 3.0.1
|
34
43
|
type: :runtime
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '3.0'
|
38
50
|
- - ">="
|
39
51
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
52
|
+
version: 3.0.1
|
41
53
|
- !ruby/object:Gem::Dependency
|
42
54
|
name: fattr
|
43
55
|
requirement: !ruby/object:Gem::Requirement
|
44
56
|
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '2.4'
|
45
60
|
- - ">="
|
46
61
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.
|
62
|
+
version: 2.4.0
|
48
63
|
type: :runtime
|
49
64
|
prerelease: false
|
50
65
|
version_requirements: !ruby/object:Gem::Requirement
|
51
66
|
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '2.4'
|
52
70
|
- - ">="
|
53
71
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.
|
72
|
+
version: 2.4.0
|
55
73
|
description: Issues is a lightweight, git-style command-line issue tracker.
|
56
74
|
email: wolfgang.steiner@gmail.com
|
57
75
|
executables:
|
@@ -63,10 +81,9 @@ files:
|
|
63
81
|
- bin/issues
|
64
82
|
- bin/todos
|
65
83
|
homepage: https://github.com/WolfgangSteiner/Issues
|
66
|
-
licenses:
|
67
|
-
- MIT
|
84
|
+
licenses: []
|
68
85
|
metadata: {}
|
69
|
-
post_install_message:
|
86
|
+
post_install_message:
|
70
87
|
rdoc_options: []
|
71
88
|
require_paths:
|
72
89
|
- lib
|
@@ -81,9 +98,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
98
|
- !ruby/object:Gem::Version
|
82
99
|
version: '0'
|
83
100
|
requirements: []
|
84
|
-
|
85
|
-
|
86
|
-
signing_key:
|
101
|
+
rubygems_version: 3.5.7
|
102
|
+
signing_key:
|
87
103
|
specification_version: 4
|
88
104
|
summary: Git-style issue tracker.
|
89
105
|
test_files: []
|