pt-flow 2.5.0 → 2.6.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5dad96a8e3224c8cbe72165d4a2cf1b8739668ce
4
- data.tar.gz: 81195faf964969a93f3a1c6e2c298938682b276c
3
+ metadata.gz: f8117a7233567e54d42037493ed1806c9df57163
4
+ data.tar.gz: 1cf77e91f889ffdc846cebf53d35ecf8aa07e258
5
5
  SHA512:
6
- metadata.gz: 7aaac10e0375f9b6cfd33c9ae7faa3d78ff1178ab848497dd21206f0aa6616317c10b79c9cb76b7bf97e6958be4fa5b57993f9bbb5b965d2623ef39463648bf0
7
- data.tar.gz: b834fc75da1bb618cdde7255a371679c9fa005fca3630b353210eb747a75c63bed44392e613887f60c1123797d954f723e693c4fc9e891240dad61ff4879ca17
6
+ metadata.gz: 2664c9045ddde1eafa9174987ea66f167d85777dbba6326f5bb1efa7ad6c88bcfc3e15cafdf8e85464a315aa4eed7f2ddb6eeb76341c3c1001a2b9e91fdb6887
7
+ data.tar.gz: 75ef19814d4619d8b6da33ef5eac6fbe7240e331332613e6f38b652003e2bc281ad8f4fb9add156c3e0cc681b476a296693a595da8bd0f04d8f4b91d14738c3d
data/README.md CHANGED
@@ -19,8 +19,11 @@ $ git start
19
19
  # shows lists of tasks (excluding icebox) - choosing one starts/assigns the task on pt and
20
20
  # automatically creates and checks out a new branch.
21
21
 
22
- $ git start --include-icebox
23
- # same as git start, including contents of icebox
22
+ $ git start --filter=icebox
23
+ # same as git start, showing contents of icebox
24
+
25
+ $ git start --filter=me
26
+ # shows only own tasks
24
27
 
25
28
  $ git finish
26
29
  # pushes branch, finishes task on pt, and opens new pull request
@@ -6,6 +6,7 @@ require 'pt-flow/task_row'
6
6
  require 'pt-flow/tasks_table'
7
7
  require 'pt-flow/ui'
8
8
  require 'hirb-colors'
9
+ require 'trollop'
9
10
 
10
11
  module PT
11
12
  module Flow
@@ -6,17 +6,20 @@ module PT::Flow
6
6
  end
7
7
 
8
8
  def start
9
+ @options = Trollop::options(@params.dup) do
10
+ opt :filter, 'Allow filtering tasks', type: :string
11
+ end
12
+
9
13
  if @params[0] && !@params[0].start_with?('--')
10
14
  task = create
11
15
  else
12
- filter = 'unstarted,started'
13
- filter += ',unscheduled' if @params.include?('--include-icebox')
14
- table = TasksTable.new(@project.stories.all(:current_state => filter))
16
+ filter = filters[@options[:filter]] || { current_state: 'unstarted,started' }
17
+ table = TasksTable.new @project.stories.all(filter)
15
18
  title("Available tasks in #{project_to_s}")
16
19
  task = select("Please select a task to start working on", table)
17
20
  end
18
21
  estimate_task(task, ask("How many points do you estimate for it? (#{@project.point_scale})")) if task.estimate && task.estimate < 0
19
- assign_task(task, @local_config[:user_name])
22
+ assign_task(task, user_name)
20
23
  start_task(task)
21
24
  run("git checkout -b #{Branch.from_task(task)}")
22
25
  end
@@ -25,7 +28,7 @@ module PT::Flow
25
28
  name = @params[0] || ask("Name for the new story:")
26
29
  types = { 'c' => 'chore', 'b' => 'bug', 'f' => 'feature' }
27
30
  task_type = types[ask('Type? (c)hore, (b)ug, (f)eature')]
28
- task = @project.stories.create(name: name, requested_by: @local_config[:user_name], story_type: task_type)
31
+ task = @project.stories.create(name: name, requested_by: user_name, story_type: task_type)
29
32
  if task.errors.any?
30
33
  error(task.errors.errors)
31
34
  else
@@ -35,10 +38,15 @@ module PT::Flow
35
38
  end
36
39
 
37
40
  def finish
41
+ @options = Trollop::options(@params.dup) do
42
+ opt :deliver, 'Merge branch automatically'
43
+ opt :wip, 'submits [WIP] pull request'
44
+ end
45
+
38
46
  run "git push origin #{branch} -u"
39
- if @params.include?('--deliver')
47
+ if @options[:deliver]
40
48
  deliver!
41
- elsif @params.include?('--wip')
49
+ elsif @options[:wip]
42
50
  open_url pull_request_url('[WIP]')
43
51
  else
44
52
  finish_task current_task
@@ -67,64 +75,75 @@ module PT::Flow
67
75
 
68
76
  private
69
77
 
70
- def branch
71
- @branch ||= Branch.current
72
- end
78
+ def branch
79
+ @branch ||= Branch.current
80
+ end
73
81
 
74
- def repo
75
- @repo ||= Repo.new
76
- end
82
+ def repo
83
+ @repo ||= Repo.new
84
+ end
77
85
 
78
- def assign_task(task, owner)
79
- result = @client.assign_task(@project, task, owner)
80
- if result.errors.any?
81
- error(result.errors.errors)
82
- else
83
- congrats("Task assigned to #{owner}")
86
+ def assign_task(task, owner)
87
+ result = @client.assign_task(@project, task, owner)
88
+ if result.errors.any?
89
+ error(result.errors.errors)
90
+ else
91
+ congrats("Task assigned to #{owner}")
92
+ end
84
93
  end
85
- end
86
94
 
87
- def current_task
88
- PivotalTracker::Story.find(branch.task_id, @project.id)
89
- end
95
+ def current_task
96
+ PivotalTracker::Story.find(branch.task_id, @project.id)
97
+ end
90
98
 
91
- def task_title
92
- task_title = current_task.name.gsub('"',"'") + " [Delivers ##{current_task.id}]"
93
- task_title = 'Bugfix: ' + task_title if current_task.story_type == 'bug'
94
- task_title
95
- end
99
+ def task_title
100
+ task_title = current_task.name.gsub('"',"'") + " [Delivers ##{current_task.id}]"
101
+ task_title = 'Bugfix: ' + task_title if current_task.story_type == 'bug'
102
+ task_title
103
+ end
96
104
 
97
- def pull_request_url(prefix = nil)
98
- title = URI.escape "#{prefix} #{task_title}".strip
99
- repo.url + "/compare/#{branch.target}...#{branch}?expand=1&title=#{title}"
100
- end
105
+ def pull_request_url(prefix = nil)
106
+ title = URI.escape "#{prefix} #{task_title}".strip
107
+ repo.url + "/compare/#{branch.target}...#{branch}?expand=1&title=#{title}"
108
+ end
101
109
 
102
- def deliver!
103
- run "hub pull-request -b #{branch.target} -h #{repo.user}:#{branch} -m \"#{task_title}\""
104
- finished_branch = branch
105
- title = task_title
106
- run "git checkout #{finished_branch.target}"
107
- run "git pull"
108
- run "git merge #{finished_branch} --no-ff -m \"#{title}\""
109
- run "git push origin #{finished_branch.target}"
110
- end
110
+ def deliver!
111
+ run "hub pull-request -b #{branch.target} -h #{repo.user}:#{branch} -m \"#{task_title}\""
112
+ finished_branch = branch
113
+ title = task_title
114
+ run "git checkout #{finished_branch.target}"
115
+ run "git pull"
116
+ run "git merge #{finished_branch} --no-ff -m \"#{title}\""
117
+ run "git push origin #{finished_branch.target}"
118
+ end
111
119
 
112
- def open_url(url)
113
- if ENV['BROWSER'] == 'echo'
114
- title url
115
- else
116
- run "open \"#{url}\""
120
+ def open_url(url)
121
+ if ENV['BROWSER'] == 'echo'
122
+ title url
123
+ else
124
+ run "open \"#{url}\""
125
+ end
117
126
  end
118
- end
119
127
 
120
- def run(command)
121
- title(command)
122
- error("Error running: #{command}") unless system(command)
123
- end
128
+ def run(command)
129
+ title(command)
130
+ error("Error running: #{command}") unless system(command)
131
+ end
124
132
 
125
- def error(*msg)
126
- super
127
- exit(false)
128
- end
133
+ def error(*msg)
134
+ super
135
+ exit(false)
136
+ end
137
+
138
+ def filters
139
+ {
140
+ 'icebox' => { current_state: 'unscheduled' },
141
+ 'me' => { current_state: 'unstarted,started', owner: user_name }
142
+ }
143
+ end
144
+
145
+ def user_name
146
+ @local_config[:user_name]
147
+ end
129
148
  end
130
149
  end
@@ -1,5 +1,5 @@
1
1
  module PT
2
2
  module Flow
3
- VERSION = '2.5.0'
3
+ VERSION = '2.6.0'
4
4
  end
5
5
  end
@@ -20,6 +20,7 @@ Gem::Specification.new do |gem|
20
20
  gem.add_dependency 'pivotal-tracker'
21
21
  gem.add_dependency 'activesupport'
22
22
  gem.add_dependency 'hirb-colors'
23
+ gem.add_dependency 'trollop', '~> 2.1'
23
24
 
24
25
  gem.add_development_dependency 'rspec', '~> 2.9'
25
26
  gem.add_development_dependency 'webmock'
@@ -73,14 +73,20 @@ module PT::Flow
73
73
  end
74
74
  end
75
75
 
76
- context 'given --include-icebox' do
77
- it "it includes icebox stories" do
76
+ context 'given various filters' do
77
+ before do
78
78
  prompt.should_receive(:ask).with("Please select a task to start working on (1-14, 'q' to exit)".bold).and_return('2')
79
79
  prompt.should_receive(:ask).with("How many points do you estimate for it? (0,1,2,3)".bold).and_return('3')
80
+ end
80
81
 
81
- UI.new('start', ['--include-icebox'])
82
+ it "it allows showing icebox contents" do
83
+ UI.new('start', ['--filter=icebox'])
84
+ WebMock.should have_requested(:get, "#{endpoint}/projects/102622/stories?filter=current_state:unscheduled")
85
+ end
82
86
 
83
- WebMock.should have_requested(:get, "#{endpoint}/projects/102622/stories?filter=current_state:unstarted,started,unscheduled")
87
+ it "it allows showing your own tasks" do
88
+ UI.new('start', ['--filter=me'])
89
+ WebMock.should have_requested(:get, "#{endpoint}/projects/102622/stories?filter=current_state:unstarted,started+owner:Jon+Mischo")
84
90
  end
85
91
  end
86
92
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pt-flow
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Balvig
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-22 00:00:00.000000000 Z
11
+ date: 2015-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pt
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: trollop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.1'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.1'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rspec
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -184,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
198
  version: '0'
185
199
  requirements: []
186
200
  rubyforge_project:
187
- rubygems_version: 2.4.3
201
+ rubygems_version: 2.4.5
188
202
  signing_key:
189
203
  specification_version: 4
190
204
  summary: Some extra methods for the pt gem to use in our dev flow.