ptt 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 177f45ed434f0c9445c126552d97f002dfee98e1
4
+ data.tar.gz: 76108946a21a1f3e7dd7382f4758c25eff072d1f
5
+ SHA512:
6
+ metadata.gz: 350f9a6cab523e8db5debc0b68705870207a1f460f642278292f62b84566f6ec72e9cc402e0191f75a9bb71e422700c70f8faf44a45f0d5110c39705447866fc
7
+ data.tar.gz: 8fa115bfebd364f360e07dd0666801abfbae7ba318dbcf844df7a64e05e0d27bf85f05387921b694fdd24cc8d5cbc91ded5c94304ea27abfdf5c975f8356189f
@@ -0,0 +1,119 @@
1
+ # ptt changelog
2
+
3
+ Upgrade to Pivotal Tracker API V5
4
+
5
+
6
+ # pt changelog
7
+
8
+ ## v0.7.3
9
+
10
+ Fix to `pt list` ( icetan )
11
+
12
+ ## v0.7.2
13
+
14
+ Show task updates for attachments, labels, and a recent stories list
15
+
16
+ ## v0.7.1
17
+
18
+ Fixes to pt show
19
+ Updates to the help
20
+ Fixed the -m option
21
+
22
+ ## v0.7.0
23
+
24
+ Comment, Assign, Estimate, Start, Finish, Deliver, Accept all accept the num value in `pt` or a story id
25
+
26
+ ## v0.6.3 & v0.6.4
27
+
28
+ Added the ability to see started by username ( good idea marcolz )
29
+
30
+ ## v0.6.2
31
+
32
+ Added "-m" to create that will load the description in your editor ( good idea ahunt09 )
33
+
34
+ ## v0.6
35
+
36
+ Added command pt started ( Matthijs Groen )
37
+ Added command pt tasks ( Matthijs Groen )
38
+
39
+ ## v0.5.8
40
+
41
+ Improved support for ruby 1.8 ( Paco Benavent )
42
+
43
+ ## v0.5.7
44
+
45
+ Fixed `pt list [username]` ( stephencelis )
46
+
47
+ ## v0.5.6
48
+
49
+ Added `pt list all` which shows tickets from all members of the project ( kylewest )
50
+
51
+ ## v0.5.5
52
+
53
+ Show the id of tickes by default in tables, adds the url of the task to show and shows more information about attachments ( derwiki )
54
+
55
+ ## v0.5.4
56
+
57
+ Fix to pt create, wherein skipping optional parameters wouldn't work as expected, or at all. ( aniccolai )
58
+
59
+ ## v0.5.3
60
+
61
+ Added a command todo, that only shows unscheduled stories ( orta )
62
+
63
+ ## v0.5.2
64
+
65
+ Made create agnostic of order for assignee / type, and use defaults of you / feature ( orta )
66
+ Added query limit size to activity ( jonmountjoy )
67
+
68
+ ## v0.5.1
69
+
70
+ Extra commands added, they can be accessed through 'pt help' ( orta )
71
+ Fix for 1.9.3 not getting deprecation warnings
72
+
73
+ ## v0.4
74
+
75
+ Added support for calling functions without going through the walkthroughs ( orta )
76
+
77
+ ## v0.3.9
78
+
79
+ Attachments displayed in 'show' task, thanks Anthony Crumley!
80
+
81
+ ## v0.3.8
82
+
83
+ Fix converting encodings, thanks Johan Andersson!
84
+
85
+ ## v0.3.7
86
+ Fix and story's id in "show" command
87
+
88
+ ## v0.3.6
89
+ Fix for ruby 1.9 strings, thanks David Ramirez for reporting!
90
+
91
+ ## v0.3.5
92
+ New 'show' command largely based on craftycode's (Anthony Crumley) contribution
93
+
94
+ ## v0.3.4
95
+ Improved charset support
96
+
97
+ ## v0.3.3
98
+ Added SSL support
99
+
100
+ ## v0.3.2
101
+ Fix in requests debugger
102
+
103
+ ## v0.3.1
104
+ Dependencies versions added to gemspec
105
+
106
+ ## v0.3.0
107
+ Added --debug option to see the interaction with PT's API
108
+
109
+ ## v0.2.2
110
+ Fix: list of tasks to start
111
+
112
+ ## v0.2.1
113
+ Error message when using pt from ~
114
+
115
+ ## v0.2
116
+ Fix for ruby 1.8
117
+
118
+ ## v0.1
119
+ First release
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem 'tracker_api', github: 'drselump14/tracker_api', branch: :develop
6
+
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Raul Murciano raul@murciano.net
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,87 @@
1
+ # ptt (pivotal tracker terminal)
2
+
3
+ Minimal client to use Pivotal Tracker API v5 from the command line (forked from pt
4
+
5
+
6
+ ## Setup
7
+
8
+ gem install ptt
9
+
10
+ The first time you run it, `ptt` will ask you some data about your Pivotal Tracker account and your current project.
11
+
12
+ ## Usage
13
+
14
+ Run `ptt` from the root folder of your project.
15
+
16
+ ```
17
+ ptt # show all available tasks
18
+
19
+ ptt todo <owner> # show all unscheduled tasks
20
+
21
+ ptt started <owner> # show all started stories
22
+
23
+ ptt create [title] <owner> <type> -m # create a new task (and include descripttion ala git commit)
24
+
25
+ ptt show [id] # shows detailed info about a task
26
+
27
+ ptt tasks [id] # manage tasks of story
28
+
29
+ ptt open [id] # open a task in the browser
30
+
31
+ ptt assign [id] <owner> # assign owner
32
+
33
+ ptt comment [id] [comment] # add a comment
34
+
35
+ ptt label [id] [label] # add a label
36
+
37
+ ptt estimate [id] [0-3] # estimate a task in points scale
38
+
39
+ ptt start [id] # mark a task as started
40
+
41
+ ptt finish [id] # indicate you've finished a task
42
+
43
+ ptt deliver [id] # indicate the task is delivered
44
+
45
+ ptt acceptt [id] # mark a task as acceptted
46
+
47
+ ptt reject [id] [reason] # mark a task as rejected, explaining why
48
+
49
+ ptt done [id] <0-3> <comment> # lazy mans finish task, opens, assigns to you, estimates, finish & delivers
50
+
51
+ ptt find [query] # looks in your tasks by title and presents it
52
+
53
+ ptt list [owner] # list all tasks for another ptt user
54
+
55
+ ptt list all # list all tasks for all users
56
+
57
+ ptt updates # shows number recent activity from your current project
58
+
59
+ ptt recent # shows stories you've recently shown or commented on with ptt
60
+
61
+ All commands can be run entirely without arguments for a wizard based UI. Otherwise [required] <opttional>.
62
+ Anything that takes an id will also take the num (index) from the ptt command.
63
+ ```
64
+
65
+ ## Problems?
66
+
67
+ You can [open a new issue](https://github.com/raul/ptt/issues/new). It can be helpful to include a trace of the requests and responses you're getting from Pivotal Tracker: you can get it by adding the `--debug` parameter while invoking `ptt` (remember to remove all sensible data though).
68
+
69
+ # Contributors
70
+ - Slamet Kristanto (current maintainer of ptt)
71
+ - [orta therox](http://orta.github.com) (Current maintainer of pt)
72
+ - [Raul Murciano](http://raul.murciano.net) (Original author)
73
+ - [Anthony Crumley](https://github.com/craftycode)
74
+ - [Johan Andersson](http://johan.andersson.net)
75
+
76
+ ## Thanks to...
77
+ - the contributors of pt
78
+ - the [Pivotal Tracker](https://www.pivotaltracker.com) guys for making a planning tool that doesn't suck and has an API
79
+ - forest for 'tracker-api' gem
80
+
81
+ ## License
82
+ See the LICENSE file included in the distribution.
83
+
84
+ ## Copyright
85
+ Copyright (C) 2017 Slamet Kristanto <cakmet14@gmail.com>.
86
+ Copyright (C) 2013 Orta Therox <orta.therox@gmail.com>.
87
+ Copyright (C) 2011 Raul Murciano <raul@murciano.net>.
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/bin/ptt ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+
5
+ lib = (Pathname.new(__FILE__).realpath.dirname + '../lib').to_s
6
+ $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
7
+
8
+ require 'ptt'
9
+
10
+ PTT::UI.new ARGV
@@ -0,0 +1,12 @@
1
+ require 'rubygems'
2
+
3
+ module PTT
4
+ class InputError < StandardError; end
5
+ VERSION = '1.0.1'
6
+ end
7
+
8
+ require 'tracker_api'
9
+ require 'ptt/client'
10
+ require 'ptt/data_row'
11
+ require 'ptt/data_table'
12
+ require 'ptt/ui'
@@ -0,0 +1,153 @@
1
+ require 'ptt/switch_ssl'
2
+ require 'uri'
3
+
4
+ class PTT::Client
5
+
6
+ STORY_FIELDS=':default,requested_by,owners,tasks,comments(:default,person,file_attachments)'
7
+
8
+
9
+ def self.get_api_token(email, password)
10
+ PivotalAPI::Me.retrieve(email, password)
11
+ rescue RestClient::Unauthorized
12
+ raise PTT::InputError.new("Bad email/password combination.")
13
+ end
14
+
15
+ def initialize(token)
16
+ @client = TrackerApi::Client.new(token: token)
17
+ @project = nil
18
+ end
19
+
20
+ def get_project(project_id)
21
+ project = @client.project(project_id)
22
+ project
23
+ end
24
+
25
+ def get_projects
26
+ @client.projects
27
+ end
28
+
29
+ def get_membership(project, email)
30
+ PivotalTracker::Membership.all(project).select{ |m| m.email == email }.first
31
+ end
32
+
33
+ def get_my_info
34
+ @client.me
35
+ end
36
+
37
+ def get_current_iteration(project)
38
+ PivotalTracker::Iteration.current(project)
39
+ end
40
+
41
+ def get_activities(project, limit)
42
+ project.activity
43
+ end
44
+
45
+ def get_work(project)
46
+ project.stories(filter: 'state:unscheduled,unstarted,started', fields: STORY_FIELDS )
47
+ end
48
+
49
+ def get_my_work(project, user_name)
50
+ project.stories(filter: "owner:#{user_name} -state:accepted", limit: 50, fields: STORY_FIELDS)
51
+ end
52
+
53
+ def search_for_story(project, query)
54
+ project.stories(filter: query.to_s ,fields: STORY_FIELDS)
55
+ end
56
+
57
+ def get_task_by_id(project, id)
58
+ project.story(id, fields: STORY_FIELDS)
59
+ end
60
+ alias :get_story :get_task_by_id
61
+
62
+ def get_my_open_tasks(project, user_name)
63
+ project.stories filter: "owner:#{user_name}", fields: STORY_FIELDS
64
+ end
65
+
66
+ def get_my_tasks_to_estimate(project, user_name)
67
+ project.stories( filter: "owner:#{user_name} type:feature estimate:-1", fields: STORY_FIELDS)
68
+ end
69
+
70
+ def get_my_tasks_to_start(project, user_name)
71
+ tasks = project.stories filter: "owner:#{user_name} state:unscheduled,rejected,unstarted", limit: 50, fields: STORY_FIELDS
72
+ tasks.reject{ |t| (t.story_type == 'feature') && (t.estimate == -1) }
73
+ end
74
+
75
+ def get_my_tasks_to_finish(project, user_name)
76
+ project.stories filter: "owner:#{user_name} -state:finished,delivered,accepted,rejected", limit: 50, fields: STORY_FIELDS
77
+ end
78
+
79
+ def get_my_tasks_to_deliver(project, user_name)
80
+ project.stories filter: "owner:#{user_name} -state:delivered,accepted,rejected", limit: 50, fields: STORY_FIELDS
81
+ end
82
+
83
+ def get_my_tasks_to_accept(project, user_name)
84
+ project.stories filter: "owner:#{user_name} -state:accepted", limit: 50, fields: STORY_FIELDS
85
+ end
86
+
87
+ def get_my_tasks_to_reject(project, user_name)
88
+ project.stories filter: "owner:#{user_name} -state:rejected", limit: 50, fields: STORY_FIELDS
89
+ end
90
+
91
+ def get_tasks_to_assign(project)
92
+ project.stories filter: "-state:accepted", limit: 50
93
+ end
94
+
95
+ def get_all_stories(project, user_name)
96
+ project.stories limit: 50, fields: STORY_FIELDS
97
+ end
98
+
99
+
100
+ def get_member(project, query)
101
+ member = project.memberships.select{ |m| m.person.name.downcase.start_with?(query.downcase) || m.person.initials.downcase == query.downcase }
102
+ member.empty? ? nil : member.first
103
+ end
104
+
105
+ def find_member(project, query)
106
+ memberships = project.memberships.detect do |m|
107
+ m.person.name.downcase.start_with?(query.downcase) || m.person.initials.downcase == query.downcase
108
+ end
109
+ end
110
+
111
+ def get_members(project)
112
+ project.memberships fields: ':default,person'
113
+ end
114
+
115
+
116
+ def mark_task_as(project, task, state)
117
+ task = get_story(project, task.id)
118
+ task.current_state = state
119
+ task.save
120
+ end
121
+
122
+ def estimate_task(project, task, points)
123
+ task = get_story(project, task.id)
124
+ task.estimate = points
125
+ task.save
126
+ end
127
+
128
+ def assign_task(project, task, owner)
129
+ task = get_story(project, task.id)
130
+ task.add_owner(owner)
131
+ end
132
+
133
+ def add_label(project, task, label)
134
+ task = get_story(project, task.id)
135
+ task.add_label(label)
136
+ task.save
137
+ end
138
+
139
+ def comment_task(project, task, comment)
140
+ task = get_story(project, task.id)
141
+ task.create_comment(text: comment)
142
+ end
143
+
144
+ def create_task(project, name, owner_ids, task_type)
145
+ project.create_story(:name => name, :story_type => task_type, owner_ids: owner_ids)
146
+ end
147
+
148
+ def create_task_with_description(project, name, owner, task_type, description)
149
+ project.create_story(:name => name, :story_type => task_type, :description => description)
150
+ end
151
+
152
+
153
+ end
@@ -0,0 +1,28 @@
1
+ require 'iconv' unless "older_ruby?".respond_to?(:force_encoding)
2
+
3
+ class PTT::DataRow
4
+
5
+ attr_accessor :num, :record, :state
6
+
7
+ def initialize(orig, dataset)
8
+ @record = orig
9
+ @num = dataset.index(orig) + 1
10
+ if defined? orig.current_state
11
+ @state = orig.current_state
12
+ end
13
+ end
14
+
15
+ def method_missing(method)
16
+ str = @record.send(method).to_s
17
+ str.respond_to?(:force_encoding) ? str.force_encoding('utf-8') : Iconv.iconv('UTF-8', 'UTF-8', str)
18
+ end
19
+
20
+ def to_s
21
+ @record.send(self.to_s_attribute)
22
+ end
23
+
24
+ def to_s_attribute
25
+ @n.to_s
26
+ end
27
+
28
+ end