bugzyrb 0.3.4 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/NOTES +89 -0
- data/VERSION +1 -1
- data/bugzyrb.gemspec +22 -28
- data/lib/bugzyrb/common/cmdapp.rb +1 -0
- data/lib/bugzyrb/common/colorconstants.rb +2 -1
- data/lib/bugzyrb.rb +163 -31
- metadata +3 -2
data/NOTES
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
|
2
|
+
Subject: version and others
|
3
|
+
---------------------------
|
4
|
+
Date: 2010-07-03 11:36
|
5
|
+
|
6
|
+
Wondering if we shoud add fields such as:
|
7
|
+
|
8
|
+
* version (of software)
|
9
|
+
* environment
|
10
|
+
* estimated time
|
11
|
+
* actual time
|
12
|
+
|
13
|
+
Version can be put as a tag. Can add estimate time, though.
|
14
|
+
|
15
|
+
* * * * * * * *
|
16
|
+
|
17
|
+
Subject: project and component
|
18
|
+
------------------------------
|
19
|
+
Date: 2010-07-03 11:40
|
20
|
+
|
21
|
+
Should we keep project and component as a tag or as a separate field
|
22
|
+
altogether ?
|
23
|
+
|
24
|
+
I am assuming each file is for a project, so its not a global database.
|
25
|
+
Thus component can be thought of. However, if someone chooses just one
|
26
|
+
database, then we need to make it easy to work at project level.
|
27
|
+
Perhaps, env variable.
|
28
|
+
|
29
|
+
* * * * * * * *
|
30
|
+
|
31
|
+
Subject: project component version
|
32
|
+
----------------------------------
|
33
|
+
Date: 2010-07-06 20:14
|
34
|
+
|
35
|
+
set $use_project in cfg file
|
36
|
+
same for $component or version.
|
37
|
+
If true, then I will prompt for it in "add" operation.
|
38
|
+
|
39
|
+
valid_xx allows me to validate.
|
40
|
+
default_xx is default value used if no prompt
|
41
|
+
prompt_xx is if user to be prompted
|
42
|
+
- :freeform : allow any entry, if blank, use default
|
43
|
+
- :false : don't prompt, use default if present
|
44
|
+
- :choice : use valid_xx array to give choice to user
|
45
|
+
- true : uses choice if valid_xx prsent else freeform
|
46
|
+
|
47
|
+
user_input() takes care of deciding what to do.
|
48
|
+
|
49
|
+
* * * * * * * *
|
50
|
+
|
51
|
+
Subject: start date
|
52
|
+
-------------------
|
53
|
+
Date: 2010-07-07 19:55
|
54
|
+
|
55
|
+
currently start date goes as current time.
|
56
|
+
|
57
|
+
It's meant to be when you expect to start. (Later it can be updated with
|
58
|
+
actual start date.) Thus at bug creation, it should not really be
|
59
|
+
filled. Should we leave it blank and not put a default ?
|
60
|
+
|
61
|
+
* * * * * * * *
|
62
|
+
|
63
|
+
Subject: readline for old values
|
64
|
+
--------------------------------
|
65
|
+
Date: 2010-07-08 00:22
|
66
|
+
|
67
|
+
i am using readline for some input, so i can show earlier entered values
|
68
|
+
for that column. I am saving that to a file.
|
69
|
+
Should i put that in database ?
|
70
|
+
File one, will be usable in other cases, too, but currently it relies on
|
71
|
+
current directory, and could clutter up disk. I use one file per column.
|
72
|
+
I could use yaml and a hash.
|
73
|
+
|
74
|
+
I am only using in cases of freeform where i don't have a list, such as
|
75
|
+
version, project, component.
|
76
|
+
|
77
|
+
* * * * * * * *
|
78
|
+
|
79
|
+
Subject: New version of Sqlite3
|
80
|
+
-------------------------------
|
81
|
+
Date: 2011-09-21 19:50
|
82
|
+
|
83
|
+
Due to sqlite3 no longer supporting arrayfields, almost everything had
|
84
|
+
begun crashing. I've fixed things here. Still sometimes results_as_hash
|
85
|
+
or db_translation gives an error saying columns() not supported by Array
|
86
|
+
in its own code. So i am having to set these values in each command
|
87
|
+
individually. Its dirty.
|
88
|
+
|
89
|
+
* * * * * * * *
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.6
|
data/bugzyrb.gemspec
CHANGED
@@ -1,49 +1,46 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{bugzyrb}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
12
|
-
s.date = %q{
|
13
|
-
s.default_executable = %q{bugzyrb}
|
11
|
+
s.authors = [%q{Rahul Kumar}]
|
12
|
+
s.date = %q{2011-10-06}
|
14
13
|
s.description = %q{basic, easy-to-use command-line issue-tracker using sqlite for ruby 1.9}
|
15
14
|
s.email = %q{sentinel1879@gmail.com}
|
16
|
-
s.executables = [
|
15
|
+
s.executables = [%q{bugzyrb}]
|
17
16
|
s.extra_rdoc_files = [
|
18
17
|
"LICENSE",
|
19
|
-
|
18
|
+
"README.rdoc"
|
20
19
|
]
|
21
20
|
s.files = [
|
22
21
|
".document",
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
22
|
+
"CHANGELOG.rdoc",
|
23
|
+
"LICENSE",
|
24
|
+
"NOTES",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"bin/bugzyrb",
|
29
|
+
"bugzy.cfg",
|
30
|
+
"bugzyrb.gemspec",
|
31
|
+
"lib/bugzyrb.rb",
|
32
|
+
"lib/bugzyrb/common/cmdapp.rb",
|
33
|
+
"lib/bugzyrb/common/colorconstants.rb",
|
34
|
+
"lib/bugzyrb/common/db.rb",
|
35
|
+
"lib/bugzyrb/common/sed.rb"
|
37
36
|
]
|
38
37
|
s.homepage = %q{http://github.com/rkumar/bugzyrb}
|
39
|
-
s.
|
40
|
-
s.require_paths = ["lib"]
|
38
|
+
s.require_paths = [%q{lib}]
|
41
39
|
s.rubyforge_project = %q{bugzyrb}
|
42
|
-
s.rubygems_version = %q{1.
|
40
|
+
s.rubygems_version = %q{1.8.8}
|
43
41
|
s.summary = %q{command-line bug/issue tracker using sqlite, ruby 1.9}
|
44
42
|
|
45
43
|
if s.respond_to? :specification_version then
|
46
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
47
44
|
s.specification_version = 3
|
48
45
|
|
49
46
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
@@ -52,14 +49,12 @@ Gem::Specification.new do |s|
|
|
52
49
|
s.add_runtime_dependency(%q<highline>, [">= 1.5.2"])
|
53
50
|
s.add_runtime_dependency(%q<terminal-table>, [">= 1.4.2"])
|
54
51
|
s.add_runtime_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
55
|
-
s.add_runtime_dependency(%q<arrayfields>, [">= 4.7.4"])
|
56
52
|
else
|
57
53
|
s.add_dependency(%q<yard>, [">= 0.5"])
|
58
54
|
s.add_dependency(%q<subcommand>, [">= 1.0.5"])
|
59
55
|
s.add_dependency(%q<highline>, [">= 1.5.2"])
|
60
56
|
s.add_dependency(%q<terminal-table>, [">= 1.4.2"])
|
61
57
|
s.add_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
62
|
-
s.add_dependency(%q<arrayfields>, [">= 4.7.4"])
|
63
58
|
end
|
64
59
|
else
|
65
60
|
s.add_dependency(%q<yard>, [">= 0.5"])
|
@@ -67,7 +62,6 @@ Gem::Specification.new do |s|
|
|
67
62
|
s.add_dependency(%q<highline>, [">= 1.5.2"])
|
68
63
|
s.add_dependency(%q<terminal-table>, [">= 1.4.2"])
|
69
64
|
s.add_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
70
|
-
s.add_dependency(%q<arrayfields>, [">= 4.7.4"])
|
71
65
|
end
|
72
66
|
end
|
73
67
|
|
@@ -33,12 +33,13 @@ module ColorConstants
|
|
33
33
|
BLINK = "\e[5m"
|
34
34
|
# The start of an ANSI reverse sequence.
|
35
35
|
REVERSE = "\e[7m"
|
36
|
+
STANDOUT = REVERSE
|
36
37
|
# The start of an ANSI concealed sequence. (Terminal support uncommon.)
|
37
38
|
CONCEALED = "\e[8m"
|
38
39
|
|
39
40
|
# added from http://understudy.net/custom.html
|
40
41
|
BOLD_OFF = "\e[22m"
|
41
|
-
|
42
|
+
UNDERLINE_OFF = "\e[24m"
|
42
43
|
BLINK_OFF = "\e[25m"
|
43
44
|
REVERSE_OFF = "\e[27m"
|
44
45
|
|
data/lib/bugzyrb.rb
CHANGED
@@ -22,12 +22,27 @@ include Cmdapp
|
|
22
22
|
include Subcommands
|
23
23
|
include Database
|
24
24
|
|
25
|
-
#
|
26
|
-
#
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
# monkey_patch for terminal_table using coloring, does *not* work perfectly here
|
26
|
+
# https://gist.github.com/625808
|
27
|
+
ELIMINATE_ANSI_ESCAPE = true
|
28
|
+
class String
|
29
|
+
alias_method :to_s_orig, :to_s
|
30
|
+
def to_s
|
31
|
+
str = self.to_s_orig
|
32
|
+
if ::ELIMINATE_ANSI_ESCAPE
|
33
|
+
str = str.sub(/^\e\[[\[\e0-9;m]+m/, "")
|
34
|
+
str = str.sub(/(\e\[[\[\e0-9;m]+m)$/, "")
|
35
|
+
# Above works for only one, beg or eol
|
36
|
+
str = str.gsub(/\e\[[\[\e0-9;m]+m/, "")
|
37
|
+
#str = str.gsub(/(\e\[[\[\e0-9;m]+m)/, "")
|
38
|
+
end
|
39
|
+
str
|
40
|
+
end
|
41
|
+
end
|
42
|
+
# end monkey
|
43
|
+
#
|
44
|
+
VERSION = "0.3.5"
|
45
|
+
DATE = "2011-09-30"
|
31
46
|
APPNAME = File.basename($0)
|
32
47
|
AUTHOR = "rkumar"
|
33
48
|
|
@@ -54,10 +69,10 @@ class Bugzy
|
|
54
69
|
# $ bugzyrb -d ~/
|
55
70
|
#
|
56
71
|
# == Close a task (mark as done)
|
57
|
-
# $ bugzyrb
|
72
|
+
# $ bugzyrb close 1
|
58
73
|
#
|
59
|
-
# ==
|
60
|
-
# $ bugzyrb pri
|
74
|
+
# == Change priority of items 4 and 6 to P2
|
75
|
+
# $ bugzyrb pri P2 4 6
|
61
76
|
#
|
62
77
|
# For more:
|
63
78
|
# $ bugzyrb --help
|
@@ -65,8 +80,10 @@ class Bugzy
|
|
65
80
|
# $ alias bu='bugzyrb'
|
66
81
|
#
|
67
82
|
# == TODO:
|
68
|
-
#
|
69
|
-
#
|
83
|
+
# -- archive completed tasks
|
84
|
+
# -- i cannot do any coloring with fields i have not selected. I need to get around this
|
85
|
+
# of having fields in select that are not displayed. Such as type/priority/date
|
86
|
+
# -- refactor and cleanup, its a mess. Should be able to configure coloring elsewhere.
|
70
87
|
#
|
71
88
|
def initialize options, argv
|
72
89
|
|
@@ -82,8 +99,8 @@ class Bugzy
|
|
82
99
|
@app_default_action = "list" # TODO:
|
83
100
|
@file = @app_file_path = @options[:file] || "bugzy.sqlite"
|
84
101
|
#@app_serial_path = File.expand_path("~/serial_numbers")
|
85
|
-
|
86
|
-
|
102
|
+
#@deleted_path = "todo_deleted.txt"
|
103
|
+
#@todo_delim = "\t"
|
87
104
|
@appname = File.basename( Dir.getwd ) #+ ".#{$0}"
|
88
105
|
# in order to support the testing framework
|
89
106
|
t = Time.now
|
@@ -187,7 +204,17 @@ SQL
|
|
187
204
|
|
188
205
|
0
|
189
206
|
end
|
207
|
+
# get a connection to the database, checking up 3 levels.
|
190
208
|
def get_db
|
209
|
+
# we want to check a couple levels 2011-09-28
|
210
|
+
unless @db
|
211
|
+
unless File.exists? @file
|
212
|
+
3.times do |i|
|
213
|
+
@file = "../#{@file}"
|
214
|
+
break if File.exists? @file
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
191
218
|
@db ||= DB.new @file
|
192
219
|
end
|
193
220
|
# returns default due date for add or qadd
|
@@ -241,6 +268,10 @@ SQL
|
|
241
268
|
exit ERRCODE
|
242
269
|
end
|
243
270
|
else
|
271
|
+
# if you add last arg as P1..P5, I'll update priority automatically
|
272
|
+
if args.last =~ /P[1-5]/
|
273
|
+
$default_priority = args.pop
|
274
|
+
end
|
244
275
|
text = args.join " "
|
245
276
|
end
|
246
277
|
# convert actual newline to C-a. slash n's are escapes so echo -e does not muck up.
|
@@ -357,7 +388,7 @@ TEXT
|
|
357
388
|
die "No data found for #{id}" unless row
|
358
389
|
puts "[#{row['type']} \##{row['id']}] #{row['title']}"
|
359
390
|
puts "Description:"
|
360
|
-
puts Cmdapp.indent(row['description'],3)
|
391
|
+
puts Cmdapp.indent(row['description'],3) if row['description']
|
361
392
|
puts "\nAdded by #{row['created_by']} on #{row['date_created']}. Updated #{row['date_modified']}."
|
362
393
|
comment_count = 0
|
363
394
|
#puts row
|
@@ -426,6 +457,8 @@ TEXT
|
|
426
457
|
editable << "project" if $use_project
|
427
458
|
editable << "component" if $use_component
|
428
459
|
editable << "version" if $use_version
|
460
|
+
print_green row['title']
|
461
|
+
print_green row['description'] if row['description']
|
429
462
|
sel = Cmdapp._choice "Select field to edit", editable
|
430
463
|
print "You chose: #{sel}"
|
431
464
|
old = row[sel]
|
@@ -448,6 +481,12 @@ TEXT
|
|
448
481
|
message str
|
449
482
|
db.sql_update "bugs", id, sel, str
|
450
483
|
puts "Updated #{id}"
|
484
|
+
if sel == 'status' && ['canceled', 'closed'].include?(str)
|
485
|
+
curr_status = row['priority']
|
486
|
+
value = curr_status.sub(/P/,'X')
|
487
|
+
db.sql_update "bugs", id, 'priority', value
|
488
|
+
puts "Updated #{id}'s PRI from #{str} to #{value} "
|
489
|
+
end
|
451
490
|
sstr = Cmdapp.truncate(str.to_s,50)
|
452
491
|
rowid = db.sql_logs_insert id, sel, "[#{id}] updated [#{sel}] with #{sstr}"
|
453
492
|
0
|
@@ -506,7 +545,7 @@ TEXT
|
|
506
545
|
row = db.sql_select_rowid "bugs", id
|
507
546
|
die "No data found for #{id}" unless row
|
508
547
|
puts "[#{row['type']} \##{row['id']}] #{row['title']}"
|
509
|
-
puts row['description']
|
548
|
+
puts row['description'] if row['description']
|
510
549
|
puts
|
511
550
|
ctr = 0
|
512
551
|
db.select_where "log", "id", id do |r|
|
@@ -533,14 +572,25 @@ TEXT
|
|
533
572
|
db = get_db
|
534
573
|
#db.run "select * from bugs " do |row|
|
535
574
|
#end
|
536
|
-
|
537
|
-
|
575
|
+
# will not be able to find title due to function
|
576
|
+
descdelim = '>>'
|
577
|
+
#fields = 'id,status,type,priority,substr(title || " >>" || ifnull(description,""),0,85)'
|
578
|
+
fields = %Q[id,status,type,priority,substr(title || " #{descdelim}" || ifnull(description,""),0,85)]
|
579
|
+
format = "%-3s | %-7s | %-5s | %-60s "
|
538
580
|
if @options[:short]
|
539
581
|
fields = "id,status,title"
|
582
|
+
format = "%3s | %6s | %60s "
|
540
583
|
elsif @options[:long]
|
541
|
-
fields = "id,status,
|
542
|
-
|
584
|
+
fields = "id,status,priority,title,description"
|
585
|
+
format = "%-3s|%-7s|%-5s | %-60s |%-s"
|
543
586
|
end
|
587
|
+
fieldsarr = fields.split(",") # NOTE comma in ifnull function
|
588
|
+
descindex = fieldsarr.index("description")
|
589
|
+
titleindex = fieldsarr.index("title") || 4 # fieldsarr.count-1 due to comman in ifnull XXX NOTE
|
590
|
+
statindex = fieldsarr.index("status")
|
591
|
+
priindex = fieldsarr.index("priority")
|
592
|
+
typeindex = fieldsarr.index("type")
|
593
|
+
|
544
594
|
where = nil
|
545
595
|
wherestring = ""
|
546
596
|
if @options[:open]
|
@@ -550,7 +600,7 @@ TEXT
|
|
550
600
|
if @options[:overdue]
|
551
601
|
#where = %{ where status != 'closed' and due_date <= "#{Date.today}" }
|
552
602
|
where ||= []
|
553
|
-
where << %{ status != 'closed'}
|
603
|
+
where << %{ status != 'closed' and status != 'canceled'}
|
554
604
|
where << %{ due_date <= "#{Date.today}" }
|
555
605
|
end
|
556
606
|
if @options[:unassigned]
|
@@ -561,27 +611,32 @@ TEXT
|
|
561
611
|
# added 2011-09-28 so we don't see closed all the time.
|
562
612
|
if !where && !@options[:show_all]
|
563
613
|
where ||= []
|
564
|
-
where << %{ status != 'closed'}
|
614
|
+
where << %{ status != 'closed' and status != 'canceled'}
|
565
615
|
end
|
566
616
|
if where
|
567
617
|
wherestring = " where " + where.join(" and ")
|
568
618
|
end
|
569
|
-
|
619
|
+
orderstring ||= " order by status asc, priority desc " # 2011-09-30 so highest prio comes at end
|
620
|
+
puts wherestring if @options[:verbose]
|
570
621
|
|
571
622
|
db.db.type_translation = true
|
572
623
|
db.db.results_as_hash = false # 2011-09-21
|
573
|
-
rows = db.run "select #{fields} from bugs #{wherestring} "
|
624
|
+
rows = db.run "select #{fields} from bugs #{wherestring} #{orderstring} "
|
574
625
|
db.db.type_translation = false
|
575
626
|
die "No rows" unless rows
|
576
627
|
|
577
628
|
rows = Cmdapp.filter_rows( rows, incl) do |row, regexp|
|
578
629
|
#row['title'] =~ regexp
|
579
|
-
row[
|
630
|
+
row[titleindex] =~ regexp
|
580
631
|
end
|
581
632
|
rows = Cmdapp.filter_rows( rows, excl) do |row, regexp|
|
582
633
|
#row['title'] !~ regexp
|
583
|
-
row[
|
634
|
+
row[titleindex] !~ regexp
|
584
635
|
end
|
636
|
+
fields.sub!( /priority/, "pri")
|
637
|
+
fields.sub!( /status/, "sta")
|
638
|
+
fields.sub!( /severity/, "sev")
|
639
|
+
fields.sub!( /substr.*/, "title") # XXX depends on function used on title
|
585
640
|
headings = fields.split ","
|
586
641
|
# if you want to filter output send a delimiter
|
587
642
|
if $bare
|
@@ -591,8 +646,10 @@ TEXT
|
|
591
646
|
# d = e['description'] # changed 2011 dts
|
592
647
|
if descindex
|
593
648
|
d = e[descindex]
|
594
|
-
e[descindex]
|
649
|
+
e[descindex].gsub!(/\n/," ") if d
|
595
650
|
end
|
651
|
+
e[typeindex] = e[typeindex][0,3] if typeindex
|
652
|
+
e[statindex] = e[statindex][0,2] if statindex
|
596
653
|
puts e.join delim
|
597
654
|
end
|
598
655
|
else
|
@@ -600,13 +657,66 @@ TEXT
|
|
600
657
|
puts "No rows"
|
601
658
|
return
|
602
659
|
end
|
660
|
+
# NOTE: terminal table gets the widths wrong because of coloring info.
|
661
|
+
if @options[:colored]
|
662
|
+
#require 'colored'
|
663
|
+
startrow = nil
|
664
|
+
fr = titleindex
|
665
|
+
rows.each_with_index do |e, index|
|
666
|
+
s = e[titleindex]
|
667
|
+
s.gsub!("\n", ";")
|
668
|
+
s.gsub!(/(#\w+)/,"#{UNDERLINE}\\1#{UNDERLINE_OFF}")
|
669
|
+
s.gsub!(/(>>.*)/,"#{GREEN}\\1#{CLEAR}")
|
670
|
+
st = e[statindex]
|
671
|
+
e[statindex] = e[statindex][0,2]
|
672
|
+
e[typeindex] = e[typeindex][0,3] if typeindex
|
673
|
+
if typeindex
|
674
|
+
case e[typeindex]
|
675
|
+
when 'bug'
|
676
|
+
e[typeindex] = "#{RED}#{e[typeindex]}#{CLEAR}"
|
677
|
+
when 'enh'
|
678
|
+
e[typeindex] = "#{WHITE}#{e[typeindex]}#{CLEAR}"
|
679
|
+
else
|
680
|
+
e[typeindex] = "#{CYAN}#{e[typeindex]}#{CLEAR}"
|
681
|
+
end
|
682
|
+
end
|
683
|
+
frv = e[fr]
|
684
|
+
if st == 'started'
|
685
|
+
startrow = index unless startrow
|
686
|
+
e[fr] = "#{STANDOUT}#{frv}" # changed 2011 dts whole line green
|
687
|
+
#e[0] = e[0].to_s.red
|
688
|
+
|
689
|
+
e[-1] = "#{e[-1]}#{CLEAR}"
|
690
|
+
else
|
691
|
+
if priindex
|
692
|
+
pri = e[priindex]
|
693
|
+
case pri
|
694
|
+
when "P4", "P5"
|
695
|
+
e[fr] = "#{BLUE}#{frv}"
|
696
|
+
e[-1] = "#{e[-1]}#{CLEAR}"
|
697
|
+
when "P1"
|
698
|
+
e[fr] = "#{YELLOW}#{ON_RED}#{frv}"
|
699
|
+
e[-1] = "#{e[-1]}#{CLEAR}"
|
700
|
+
when "P2"
|
701
|
+
e[fr] = "#{BOLD}#{frv}"
|
702
|
+
e[-1] = "#{e[-1]}#{CLEAR}"
|
703
|
+
else
|
704
|
+
#e[fr] = "#{CLEAR}#{frv}"
|
705
|
+
end
|
706
|
+
end
|
707
|
+
end
|
708
|
+
|
709
|
+
#print "#{format}\n" % e
|
710
|
+
end
|
711
|
+
rows.insert(startrow, :separator) if startrow
|
712
|
+
#return
|
713
|
+
end
|
603
714
|
# pretty output tabular format etc
|
604
715
|
require 'terminal-table/import'
|
605
|
-
#table = table(nil, *rows)
|
606
716
|
table = table(headings, *rows)
|
607
717
|
puts table
|
718
|
+
end
|
608
719
|
end
|
609
|
-
end
|
610
720
|
## validate user entered id
|
611
721
|
# All methods should call this first.
|
612
722
|
# @param [Fixnum] id (actually can be String) to validate
|
@@ -621,7 +731,7 @@ TEXT
|
|
621
731
|
die "No data found for #{id}" unless row
|
622
732
|
if print_header
|
623
733
|
puts "[#{row['type']} \##{row['id']}] #{row['title']}"
|
624
|
-
puts row['description']
|
734
|
+
puts row['description'] if row['description']
|
625
735
|
puts
|
626
736
|
end
|
627
737
|
return db, row
|
@@ -775,6 +885,13 @@ TEXT
|
|
775
885
|
# @return [0] for success
|
776
886
|
def close args
|
777
887
|
change_value "status", "closed", args
|
888
|
+
args.each do |id|
|
889
|
+
db, row = validate_id id
|
890
|
+
curr_status = row['priority']
|
891
|
+
value = curr_status.sub(/P/,'X')
|
892
|
+
db.sql_update "bugs", id, 'priority', value
|
893
|
+
puts "Updated #{id}'s PRI from #{curr_status} to #{value} "
|
894
|
+
end
|
778
895
|
0
|
779
896
|
end
|
780
897
|
|
@@ -785,6 +902,14 @@ TEXT
|
|
785
902
|
change_value "status", "started", args
|
786
903
|
0
|
787
904
|
end
|
905
|
+
def priority args
|
906
|
+
value = args.shift
|
907
|
+
ret = change_value "priority", value, args
|
908
|
+
if ret != 0
|
909
|
+
die "#{value} is not valid for priority. Valid are (#{@valid_priority.join(',')})"
|
910
|
+
end
|
911
|
+
0
|
912
|
+
end
|
788
913
|
|
789
914
|
##
|
790
915
|
# get a date in the future giving how many days
|
@@ -887,7 +1012,7 @@ TEXT
|
|
887
1012
|
require 'optparse'
|
888
1013
|
options = {}
|
889
1014
|
options[:verbose] = false
|
890
|
-
options[:
|
1015
|
+
options[:colored] = true
|
891
1016
|
$bare = false
|
892
1017
|
# adding some env variable pickups, so you don't have to keep passing.
|
893
1018
|
showall = ENV["TODO_SHOW_ALL"]
|
@@ -896,7 +1021,7 @@ TEXT
|
|
896
1021
|
end
|
897
1022
|
plain = ENV["TODO_PLAIN"]
|
898
1023
|
if plain
|
899
|
-
options[:
|
1024
|
+
options[:colored] = (plain == "0") ? false:true
|
900
1025
|
end
|
901
1026
|
config = File.expand_path "~/.bugzyrb.cfg"
|
902
1027
|
if File.exists? config
|
@@ -1058,6 +1183,9 @@ TEXT
|
|
1058
1183
|
options[:bare] = v
|
1059
1184
|
$bare = true
|
1060
1185
|
}
|
1186
|
+
opts.on("-c","--colored", "colored listing") { |v|
|
1187
|
+
options[:colored] = v
|
1188
|
+
}
|
1061
1189
|
opts.on("-v","--overdue", "not closed, due date past") { |v|
|
1062
1190
|
options[:overdue] = v
|
1063
1191
|
}
|
@@ -1083,6 +1211,10 @@ TEXT
|
|
1083
1211
|
opts.banner = "Usage: recentcomments [options] <HOWMANY>"
|
1084
1212
|
opts.description = "view recent comments, default last 10 logs "
|
1085
1213
|
end
|
1214
|
+
Subcommands::command :priority, :pri do |opts|
|
1215
|
+
opts.banner = "Usage: priority [options] <ISSUENO>"
|
1216
|
+
opts.description = "change priority of given items to [option]"
|
1217
|
+
end
|
1086
1218
|
# XXX order of these 2 matters !! reverse and see what happens
|
1087
1219
|
Subcommands::command :close, :clo do |opts|
|
1088
1220
|
opts.banner = "Usage: clo [options] <ISSUENO>"
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: bugzyrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.3.
|
5
|
+
version: 0.3.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Rahul Kumar
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-10-06 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: yard
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- .document
|
81
81
|
- CHANGELOG.rdoc
|
82
82
|
- LICENSE
|
83
|
+
- NOTES
|
83
84
|
- README.rdoc
|
84
85
|
- Rakefile
|
85
86
|
- VERSION
|