pt 0.7 → 0.7.1

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 CHANGED
@@ -1,8 +1,13 @@
1
1
  # pt changelog
2
2
 
3
+ ## v0.7.1
4
+
5
+ Fixes to pt show
6
+ Updates to the help
7
+ Fixed the -m option
8
+
3
9
  ## v0.7.0
4
10
 
5
- Fixed the -m option
6
11
  Comment, Assign, Estimate, Start, Finish, Deliver, Accept all accept the num value in `pt` or a story id
7
12
 
8
13
  ## v0.6.3 & v0.6.4
data/README.md CHANGED
@@ -12,46 +12,48 @@ The first time you run it, `pt` will ask you some data about your Pivotal Tracke
12
12
 
13
13
  Run `pt` from the root folder of your project.
14
14
 
15
- pt # show all available tasks
15
+ pt # show all available tasks
16
16
 
17
- pt todo # show all unscheduled tasks
17
+ pt todo <owner> # show all unscheduled tasks
18
18
 
19
- pt started # show all started stories
19
+ pt started <owner> # show all started stories
20
20
 
21
- pt create [title] ~[owner] ~[type] # create a new task
21
+ pt create [title] <owner> <type> -m # create a new task (and include description ala git commit)
22
22
 
23
- pt show [id] # shows detailed info about a task
23
+ pt show [id] # shows detailed info about a task
24
24
 
25
- pt tasks [id] # manage tasks of story
25
+ pt tasks [id] # manage tasks of story
26
26
 
27
- pt open [id] # open a task in the browser
27
+ pt open [id] # open a task in the browser
28
28
 
29
- pt assign [id] [member] # assign owner
29
+ pt assign [id] <owner> # assign owner
30
30
 
31
- pt comment [id] [comment] # add a comment
31
+ pt comment [id] [comment] # add a comment
32
32
 
33
- pt estimate [id] [0-3] # estimate a task in points scale
33
+ pt estimate [id] [0-3] # estimate a task in points scale
34
34
 
35
- pt start [id] # mark a task as started
35
+ pt start [id] # mark a task as started
36
36
 
37
- pt finish [id] # indicate you've finished a task
37
+ pt finish [id] # indicate you've finished a task
38
38
 
39
- pt deliver [id] # indicate the task is delivered
39
+ pt deliver [id] # indicate the task is delivered
40
40
 
41
- pt accept [id] # mark a task as accepted
41
+ pt accept [id] # mark a task as accepted
42
42
 
43
- pt reject [id] [reason] # mark a task as rejected, explaining why
43
+ pt reject [id] [reason] # mark a task as rejected, explaining why
44
44
 
45
- pt find [query] # looks in your tasks by title and presents it
45
+ pt done [id] <0-3> <comment> # lazy mans finish task, opens, assigns to you, estimates, finish & delivers
46
46
 
47
- pt done [id] ~[0-3] ~[comment] # lazy mans finish task, does everything
47
+ pt find [query] # looks in your tasks by title and presents it
48
48
 
49
- pt list [member] # list all tasks for another pt user
49
+ pt list [owner] # list all tasks for another pt user
50
50
 
51
- pt list all # list all tasks for all users
51
+ pt list all # list all tasks for all users
52
52
 
53
- pt updates [number] # shows number recent activity from your current project
53
+ pt updates [number] # shows number recent activity from your current project
54
54
 
55
+ All commands can be run entirely without arguments for a wizard based UI. Otherwise [required] <optional>.
56
+ Anything that takes an id will also take the num (index) from the pt command.
55
57
 
56
58
  ## Problems?
57
59
 
@@ -73,4 +75,5 @@ You can [open a new issue](https://github.com/raul/pt/issues/new). It can be hel
73
75
  See the LICENSE file included in the distribution.
74
76
 
75
77
  ## Copyright
78
+ Copyright (C) 2013 Orta Therox <orta.therox@gmail.com>.
76
79
  Copyright (C) 2011 Raul Murciano <raul@murciano.net>.
data/lib/pt/data_table.rb CHANGED
@@ -15,6 +15,7 @@ module PT
15
15
  puts "\n#{'-- empty list --'.center(36)}\n"
16
16
  else
17
17
  self.class.table @rows, :fields => [:num] + self.class.fields,
18
+ :change_fields => %w{num pt_id},
18
19
  :unicode => true, :description => false,
19
20
  :max_width => config[:max_width]
20
21
  end
data/lib/pt/ui.rb CHANGED
@@ -106,18 +106,17 @@ class PT::UI
106
106
 
107
107
  # did you do a -m so you can add a description?
108
108
  if ARGV.include? "-m" or ARGV.include? "--m"
109
- description_file = Tempfile.new ["pt-create-description", "txt"]
110
- description_file.write "Description for #{owner}'s #{task_type} ( delete this line )"
109
+ editor = ENV.fetch('EDITOR') { 'vi' }
110
+ temp_path = "/tmp/editor-#{ Process.pid }.txt"
111
+ system "#{ editor } #{ temp_path }"
111
112
 
112
- system `#{ENV['EDITOR']} #{description_file.path}`
113
-
114
- description = File.read(description_file.path)
113
+ description = File.read(temp_path)
115
114
  result = @client.create_task_with_description(@project, name, owner, requester, task_type, description)
116
-
117
- description_file.unlink
115
+
118
116
  else
119
117
  result = @client.create_task(@project, name, owner, requester, task_type)
120
118
  end
119
+
121
120
  if result.errors.any?
122
121
  error(result.errors.errors)
123
122
  else
@@ -140,16 +139,6 @@ class PT::UI
140
139
  `open #{task.url}`
141
140
  end
142
141
 
143
- def task_by_id_or_pt_id id
144
- if id < 1000
145
- tasks = @client.get_my_work(@project, @local_config[:user_name])
146
- table = PT::TasksTable.new(tasks)
147
- table[id]
148
- else
149
- @client.get_task_by_id id
150
- end
151
- end
152
-
153
142
  def comment
154
143
  if @params[0]
155
144
  task = task_by_id_or_pt_id @params[0].to_i
@@ -347,9 +336,7 @@ class PT::UI
347
336
 
348
337
  def done
349
338
  if @params[0]
350
- tasks = @client.get_my_work(@project, @local_config[:user_name])
351
- table = PT::TasksTable.new(tasks)
352
- task = table[@params[0].to_i]
339
+ task = task_by_id_or_pt_id @params[0].to_i
353
340
 
354
341
  #we need this for finding again later
355
342
  task_id = task.id
@@ -364,20 +351,20 @@ class PT::UI
364
351
  estimate_task(task, @params[1].to_i)
365
352
  end
366
353
  if @params[2]
367
- task = find_my_task_by_task_id task_id
354
+ task = task_by_id_or_pt_id task_id
368
355
  @client.comment_task(@project, task, @params[2])
369
356
  end
370
357
  else
371
358
  @client.comment_task(@project, task, @params[1]) if @params[1]
372
359
  end
373
360
 
374
- task = find_my_task_by_task_id task_id
361
+ task = task_by_id_or_pt_id task_id
375
362
  start_task task
376
363
 
377
- task = find_my_task_by_task_id task_id
364
+ task = task_by_id_or_pt_id task_id
378
365
  finish_task task
379
366
 
380
- task = find_my_task_by_task_id task_id
367
+ task = task_by_id_or_pt_id task_id
381
368
  deliver_task task
382
369
  end
383
370
  end
@@ -427,7 +414,7 @@ class PT::UI
427
414
 
428
415
  def find
429
416
  if (story_id = @params[0].to_i).nonzero?
430
- if task = @client.get_task_by_id(story_id)
417
+ if task = task_by_id_or_pt_id(@params[0].to_i)
431
418
  return show_task(task)
432
419
  else
433
420
  message("Task not found by id (#{story_id}), falling back to text search")
@@ -467,13 +454,13 @@ class PT::UI
467
454
 
468
455
  title("Command line usage for pt #{PT::VERSION}")
469
456
  puts("pt # show all available tasks")
470
- puts("pt todo # show all unscheduled tasks")
471
- puts("pt started ~[owner] # show all started stories")
472
- puts("pt create [title] ~[owner] ~[type] -m # create a new task (and include description ala git commit)")
457
+ puts("pt todo <owner> # show all unscheduled tasks")
458
+ puts("pt started <owner> # show all started stories")
459
+ puts("pt create [title] <owner> <type> -m # create a new task (and include description ala git commit)")
473
460
  puts("pt show [id] # shows detailed info about a task")
474
461
  puts("pt tasks [id] # manage tasks of story")
475
462
  puts("pt open [id] # open a task in the browser")
476
- puts("pt assign [id] ~[owner] # assign owner")
463
+ puts("pt assign [id] <owner> # assign owner")
477
464
  puts("pt comment [id] [comment] # add a comment")
478
465
  puts("pt estimate [id] [0-3] # estimate a task in points scale")
479
466
  puts("pt start [id] # mark a task as started")
@@ -481,13 +468,13 @@ class PT::UI
481
468
  puts("pt deliver [id] # indicate the task is delivered");
482
469
  puts("pt accept [id] # mark a task as accepted")
483
470
  puts("pt reject [id] [reason] # mark a task as rejected, explaining why")
471
+ puts("pt done [id] <0-3> <comment> # lazy mans finish task, opens, assigns to you, estimates, finish & delivers")
484
472
  puts("pt find [query] # looks in your tasks by title and presents it")
485
- puts("pt done [id] ~[0-3] ~[comment] # lazy mans finish task, does everything")
486
- puts("pt list [owner] # list all tasks for another pt user")
487
- puts("pt list all # list all tasks for all users")
473
+ puts("pt list [owner] or all # list all tasks for another pt user")
488
474
  puts("pt updates [number] # shows number recent activity from your current project")
489
475
  puts("")
490
- puts("All commands can be run without arguments for a wizard like UI.")
476
+ puts("All commands can be run entirely without arguments for a wizard based UI. Otherwise [required] <optional>.")
477
+ puts("Anything that takes an id will also take the num (index) from the pt command.")
491
478
  end
492
479
 
493
480
  protected
@@ -620,6 +607,16 @@ class PT::UI
620
607
  nil
621
608
  end
622
609
 
610
+ def task_by_id_or_pt_id id
611
+ if id < 1000
612
+ tasks = @client.get_my_work(@project, @local_config[:user_name])
613
+ table = PT::TasksTable.new(tasks)
614
+ table[id]
615
+ else
616
+ @client.get_task_by_id id
617
+ end
618
+ end
619
+
623
620
  def find_task query
624
621
  members = @client.get_members(@project)
625
622
  members.each do | member |
@@ -630,15 +627,6 @@ class PT::UI
630
627
  nil
631
628
  end
632
629
 
633
- def find_my_task_by_task_id task_id
634
- tasks = @client.get_my_work(@project, @local_config[:user_name])
635
- tasks.each do |task|
636
- if task.id == task_id
637
- return task
638
- end
639
- end
640
- end
641
-
642
630
  def find_owner query
643
631
  if query
644
632
  member = @client.get_member(@project, query)
@@ -684,15 +672,14 @@ class PT::UI
684
672
 
685
673
  def get_task_from_params(prompt)
686
674
  if @params[0]
687
- task = @client.get_task_by_id(@params[0].to_i)
675
+ task = task_by_id_or_pt_id(@params[0].to_i)
688
676
  else
689
677
  tasks = @client.get_my_work(@project, @local_config[:user_name])
690
678
  table = PT::TasksTable.new(tasks)
691
679
  task = select(prompt, table)
692
680
  end
693
- task
694
681
  end
695
-
682
+
696
683
  def edit_story_task(story_task)
697
684
  action_class = Struct.new(:action, :key)
698
685
 
data/lib/pt.rb CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  module PT
4
4
  class InputError < StandardError; end
5
- VERSION = '0.7'
5
+ VERSION = '0.7.1'
6
6
  end
7
7
 
8
8
  require 'pt/client'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pt
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.7'
4
+ version: 0.7.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-05-08 00:00:00.000000000 Z
14
+ date: 2013-05-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: pivotal-tracker