pt 0.7.1 → 0.7.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d1b573d176005dc23c47c78858f9e282dfeda02c
4
+ data.tar.gz: 1acf12b9d197dfdfa164553258ede709a6c53e34
5
+ SHA512:
6
+ metadata.gz: a7eb5322d4009887006d0c03815844cf25ac0642c02ccdaa3e465491cd188d7ae420bc6367eb3f7340fb4d4dfcd39695b5e8ffe90fad0c0008c90412e18fb409
7
+ data.tar.gz: 3b5b3775fbbd340c0145e8d065ddf1886bed88e86848ee41cf9d03648791366c3ad8e32ab6cce19c621d62c276be9d48d62ec8c861d092bebb881302cfb0ecea
data/Changelog.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # pt changelog
2
2
 
3
+ ## v0.7.2
4
+
5
+ Show task updates for attachments, labels, and a recent stories list
6
+
3
7
  ## v0.7.1
4
8
 
5
9
  Fixes to pt show
data/Gemfile CHANGED
@@ -2,5 +2,5 @@ source "http://rubygems.org"
2
2
 
3
3
  gem 'pivotal-tracker', '>= 0.4.1'
4
4
  gem 'hirb', '>= 0.4.5'
5
- gem 'colored', '>= 1.2'
5
+ gem 'colored'
6
6
  gem 'highline', '>= 1.6.1'
data/README.md CHANGED
@@ -30,6 +30,8 @@ Run `pt` from the root folder of your project.
30
30
 
31
31
  pt comment [id] [comment] # add a comment
32
32
 
33
+ pt label [id] [label] # add a label
34
+
33
35
  pt estimate [id] [0-3] # estimate a task in points scale
34
36
 
35
37
  pt start [id] # mark a task as started
@@ -52,6 +54,8 @@ Run `pt` from the root folder of your project.
52
54
 
53
55
  pt updates [number] # shows number recent activity from your current project
54
56
 
57
+ pt recent # shows stories you've recently shown or commented on with pt
58
+
55
59
  All commands can be run entirely without arguments for a wizard based UI. Otherwise [required] <optional>.
56
60
  Anything that takes an id will also take the num (index) from the pt command.
57
61
 
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.1'
5
+ VERSION = '0.7.2'
6
6
  end
7
7
 
8
8
  require 'pt/client'
data/lib/pt/client.rb CHANGED
@@ -110,6 +110,16 @@ class PT::Client
110
110
  task.update(:owned_by => owner)
111
111
  end
112
112
 
113
+ def add_label(project, task, label)
114
+ task = PivotalTracker::Story.find(task.id, project.id)
115
+ if task.labels
116
+ task.labels += "," + label;
117
+ task.update(:labels => task.labels)
118
+ else
119
+ task.update(:labels => label)
120
+ end
121
+ end
122
+
113
123
  def comment_task(project, task, comment)
114
124
  task = PivotalTracker::Story.find(task.id, project.id)
115
125
  task.notes.create(:text => comment)
data/lib/pt/data_row.rb CHANGED
@@ -2,11 +2,12 @@ require 'iconv' unless "older_ruby?".respond_to?(:force_encoding)
2
2
 
3
3
  class PT::DataRow
4
4
 
5
- attr_accessor :num, :record
5
+ attr_accessor :num, :record, :state
6
6
 
7
7
  def initialize(orig, dataset)
8
8
  @record = orig
9
9
  @num = dataset.index(orig) + 1
10
+ @state = orig.current_state
10
11
  end
11
12
 
12
13
  def method_missing(method)
data/lib/pt/data_table.rb CHANGED
@@ -14,10 +14,16 @@ module PT
14
14
  if @rows.empty?
15
15
  puts "\n#{'-- empty list --'.center(36)}\n"
16
16
  else
17
+
18
+ max_width = Hirb::Util.detect_terminal_size()[0]
19
+ if config[:max_width] && config[:max_width] < max_width
20
+ max_width = config[:max_width]
21
+ end
22
+
17
23
  self.class.table @rows, :fields => [:num] + self.class.fields,
18
24
  :change_fields => %w{num pt_id},
19
25
  :unicode => true, :description => false,
20
- :max_width => config[:max_width]
26
+ :max_width => max_width
21
27
  end
22
28
  end
23
29
 
@@ -49,7 +55,15 @@ module PT
49
55
  class TasksTable < DataTable
50
56
 
51
57
  def self.fields
52
- [:name, :current_state, :id]
58
+ [:name, :state, :id]
59
+ end
60
+
61
+ end
62
+
63
+ class MultiUserTasksTable < DataTable
64
+
65
+ def self.fields
66
+ [:owned_by, :name, :state, :id]
53
67
  end
54
68
 
55
69
  end
data/lib/pt/ui.rb CHANGED
@@ -71,6 +71,30 @@ class PT::UI
71
71
  end
72
72
  end
73
73
 
74
+ def recent
75
+ title("Your recent stories from #{project_to_s}")
76
+ stories = @project.stories.all( :id => @local_config[:recent_tasks] )
77
+ PT::MultiUserTasksTable.new(stories).print @global_config
78
+ end
79
+
80
+ def label
81
+
82
+ task = get_task_from_params "Please select a story to show"
83
+ unless task
84
+ message("No matches found for '#{@params[0]}', please use a valid pivotal story Id")
85
+ return
86
+ end
87
+
88
+ if @params[1]
89
+ label = @params[1]
90
+ else
91
+ label = ask("Which label?")
92
+ end
93
+
94
+ @client.add_label( @project, task, label );
95
+
96
+ end
97
+
74
98
  def create
75
99
  if @params[0]
76
100
  name = @params[0]
@@ -153,6 +177,7 @@ class PT::UI
153
177
  end
154
178
  if @client.comment_task(@project, task, comment)
155
179
  congrats("Comment sent, thanks!")
180
+ save_recent_task( task.id )
156
181
  else
157
182
  error("Ummm, something went wrong.")
158
183
  end
@@ -462,6 +487,7 @@ class PT::UI
462
487
  puts("pt open [id] # open a task in the browser")
463
488
  puts("pt assign [id] <owner> # assign owner")
464
489
  puts("pt comment [id] [comment] # add a comment")
490
+ puts("pt label [id] [label] # add a label")
465
491
  puts("pt estimate [id] [0-3] # estimate a task in points scale")
466
492
  puts("pt start [id] # mark a task as started")
467
493
  puts("pt finish [id] # indicate you've finished a task")
@@ -472,6 +498,7 @@ class PT::UI
472
498
  puts("pt find [query] # looks in your tasks by title and presents it")
473
499
  puts("pt list [owner] or all # list all tasks for another pt user")
474
500
  puts("pt updates [number] # shows number recent activity from your current project")
501
+ puts("pt recent # shows stories you've recently shown or commented on with pt")
475
502
  puts("")
476
503
  puts("All commands can be run entirely without arguments for a wizard based UI. Otherwise [required] <optional>.")
477
504
  puts("Anything that takes an id will also take the num (index) from the pt command.")
@@ -636,16 +663,53 @@ class PT::UI
636
663
  end
637
664
 
638
665
  def show_task(task)
639
- title task.name
666
+ title task.name.green
640
667
  estimation = [-1, nil].include?(task.estimate) ? "Unestimated" : "#{task.estimate} points"
641
668
  message "#{task.current_state.capitalize} #{task.story_type} | #{estimation} | Req: #{task.requested_by} | Owns: #{task.owned_by} | Id: #{task.id}"
669
+
670
+ if (task.labels)
671
+ message "Labels: " + task.labels.split(',').join(', ')
672
+ end
642
673
  message task.description unless task.description.nil? || task.description.empty?
643
- task.tasks.all.each{ |t| compact_message "- #{t.complete ? "(done) " : "(pend)"} #{t.description}" }
644
- task.notes.all.each{ |n| message "#{n.author}: \"#{n.text}\"" }
645
- task.attachments.each{ |a| message "#{a.uploaded_by} uploaded: \"#{a.description && a.description.empty? ? "#{a.filename}" : "#{a.description} (#{a.filename})" }\" #{a.url}" }
646
- puts task.url
674
+ message "View on pivotal: #{task.url}"
675
+
676
+ if task.tasks
677
+ task.tasks.all.each{ |t| compact_message "- #{t.complete ? "(done) " : "(pend)"} #{t.description}" }
678
+ end
679
+
680
+ # attachments on a note come through with the same description as the note
681
+ # to prevent the same update from showing multiple times, arrange by description for later lookup
682
+ attachment_match = Hash.new()
683
+ task.attachments.each do |a|
684
+ unless attachment_match[ a.description ]
685
+ attachment_match[ a.description ] = Array.new()
686
+ end
687
+
688
+ attachment_match[ a.description ].push( a );
689
+ end
690
+
691
+ task.notes.all.each do |n|
692
+ message "#{n.author.yellow}: #{n.text}"
693
+ # print attachements for this note
694
+ if attachment_match[ n.text ]
695
+ message "Attachments".bold
696
+ attachment_match[ n.text ].each{ |a| message "#{a.filename} #{a.url}" }
697
+ attachment_match.delete(n.text)
698
+ end
699
+ end
700
+
701
+ task.attachments.each do |a|
702
+ # skip attachments already printed as part of a note
703
+ if attachment_match[ a.description ]
704
+ message "#{a.uploaded_by.yellow} uploaded: \"#{a.description && a.description.empty? ? "#{a.filename}" : "#{a.description} (#{a.filename})" }\" #{a.url}"
705
+ end
706
+ end
707
+
708
+ save_recent_task( task.id )
709
+
647
710
  end
648
711
 
712
+
649
713
  def show_activity(activity, tasks)
650
714
  story_id = activity.stories.first.id
651
715
  task_id = nil
@@ -705,4 +769,17 @@ class PT::UI
705
769
  end
706
770
  end
707
771
 
772
+ def save_recent_task( task_id )
773
+ # save list of recently accessed tasks
774
+ unless (@local_config[:recent_tasks])
775
+ @local_config[:recent_tasks] = Array.new();
776
+ end
777
+ @local_config[:recent_tasks].unshift( task_id )
778
+ @local_config[:recent_tasks] = @local_config[:recent_tasks].uniq()
779
+ if @local_config[:recent_tasks].length > 10
780
+ @local_config[:recent_tasks].pop()
781
+ end
782
+ save_config( @local_config, LOCAL_CONFIG_PATH )
783
+ end
784
+
708
785
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
5
- prerelease:
4
+ version: 0.7.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Raul Murciano
@@ -11,70 +10,62 @@ authors:
11
10
  autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2013-05-09 00:00:00.000000000 Z
13
+ date: 2014-03-01 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: pivotal-tracker
18
17
  requirement: !ruby/object:Gem::Requirement
19
- none: false
20
18
  requirements:
21
- - - ! '>='
19
+ - - '>='
22
20
  - !ruby/object:Gem::Version
23
21
  version: 0.4.1
24
22
  type: :runtime
25
23
  prerelease: false
26
24
  version_requirements: !ruby/object:Gem::Requirement
27
- none: false
28
25
  requirements:
29
- - - ! '>='
26
+ - - '>='
30
27
  - !ruby/object:Gem::Version
31
28
  version: 0.4.1
32
29
  - !ruby/object:Gem::Dependency
33
30
  name: hirb
34
31
  requirement: !ruby/object:Gem::Requirement
35
- none: false
36
32
  requirements:
37
- - - ! '>='
33
+ - - '>='
38
34
  - !ruby/object:Gem::Version
39
35
  version: 0.4.5
40
36
  type: :runtime
41
37
  prerelease: false
42
38
  version_requirements: !ruby/object:Gem::Requirement
43
- none: false
44
39
  requirements:
45
- - - ! '>='
40
+ - - '>='
46
41
  - !ruby/object:Gem::Version
47
42
  version: 0.4.5
48
43
  - !ruby/object:Gem::Dependency
49
44
  name: colored
50
45
  requirement: !ruby/object:Gem::Requirement
51
- none: false
52
46
  requirements:
53
- - - ! '>='
47
+ - - '>='
54
48
  - !ruby/object:Gem::Version
55
49
  version: '1.2'
56
50
  type: :runtime
57
51
  prerelease: false
58
52
  version_requirements: !ruby/object:Gem::Requirement
59
- none: false
60
53
  requirements:
61
- - - ! '>='
54
+ - - '>='
62
55
  - !ruby/object:Gem::Version
63
56
  version: '1.2'
64
57
  - !ruby/object:Gem::Dependency
65
58
  name: highline
66
59
  requirement: !ruby/object:Gem::Requirement
67
- none: false
68
60
  requirements:
69
- - - ! '>='
61
+ - - '>='
70
62
  - !ruby/object:Gem::Version
71
63
  version: 1.6.1
72
64
  type: :runtime
73
65
  prerelease: false
74
66
  version_requirements: !ruby/object:Gem::Requirement
75
- none: false
76
67
  requirements:
77
- - - ! '>='
68
+ - - '>='
78
69
  - !ruby/object:Gem::Version
79
70
  version: 1.6.1
80
71
  description: Minimalist, opinionated client to manage your Pivotal Tracker tasks from
@@ -102,27 +93,26 @@ files:
102
93
  - bin/pt
103
94
  homepage: http://www.github.com/raul/pt
104
95
  licenses: []
96
+ metadata: {}
105
97
  post_install_message:
106
98
  rdoc_options: []
107
99
  require_paths:
108
100
  - lib
109
101
  required_ruby_version: !ruby/object:Gem::Requirement
110
- none: false
111
102
  requirements:
112
- - - ! '>='
103
+ - - '>='
113
104
  - !ruby/object:Gem::Version
114
105
  version: '0'
115
106
  required_rubygems_version: !ruby/object:Gem::Requirement
116
- none: false
117
107
  requirements:
118
- - - ! '>='
108
+ - - '>='
119
109
  - !ruby/object:Gem::Version
120
110
  version: '0'
121
111
  requirements: []
122
112
  rubyforge_project: pt
123
- rubygems_version: 1.8.25
113
+ rubygems_version: 2.0.6
124
114
  signing_key:
125
- specification_version: 3
115
+ specification_version: 4
126
116
  summary: Client to use Pivotal Tracker from the console.
127
117
  test_files: []
128
118
  has_rdoc: