pivotal-cli 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/bin/pivotal CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'gli'
3
+ require 'git'
3
4
  require 'launchy'
4
5
  require 'rainbow'
5
6
  require 'pivotal_cli'
@@ -164,6 +165,38 @@ command :branch do |c|
164
165
  end
165
166
  end
166
167
 
168
+
169
+ desc 'Commit changes for a pivotal task'
170
+ arg_name '<commit>'
171
+ command :commit do |c|
172
+ c.action do |global_options,options,args|
173
+ ensure_setup_complete
174
+
175
+ git = Git.open(Dir.pwd)
176
+ branch = git.branches.local[0].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('"', '\"')}\""
190
+
191
+ else
192
+ puts Rainbow("No pivotal story found with id #{story_id}.").red
193
+ end
194
+ else
195
+ puts Rainbow("No pivotal story found based on branch name.").red
196
+ end
197
+ end
198
+ end
199
+
167
200
  desc 'Setup your pivotal account, by creating a config file in ~/.pivotal_cli'
168
201
  command :setup do |c|
169
202
  c.action do |global_options,options,args|
@@ -185,7 +218,6 @@ pre do |global,command,options,args|
185
218
  end
186
219
 
187
220
  post do |global,command,options,args|
188
- puts ""
189
221
  end
190
222
 
191
223
  on_error do |exception|
@@ -28,6 +28,15 @@ module PivotalCli
28
28
  end
29
29
  end
30
30
 
31
+ def find_story(story_id)
32
+ projects.each do |project|
33
+ story = project.stories.find(story_id)
34
+ return story unless story.nil?
35
+ end
36
+
37
+ nil
38
+ end
39
+
31
40
  def create_story(story)
32
41
  story.story_type = 'feature'
33
42
  story.owned_by = username
@@ -1,3 +1,3 @@
1
1
  module PivotalCli
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
data/pivotal_cli.gemspec CHANGED
@@ -18,4 +18,5 @@ spec = Gem::Specification.new do |s|
18
18
  s.add_runtime_dependency('launchy', '2.4.2')
19
19
  s.add_runtime_dependency('highline','1.6.21')
20
20
  s.add_runtime_dependency('pivotal-tracker', '0.5.12')
21
+ s.add_runtime_dependency('git', '1.2.8')
21
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivotal-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-04 00:00:00.000000000 Z
12
+ date: 2014-10-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gli
@@ -91,6 +91,22 @@ dependencies:
91
91
  - - '='
92
92
  - !ruby/object:Gem::Version
93
93
  version: 0.5.12
94
+ - !ruby/object:Gem::Dependency
95
+ name: git
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - '='
100
+ - !ruby/object:Gem::Version
101
+ version: 1.2.8
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - '='
108
+ - !ruby/object:Gem::Version
109
+ version: 1.2.8
94
110
  description:
95
111
  email: chetane@gmail.com
96
112
  executables: