pivotal_hub 0.0.1 → 0.0.2

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.
data/bin/pivotal-start CHANGED
@@ -6,23 +6,37 @@ story = Pivotal_Hub::Story.new
6
6
 
7
7
  if story.nil?
8
8
  puts "Enter a git directory and try again!"
9
+ exit
9
10
  end
10
11
 
11
12
  current_branch = story.get_current_branch
12
- result = /[aA-zZ]/ =~ current_branch
13
+
14
+ start_with_letter = /^[aA-zZ]/
15
+ result = start_with_letter =~ current_branch
16
+
13
17
  if result != nil
14
- puts "Sorry, but you are not in a ticket branch. Lets stop procastinating and finally open a ticket? [y/n]"
15
- option_typed = gets.chomp
16
- if option_typed.upcase == 'S'
17
-
18
- else
19
- puts "Bye!"
20
- exit
21
- end
18
+ puts "Sorry, but you are not in a ticket branch. Lets stop procastinating and finally open a ticket"
19
+
20
+ backlog_stories = story.get_backlog_stories
21
+
22
+ backlog_stories.each_with_index do |story, index|
23
+ puts "#{index} - #{story.name}"
24
+ end
25
+
26
+ puts "which ticket do you want start?"
27
+ index_ticket_typed = gets.chomp
28
+
29
+ story_choiced = backlog_stories.at(Integer(index_ticket_typed))
30
+ story.update_state(story_choiced.id,"started")
31
+ puts "ticket started, lets code!"
32
+ exit
22
33
  end
23
34
 
24
35
  ticket_number = current_branch.sub /\_.*$/,''
25
36
 
26
37
  sto = story.update_state(ticket_number,"started")
27
38
  puts "Ticket Name: #{sto.name}"
28
- puts "ticket started, lets code!"
39
+ puts "ticket started, lets code!"
40
+
41
+
42
+
data/lib/Story.rb CHANGED
@@ -9,7 +9,8 @@ module Pivotal_Hub
9
9
  if File.exists?('.git')
10
10
  @git = Git.open(Dir.pwd)
11
11
  @client = TrackerApi::Client.new(token: @git.config('pivotal.api-token'))
12
- @project = client.project(@git.config('pivotal.project-id'))
12
+ @project = @client.project(@git.config('pivotal.project-id'))
13
+ @label = @git.config('pivotal.sprint-label')
13
14
  else
14
15
  puts "Ops, you are not in git directory!"
15
16
  exit
@@ -19,6 +20,7 @@ module Pivotal_Hub
19
20
  def update_state story_id, state
20
21
  story = @project.story(story_id)
21
22
  story.current_state = state
23
+ story.owner_ids = [@client.me.id]
22
24
  story.save
23
25
  story
24
26
  end
@@ -27,6 +29,10 @@ module Pivotal_Hub
27
29
  @git.current_branch
28
30
  end
29
31
 
32
+ def get_backlog_stories
33
+ @project.stories(with_state: :unstarted, with_label:@label, limit: 10)
34
+ end
35
+
30
36
  end
31
37
  end
32
38
 
@@ -1,3 +1,3 @@
1
1
  module Pivotal_Hub
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivotal_hub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: