pt 0.5.5 → 0.5.6
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.
- data/Changelog.md +4 -0
- data/README.md +2 -0
- data/bin/pt +5 -3
- data/lib/pt/client.rb +14 -1
- data/lib/pt/data_table.rb +5 -3
- data/lib/pt/debugger.rb +4 -1
- data/lib/pt/ui.rb +38 -24
- data/lib/pt.rb +1 -1
- metadata +4 -2
data/Changelog.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## v0.5.5
|
4
4
|
|
5
|
+
Added `pt list all` which shows tickets from all members of the project ( kylewest )
|
6
|
+
|
7
|
+
## v0.5.5
|
8
|
+
|
5
9
|
Show the id of tickes by default in tables, adds the url of the task to show and shows more information about attachments ( derwiki )
|
6
10
|
|
7
11
|
## v0.5.4
|
data/README.md
CHANGED
@@ -43,6 +43,8 @@ Run `pt` from the root folder of your project.
|
|
43
43
|
pt done [id] ~[0-3] ~[comment] # lazy mans finish task, does everything
|
44
44
|
|
45
45
|
pt list [member] # list all tasks for another pt user
|
46
|
+
|
47
|
+
pt list all # list all tasks for all users
|
46
48
|
|
47
49
|
pt updates [number] # shows number recent activity from your current project
|
48
50
|
|
data/bin/pt
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
lib = (Pathname.new(__FILE__).realpath.dirname + '../lib').to_s
|
4
6
|
$LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
|
5
7
|
|
6
|
-
require
|
8
|
+
require 'pt'
|
7
9
|
|
8
|
-
PT::UI.new ARGV
|
10
|
+
PT::UI.new ARGV
|
data/lib/pt/client.rb
CHANGED
@@ -41,10 +41,18 @@ class PT::Client
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
+
def get_work(project)
|
45
|
+
project.stories.all(:current_state => 'unscheduled,unstarted,started')
|
46
|
+
end
|
47
|
+
|
44
48
|
def get_my_work(project, user_name)
|
45
49
|
project.stories.all :mywork => user_name
|
46
50
|
end
|
47
51
|
|
52
|
+
def get_task_by_id(id)
|
53
|
+
get_projects.map {|project| project.stories.all(:id => id)}.flatten.first
|
54
|
+
end
|
55
|
+
|
48
56
|
def get_my_open_tasks(project, user_name)
|
49
57
|
project.stories.all :owner => user_name
|
50
58
|
end
|
@@ -78,6 +86,11 @@ class PT::Client
|
|
78
86
|
project.stories.all.select{ |t| t.owned_by == nil }
|
79
87
|
end
|
80
88
|
|
89
|
+
def get_member(project, query)
|
90
|
+
member = project.memberships.all.select{ |m| m.name.downcase == query.downcase || m.initials.downcase == query.downcase }
|
91
|
+
member.empty? ? nil : member.first
|
92
|
+
end
|
93
|
+
|
81
94
|
def get_members(project)
|
82
95
|
project.memberships.all
|
83
96
|
end
|
@@ -106,4 +119,4 @@ class PT::Client
|
|
106
119
|
project.stories.create(:name => name, :owned_by => owner, :requested_by => requester, :story_type => task_type)
|
107
120
|
end
|
108
121
|
|
109
|
-
end
|
122
|
+
end
|
data/lib/pt/data_table.rb
CHANGED
@@ -10,11 +10,13 @@ module PT
|
|
10
10
|
@rows = dataset.map{ |row| DataRow.new(row, dataset) }
|
11
11
|
end
|
12
12
|
|
13
|
-
def print
|
13
|
+
def print(config={})
|
14
14
|
if @rows.empty?
|
15
|
-
puts "\n
|
15
|
+
puts "\n#{'-- empty list --'.center(36)}\n"
|
16
16
|
else
|
17
|
-
self.class.table @rows, :fields => [:num] + self.class.fields,
|
17
|
+
self.class.table @rows, :fields => [:num] + self.class.fields,
|
18
|
+
:unicode => true, :description => false,
|
19
|
+
:max_width => config[:max_width]
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
data/lib/pt/debugger.rb
CHANGED
@@ -4,7 +4,10 @@ module RestClient
|
|
4
4
|
class Request
|
5
5
|
alias_method :rest_client_execute, :execute
|
6
6
|
def execute &block
|
7
|
-
puts "
|
7
|
+
puts ""
|
8
|
+
puts "Request: #{method.to_s.upcase} #{url}"
|
9
|
+
puts ""
|
10
|
+
puts "Payload: #{payload}"
|
8
11
|
rest_client_execute &block
|
9
12
|
end
|
10
13
|
end
|
data/lib/pt/ui.rb
CHANGED
@@ -22,22 +22,27 @@ class PT::UI
|
|
22
22
|
def my_work
|
23
23
|
title("My Work for #{user_s} in #{project_to_s}")
|
24
24
|
stories = @client.get_my_work(@project, @local_config[:user_name])
|
25
|
-
PT::TasksTable.new(stories).print
|
25
|
+
PT::TasksTable.new(stories).print @global_config
|
26
26
|
end
|
27
27
|
|
28
28
|
def todo
|
29
29
|
title("My Work for #{user_s} in #{project_to_s}")
|
30
30
|
stories = @client.get_my_work(@project, @local_config[:user_name])
|
31
31
|
stories = stories.select { |story| story.current_state == "unscheduled" }
|
32
|
-
PT::TasksTable.new(stories).print
|
32
|
+
PT::TasksTable.new(stories).print @global_config
|
33
33
|
end
|
34
34
|
|
35
35
|
def list
|
36
36
|
if @params[0]
|
37
|
-
|
38
|
-
|
39
|
-
stories
|
40
|
-
|
37
|
+
if @params[0] == "all"
|
38
|
+
stories = @client.get_work(@project)
|
39
|
+
PT::TasksTable.new(stories).print @global_config
|
40
|
+
else
|
41
|
+
user = find_owner @params[0]
|
42
|
+
if user
|
43
|
+
stories = @client.get_my_work(@project, user.name)
|
44
|
+
PT::TasksTable.new(stories).print @global_config
|
45
|
+
end
|
41
46
|
end
|
42
47
|
else
|
43
48
|
members = @client.get_members(@project)
|
@@ -45,7 +50,7 @@ class PT::UI
|
|
45
50
|
user = select("Please select a member to see his tasks.", table).name
|
46
51
|
title("Work for #{user} in #{project_to_s}")
|
47
52
|
stories = @client.get_my_work(@project, user)
|
48
|
-
PT::TasksTable.new(stories).print
|
53
|
+
PT::TasksTable.new(stories).print @global_config
|
49
54
|
end
|
50
55
|
end
|
51
56
|
|
@@ -133,11 +138,13 @@ class PT::UI
|
|
133
138
|
tasks = @client.get_tasks_to_assign(@project, @local_config[:user_name])
|
134
139
|
table = PT::TasksTable.new(tasks)
|
135
140
|
task = select("Please select a task to assign it an owner", table)
|
141
|
+
end
|
142
|
+
unless owner
|
136
143
|
members = @client.get_members(@project)
|
137
144
|
table = PT::MembersTable.new(members)
|
138
145
|
owner = select("Please select a member to assign him the task", table).name
|
139
146
|
end
|
140
|
-
result = @client.assign_task(@project, task, owner
|
147
|
+
result = @client.assign_task(@project, task, owner)
|
141
148
|
if result.errors.any?
|
142
149
|
error(result.errors.errors)
|
143
150
|
else
|
@@ -359,14 +366,25 @@ class PT::UI
|
|
359
366
|
end
|
360
367
|
|
361
368
|
def find
|
362
|
-
|
369
|
+
if (story_id = @params[0].to_i).nonzero?
|
370
|
+
if task = @client.get_task_by_id(story_id)
|
371
|
+
return show_task(task)
|
372
|
+
else
|
373
|
+
message("Task not found by id (#{story_id}), falling back to text search")
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
363
377
|
if @params[0]
|
364
|
-
tasks
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
378
|
+
tasks = @client.get_my_work(@project, @local_config[:user_name])
|
379
|
+
matched_tasks = tasks.select do | task |
|
380
|
+
task.name.downcase.index(@params[0]) && task.current_state != 'delivered'
|
381
|
+
end
|
382
|
+
|
383
|
+
matched_tasks.each do | task |
|
384
|
+
title("--- [#{(tasks.index task) + 1 }] -----------------")
|
385
|
+
show_task(task)
|
369
386
|
end
|
387
|
+
message("No matches found for '#{@params[0]}'") if matched_tasks.empty?
|
370
388
|
else
|
371
389
|
message("You need to provide a substring for a tasks title.")
|
372
390
|
end
|
@@ -404,6 +422,7 @@ class PT::UI
|
|
404
422
|
puts("pt find [query] # looks in your tasks by title and presents it")
|
405
423
|
puts("pt done [id] ~[0-3] ~[comment] # lazy mans finish task, does everything")
|
406
424
|
puts("pt list [member] # list all tasks for another pt user")
|
425
|
+
puts("pt list all # list all tasks for all users")
|
407
426
|
puts("pt updates [number] # shows number recent activity from your current project")
|
408
427
|
puts("")
|
409
428
|
puts("All commands can be ran without arguments for a wizard like UI.")
|
@@ -493,7 +512,7 @@ class PT::UI
|
|
493
512
|
def select(msg, table)
|
494
513
|
if table.length > 0
|
495
514
|
begin
|
496
|
-
table.print
|
515
|
+
table.print @global_config
|
497
516
|
row = ask "#{msg} (1-#{table.length}, 'q' to exit)"
|
498
517
|
quit if row == 'q'
|
499
518
|
selected = table[row]
|
@@ -501,7 +520,7 @@ class PT::UI
|
|
501
520
|
end until selected
|
502
521
|
selected
|
503
522
|
else
|
504
|
-
table.print
|
523
|
+
table.print @global_config
|
505
524
|
message "Sorry, there are no options to select."
|
506
525
|
quit
|
507
526
|
end
|
@@ -555,14 +574,9 @@ class PT::UI
|
|
555
574
|
end
|
556
575
|
|
557
576
|
def find_owner query
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
return member
|
562
|
-
end
|
563
|
-
if member.initials.downcase.index query.to_s
|
564
|
-
return member
|
565
|
-
end
|
577
|
+
if query
|
578
|
+
member = @client.get_member(@project, query)
|
579
|
+
return member ? member.name : nil
|
566
580
|
end
|
567
581
|
nil
|
568
582
|
end
|
data/lib/pt.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Raul Murciano
|
9
9
|
- Orta Therox
|
10
|
+
- Engineering at Causes
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date: 2012-08-
|
14
|
+
date: 2012-08-23 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: pivotal-tracker
|
@@ -81,6 +82,7 @@ description: Minimalist, opinionated client to manage your Pivotal Tracker tasks
|
|
81
82
|
email:
|
82
83
|
- raul@murciano.net
|
83
84
|
- orta.therox@gmail.com
|
85
|
+
- eng@causes.com
|
84
86
|
executables:
|
85
87
|
- pt
|
86
88
|
extensions: []
|