pivotal-cli 0.0.7 → 0.0.8

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: fe23479d153709c4a177fd41d28faf49c6b5ee47
4
+ data.tar.gz: 5654d5c0d7b79b953775a08c4d78bc74be981bf2
5
+ SHA512:
6
+ metadata.gz: 7bc95ef7f73a414c62c2953e284375cb22d06398900aeb1aac41f2187de371b6fbbfc739340bed999fa77156d6cec847619ad5590bcf0ee71b7d664822f5b8b0
7
+ data.tar.gz: 1a0a6ad7b0184ab66684b115ed99545083ad22543a5d453f17127d06b8b270fe85ff4281f9db08451984037f38195eeb17fa86f5b76b6cdecd65e98e38b183b6
@@ -6,6 +6,9 @@ require 'rainbow'
6
6
  require 'pivotal_cli'
7
7
  require 'highline/import'
8
8
 
9
+ # Welcome message
10
+ puts Rainbow("\nPivotal CLI #{PivotalCli::VERSION}\n").yellow
11
+
9
12
  # Application high level settings
10
13
 
11
14
  include GLI::App
@@ -86,6 +89,27 @@ def find_story(story_id, allow_create = false)
86
89
  story
87
90
  end
88
91
 
92
+ def find_story_from_branch
93
+ git = Git.open(Dir.pwd)
94
+ branch = git.branches.local.find {|branch| branch.current }.to_s
95
+
96
+ matches = branch.match(/.+-pv-(?<story_id>\d+)/)
97
+ if matches && matches['story_id']
98
+ story_id = matches['story_id']
99
+ story = @tracker.find_story(story_id)
100
+ if story
101
+ puts Rainbow("Found story #{story_id}: #{story.name}").green
102
+ return story
103
+ else
104
+ puts Rainbow("No pivotal story found with id #{story_id}.").red
105
+ return nil
106
+ end
107
+ else
108
+ puts Rainbow("No pivotal story found based on branch name.").red
109
+ return nil
110
+ end
111
+ end
112
+
89
113
  # CLI entry points
90
114
 
91
115
  desc 'Display pivotal items assigned to you'
@@ -171,28 +195,51 @@ arg_name '<commit>'
171
195
  command :commit do |c|
172
196
  c.action do |global_options,options,args|
173
197
  ensure_setup_complete
198
+ story = find_story_from_branch
199
+ if story
200
+ git = Git.open(Dir.pwd)
201
+ git.add(all: true)
202
+ puts 'git add -A'
203
+
204
+ commit_message = "\"#{story.name.gsub('"', '\"')} [##{story.id}]\""
205
+ git.commit(commit_message)
206
+ puts "git commit -m #{commit_message}"
207
+ end
208
+ end
209
+ end
174
210
 
175
- git = Git.open(Dir.pwd)
176
- branch = git.branches.local.find {|branch| branch.current }.to_s
177
-
178
- matches = branch.match(/.+-pv-(?<story_id>\d+)/)
179
- if matches && matches['story_id']
180
- story_id = matches['story_id']
181
- story = @tracker.find_story(story_id)
182
- if story
183
- puts Rainbow("Found story #{story_id}: #{story.name}'").green
184
-
185
- git.add(all: true)
186
- puts 'git add -A'
187
-
188
- git.commit(story.name)
189
- puts "git commit -m \"#{story.name.gsub('"', '\"')}\""
211
+ desc 'Create a pull request from current branch'
212
+ command :'pull-request' do |c|
213
+ c.action do |global_options,options,args|
214
+ ensure_setup_complete
215
+ story = find_story_from_branch
216
+ if story
217
+ command = "hub pull-request -m \"#{story.name.gsub('"', '\"')}\""
218
+ puts command
219
+ if system(command)
220
+ @tracker.finish(story)
221
+ puts Rainbow("Set story #{story.id} as 'Finished'\n").green
222
+ else
223
+ puts Rainbow("^ Whoops, something went wrong...").red
224
+ end
225
+ end
226
+ end
227
+ end
190
228
 
229
+ desc 'Land a pull request from current branch'
230
+ command :land do |c|
231
+ c.action do |global_options,options,args|
232
+ ensure_setup_complete
233
+ story = find_story_from_branch
234
+ if story
235
+ command = "hub land"
236
+ puts command
237
+ if system(command)
238
+ @tracker.deliver(story)
239
+ puts Rainbow("Set story #{story.id} as 'Delivered'\n").green
191
240
  else
192
- puts Rainbow("No pivotal story found with id #{story_id}.").red
241
+ puts Rainbow("^ Whoops, something went wrong...").red
193
242
  end
194
- else
195
- puts Rainbow("No pivotal story found based on branch name.").red
196
243
  end
197
244
  end
198
245
  end
@@ -51,6 +51,14 @@ module PivotalCli
51
51
  story.update(current_state: 'started')
52
52
  end
53
53
 
54
+ def finish(story)
55
+ story.update(current_state: 'finished')
56
+ end
57
+
58
+ def deliver(story)
59
+ story.update(current_state: 'delivered')
60
+ end
61
+
54
62
  def load_configuration
55
63
  File.open(config_file, 'r') do |file|
56
64
  lines = file.readlines
@@ -1,3 +1,3 @@
1
1
  module PivotalCli
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivotal-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
5
- prerelease:
4
+ version: 0.0.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - Omar Skalli
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-10-28 00:00:00.000000000 Z
11
+ date: 2015-04-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: gli
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - '='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - '='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rainbow
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - '='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - '='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: launchy
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - '='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - '='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: highline
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - '='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - '='
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: pivotal-tracker
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - '='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - '='
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: git
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - '='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - '='
108
95
  - !ruby/object:Gem::Version
@@ -114,7 +101,7 @@ executables:
114
101
  extensions: []
115
102
  extra_rdoc_files: []
116
103
  files:
117
- - .gitignore
104
+ - ".gitignore"
118
105
  - Gemfile
119
106
  - LICENSE.txt
120
107
  - README.md
@@ -126,27 +113,26 @@ files:
126
113
  homepage: https://github.com/chetane/pivotal-cli
127
114
  licenses:
128
115
  - MIT
116
+ metadata: {}
129
117
  post_install_message:
130
118
  rdoc_options: []
131
119
  require_paths:
132
120
  - lib
133
121
  - lib
134
122
  required_ruby_version: !ruby/object:Gem::Requirement
135
- none: false
136
123
  requirements:
137
- - - ! '>='
124
+ - - ">="
138
125
  - !ruby/object:Gem::Version
139
126
  version: '0'
140
127
  required_rubygems_version: !ruby/object:Gem::Requirement
141
- none: false
142
128
  requirements:
143
- - - ! '>='
129
+ - - ">="
144
130
  - !ruby/object:Gem::Version
145
131
  version: '0'
146
132
  requirements: []
147
133
  rubyforge_project:
148
- rubygems_version: 1.8.24
134
+ rubygems_version: 2.4.2
149
135
  signing_key:
150
- specification_version: 3
136
+ specification_version: 4
151
137
  summary: Simple command line tool for working with Pivotal Stories
152
138
  test_files: []