pivotal_shell 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pivotal_shell (0.0.1)
4
+ pivotal_shell (0.1.0)
5
5
  pivotal-tracker (= 0.3)
6
6
 
7
7
  GEM
data/README.markdown CHANGED
@@ -50,8 +50,6 @@ Show info on a story
50
50
 
51
51
  pivotal story 123456
52
52
 
53
- ## TODO
54
-
55
53
  Start story
56
54
 
57
55
  pivotal start 123456
@@ -60,6 +58,8 @@ Finish story
60
58
 
61
59
  pivotal finish 123456
62
60
 
61
+ ## TODO
62
+
63
63
  Commit (with git, all comments after the story id go to git, story id gets appended to comments)
64
64
 
65
65
  pivotal commit 123456 "some more comments"
data/bin/pivotal CHANGED
@@ -7,16 +7,23 @@ require 'pivotal_shell/configuration'
7
7
 
8
8
  PivotalShell::Configuration.load
9
9
 
10
- commands = {
11
- 'stories' => 'show a list of stories',
12
- 'story' => 'show information about a specific story',
13
- }
10
+ commands = [
11
+ ['stories', 'show a list of stories'],
12
+ ['story', 'show information about a specific story'],
13
+ ['start', 'start a story'],
14
+ ['finish', 'finish a story'],
15
+ ]
14
16
 
15
- banner = "Pivotal command-line client\nUsage: pivotal COMMAND PARAMS\n\nAvailable commands:\n\n#{commands.map{|c, d| "#{c} - #{d}"}.join("\n")}\n\nRun pivotal COMMAND --help for more info on a specific command\n\n"
17
+ banner = "Pivotal command-line client #{PivotalShell::VERSION}\nUsage: pivotal COMMAND PARAMS\n\nAvailable commands:\n\n#{commands.map{|c, d| "#{c} - #{d}"}.join("\n")}\n\nRun pivotal COMMAND --help for more info on a specific command\n\n"
18
+
19
+ if ARGV.length==1 && ARGV[0]=='--version'
20
+ puts "pivotal #{PivotalShell::VERSION}"
21
+ exit
22
+ end
16
23
 
17
24
  command = ARGV.shift
18
25
 
19
- unless commands.keys.include?(command)
26
+ unless commands.map{|c| c[0]}.include?(command)
20
27
  puts banner
21
28
  exit
22
29
  end
@@ -0,0 +1,35 @@
1
+ #<PivotalTracker::Story:0x90b74f4 @jira_url=nil, @requested_by="Pavel Pavlovsky", @name="Add titles for the pages", @attachments=[], @project_id=110960, @jira_id=nil, @id=5952583, @current_state="accepted", @integration_id=nil, @accepted_at=#<DateTime: 212157861559/86400,1/12,2299161>, @labels="ui", @url="http://www.pivotaltracker.com/story/show/5952583", @estimate=nil, @description="so they are identified correctly by user.\nto clarify", @other_id=nil, @created_at=#<DateTime: 5303878313/2160,1/8,2299161>, @owned_by="Leonid Shevtsov", @story_type="chore">
2
+ require 'optparse'
3
+
4
+ module PivotalShell::Commands
5
+ class PivotalShell::Commands::Finish < PivotalShell::Command
6
+ def initialize(options)
7
+ opts = OptionParser.new do |opts|
8
+ opts.banner = "Finish a Pivotal story. The story must be started.\nUsage: pivotal finish STORY_ID [options]\n\n"
9
+
10
+ opts.on_tail('--help', 'Show this help') do
11
+ puts opts
12
+ exit
13
+ end
14
+ end
15
+ opts.parse!(options)
16
+ if options.empty? || options.length>1
17
+ puts opts
18
+ exit
19
+ else
20
+ @story_id = options.first
21
+ end
22
+ end
23
+
24
+ def execute
25
+ @story = PivotalShell::Configuration.project.stories.find(@story_id)
26
+ if @story.nil?
27
+ puts 'Story not found'
28
+ elsif @story.current_state!='started'
29
+ puts 'Story is not in a started state: '+@story.name
30
+ else
31
+ @story.update(:current_state => 'started')
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,37 @@
1
+ #<PivotalTracker::Story:0x90b74f4 @jira_url=nil, @requested_by="Pavel Pavlovsky", @name="Add titles for the pages", @attachments=[], @project_id=110960, @jira_id=nil, @id=5952583, @current_state="accepted", @integration_id=nil, @accepted_at=#<DateTime: 212157861559/86400,1/12,2299161>, @labels="ui", @url="http://www.pivotaltracker.com/story/show/5952583", @estimate=nil, @description="so they are identified correctly by user.\nto clarify", @other_id=nil, @created_at=#<DateTime: 5303878313/2160,1/8,2299161>, @owned_by="Leonid Shevtsov", @story_type="chore">
2
+ require 'optparse'
3
+
4
+ module PivotalShell::Commands
5
+ class PivotalShell::Commands::Start < PivotalShell::Command
6
+ def initialize(options)
7
+ opts = OptionParser.new do |opts|
8
+ opts.banner = "Start a Pivotal story. The story must not be started yet.\nUsage: pivotal start STORY_ID [options]\n\n"
9
+
10
+ opts.on_tail('--help', 'Show this help') do
11
+ puts opts
12
+ exit
13
+ end
14
+ end
15
+ opts.parse!(options)
16
+ if options.empty? || options.length>1
17
+ puts opts
18
+ exit
19
+ else
20
+ @story_id = options.first
21
+ end
22
+ end
23
+
24
+ def execute
25
+ @story = PivotalShell::Configuration.project.stories.find(@story_id)
26
+ if @story.nil?
27
+ puts 'Story not found'
28
+ elsif @story.current_state=='started'
29
+ puts 'Story is already started: '+@story.name
30
+ elsif ['finished', 'delivered', 'accepted', 'rejected'].include? @story.current_state
31
+ puts 'Story is already finished: '+@story.name
32
+ else
33
+ @story.update(:current_state => 'started')
34
+ end
35
+ end
36
+ end
37
+ end
@@ -1,3 +1,3 @@
1
1
  module PivotalShell
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 2
10
- version: 0.0.2
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Leonid Shevtsov
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-02 00:00:00 +02:00
18
+ date: 2010-12-06 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -51,6 +51,8 @@ files:
51
51
  - bin/pivotal
52
52
  - lib/pivotal_shell.rb
53
53
  - lib/pivotal_shell/command.rb
54
+ - lib/pivotal_shell/commands/finish.rb
55
+ - lib/pivotal_shell/commands/start.rb
54
56
  - lib/pivotal_shell/commands/stories.rb
55
57
  - lib/pivotal_shell/commands/story.rb
56
58
  - lib/pivotal_shell/configuration.rb