ipt 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7c0b0acbed66cdaae452c45c9ef28f5decd47c4
4
- data.tar.gz: 32dfa0167b2a113c58b55d0078c82d181ef503bd
3
+ metadata.gz: 7ac8ce93770bfa51fcefbeae2775e1df4be4f016
4
+ data.tar.gz: 5f260a22628dec679495fc37387d022cc3529456
5
5
  SHA512:
6
- metadata.gz: c352f0b94d487587f71e6a883d6773f8a0ed8adb4b13f0ffa73f46e9ed75041ac1b6f12953a0fe21c742217ca5acaa5ac7e8d20147f41163855c41351f0743f2
7
- data.tar.gz: 11fcb1385f1b10f83e833e11a1301233d041097df53cd49d1113dcc17e094d1e7c8b2097a3135288f3faa84a0428211ad340359dde9e06755be1698686f2c813
6
+ metadata.gz: 5c6e1b4178aebdc9c14b3e86197ec27cabf29209bb2b5b777a46f5730173f101a710e0b1d61117630f869babbf5fec8d0cc11058e98a82130dcf554edb6a1b41
7
+ data.tar.gz: c2032fa31e7b5da56d719cc343c48b3d15f099a16b5a94a8477f592930fd8e870e95dbc2efe5121de9824db935ad7bc79063a438ccebdd4e7d1c9fab74b79132
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Gem Version](https://badge.fury.io/rb/pt.svg)](https://badge.fury.io/rb/pt)
1
+ [![Gem Version](https://badge.fury.io/rb/ipt.svg)](https://badge.fury.io/rb/ipt)
2
2
  [![Build Status](https://travis-ci.org/drselump14/ipt.svg?branch=master)](https://travis-ci.org/drselump14/ipt)
3
3
 
4
4
  # ipt
@@ -73,15 +73,16 @@ module PT
73
73
  def comment_story(story)
74
74
  say("Please write your comment")
75
75
  comment = edit_using_editor
76
- if @client.comment_task(story, comment)
76
+ begin
77
+ @client.comment_task(story, comment)
77
78
  congrats("Comment sent, thanks!")
78
79
  save_recent_task( story.id )
79
- else
80
- error("Ummm, something went wrong.")
80
+ rescue
81
+ error("Ummm, something went wrong. Comment cancelled")
81
82
  end
82
83
  end
83
84
 
84
- def label_story(story)
85
+ def add_label_story(story)
85
86
  label = ask("Which label?")
86
87
  @client.add_label(story, label );
87
88
  congrats("#{label} added, thanks!")
@@ -179,14 +180,14 @@ module PT
179
180
  end
180
181
 
181
182
  # set story type
182
- type = case ask('Type? (c)hore, (b)ug, anything else for feature)')
183
- when 'c', 'chore'
184
- 'chore'
185
- when 'b', 'bug'
186
- 'bug'
187
- else
188
- 'feature'
189
- end
183
+ type = HighLine.new.choose do |menu|
184
+ menu.prompt = 'Please set type of story:'
185
+ menu.choice(:feature)
186
+ menu.choice(:bug)
187
+ menu.choice(:chore)
188
+ menu.choice(:release)
189
+ menu.default = :feature
190
+ end
190
191
 
191
192
  description = edit_using_editor if ask('Do you want to write description now?(y/n)') == 'y'
192
193
  story = @client.create_story(
@@ -196,7 +197,7 @@ module PT
196
197
  story_type: type,
197
198
  description: description
198
199
  )
199
- congrats("#{type} #{('for' + owner.name ) if owner} has been created \n #{story.url}")
200
+ congrats("#{type} #{(' for ' + owner.name ) if owner} has been created \n #{story.url}")
200
201
  story
201
202
  end
202
203
 
@@ -251,9 +252,13 @@ module PT
251
252
  temp_path = "/tmp/editor-#{ Process.pid }.txt"
252
253
  File.write(temp_path, content) if content
253
254
  system "#{ editor } #{ temp_path }"
254
- content = File.read(temp_path)
255
- File.delete(temp_path)
256
- content
255
+ begin
256
+ content = File.read(temp_path)
257
+ File.delete(temp_path)
258
+ content
259
+ rescue
260
+ ""
261
+ end
257
262
  end
258
263
 
259
264
  def choose_person
@@ -262,6 +267,9 @@ module PT
262
267
  select("Please select a member to see his tasks.", table)
263
268
  end
264
269
 
270
+ def open_story_from
271
+ end
272
+
265
273
  def save_recent_task( task_id )
266
274
  # save list of recently accessed tasks
267
275
  unless (Settings[:recent_tasks])
@@ -21,7 +21,7 @@ module PT
21
21
  attr_reader :project
22
22
 
23
23
  TYPE=%w[feature bug chore release]
24
- ACTION = %w[show open start finish deliver accept reject done assign estimate tasks comment label edit unstart]
24
+ ACTION = %w[show open start finish deliver accept reject done assign estimate tasks comment add_label edit unstart]
25
25
 
26
26
  default_task :mywork
27
27
 
@@ -68,6 +68,14 @@ module PT
68
68
  end
69
69
  end
70
70
 
71
+ desc "label <label>", "filter stories by label"
72
+ def label(_label=nil)
73
+ _label ||= select('Please select label', LabelsTable.new(@client.project.labels)).name
74
+ select_story_from_paginated_table(title: "stories with label:#{_label}") do |page|
75
+ @client.get_stories(filter: "label:#{_label}", page: page)
76
+ end
77
+ end
78
+
71
79
  TYPE.each do |type|
72
80
  desc "#{type} <owner>", "show all #{type} stories"
73
81
  define_method(type.to_sym) do |owner = nil|
@@ -159,5 +167,10 @@ module PT
159
167
  end
160
168
  show_story(story)
161
169
  end
170
+
171
+ desc 'notifications', "show notifications"
172
+ def notifications
173
+ NotificationsTable.new(@client.notifications).print
174
+ end
162
175
  end
163
176
  end
@@ -122,7 +122,7 @@ module PT
122
122
  end
123
123
 
124
124
  def comment_task(story, comment)
125
- task.create_comment(text: comment)
125
+ story.create_comment(text: comment)
126
126
  end
127
127
 
128
128
  def create_story(args)
@@ -97,10 +97,15 @@ module PT
97
97
  end
98
98
  end
99
99
 
100
- class ActionTable < DataTable
100
+ class NotificationsTable < DataTable
101
+ def self.fields
102
+ [:message, :context]
103
+ end
104
+ end
101
105
 
106
+ class LabelsTable < DataTable
102
107
  def self.fields
103
- [:action]
108
+ [:name]
104
109
  end
105
110
  end
106
111
 
@@ -153,7 +153,7 @@ module PT
153
153
  menu.choice(:deliver, nil,'deliver'.yellow) { deliver_story(story) }
154
154
  menu.choice(:accept, nil,'accept'.green) { accept_story(story) }
155
155
  menu.choice(:reject, nil,'reject'.red) { reject_story(story) }
156
- %w[unstart assign estimate tasks comment label open].each do |action|
156
+ %w[unstart assign estimate tasks comment add_label open].each do |action|
157
157
  menu.choice(action.to_sym) { send("#{action}_story", story) }
158
158
  end
159
159
  menu.choice('id (copy story id)') { copy_story_id(story)}
@@ -167,7 +167,7 @@ module PT
167
167
  def choose_filter
168
168
  HighLine.new.choose do |menu|
169
169
  menu.prompt = "Please choose filter ( [number/name]:select filter | [Enter]:back to table)".magenta
170
- %w[current backlog mywork bug feature unstarted started finished delivered accepted rejected].each do |f|
170
+ %w[current backlog mywork label bug feature unstarted started finished delivered accepted rejected].each do |f|
171
171
  menu.choice(f.to_sym) do
172
172
  say 'filtering ' + f
173
173
  send(f.to_sym)
@@ -1,3 +1,3 @@
1
1
  module PT
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ipt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Slamet Kristanto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-15 00:00:00.000000000 Z
11
+ date: 2017-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler