pivo_flow 0.2.3 → 0.2.5

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.
@@ -13,7 +13,7 @@ module PivoFlow
13
13
  @git_hook_path = File.join(@git_dir, 'hooks', 'prepare-commit-msg')
14
14
  @pf_git_hook_name = 'pf-prepare-commit-msg'
15
15
  @pf_git_hook_path = File.join(@git_dir, 'hooks', @pf_git_hook_name)
16
-
16
+ @pf_git_hook_cmd = "#{@pf_git_hook_path} $1"
17
17
  @options[:repository] = Grit::Repo.new(@git_dir)
18
18
  install_git_hook if git_hook_needed?
19
19
  git_config_ok? ? parse_git_config : add_git_config
@@ -29,8 +29,8 @@ module PivoFlow
29
29
  hook_path = File.join(File.dirname(__FILE__), '..', '..', 'bin', @pf_git_hook_name)
30
30
  FileUtils.cp(hook_path, @pf_git_hook_path, preserve: true)
31
31
  puts "File copied..."
32
- unless File.exists?(@git_hook_path) && File.read(@git_hook_path).match(/#{@pf_git_hook_name} \$1/)
33
- File.open(@git_hook_path, "a") { |f| f.puts("#{@pf_git_hook_path} $1") }
32
+ unless File.exists?(@git_hook_path) && File.read(@git_hook_path).match(@pf_git_hook_cmd)
33
+ File.open(@git_hook_path, "a") { |f| f.puts(@pf_git_hook_cmd) }
34
34
  puts "Reference to pf-prepare-commit-msg added to prepare-commit-msg..."
35
35
  end
36
36
  unless File.executable?(@git_hook_path)
@@ -21,6 +21,10 @@ module PivoFlow
21
21
  @options[:stories] ||= fetch_stories
22
22
  end
23
23
 
24
+ def other_users_stories
25
+ project_stories.select{ |story| story.owned_by != user_name }
26
+ end
27
+
24
28
  def unasigned_stories
25
29
  project_stories.select{ |story| story.owned_by == nil }
26
30
  end
@@ -49,9 +53,11 @@ module PivoFlow
49
53
  requested_by: story.requested_by,
50
54
  name: story.name,
51
55
  story_type: story_type_icon(story),
52
- estimate: estimate_points(story)
56
+ estimate: estimate_points(story),
57
+ owner: story_owner(story),
58
+ started: story.current_state == "started" ? "started >" : ""
53
59
  }
54
- story_text = "[#%{story_id}] %{story_type} [%{estimate} pts.] (requested by: %{requested_by}) %{name}" % vars
60
+ story_text = "%{started} [#%{story_id}] %{story_type} [%{estimate} pts.] %{owner} %{name}" % vars
55
61
  story_text += "\n Description: #{story.description}" unless story.description
56
62
  menu.choice(story_text) { |answer| pick_up_story(answer.match(/\[#(?<id>\d+)\]/)[:id])}
57
63
  end
@@ -67,6 +73,14 @@ module PivoFlow
67
73
  end
68
74
  end
69
75
 
76
+ def story_owner story
77
+ story.owned_by.nil? ? "" : "(#{initials(story.owned_by)})"
78
+ end
79
+
80
+ def initials name
81
+ name.split.map{ |n| n[0]}.join
82
+ end
83
+
70
84
  def estimate_points story
71
85
  unless story.estimate.nil?
72
86
  story.estimate < 0 ? "?" : story.estimate
@@ -83,7 +97,9 @@ module PivoFlow
83
97
  story = @options[:project].stories.find(story_id)
84
98
  if story.nil?
85
99
  puts "Story not found, sorry."
100
+ return
86
101
  end
102
+ state = :accepted if story.story_type == "chore" && state == :finished
87
103
  if story.update(owned_by: user_name, current_state: state).errors.count.zero?
88
104
  puts "Story updated in Pivotal Tracker"
89
105
  true
@@ -112,15 +128,11 @@ module PivoFlow
112
128
  end
113
129
 
114
130
  def show_stories
115
- stories = user_stories + unasigned_stories
116
- if stories.count.zero?
117
- puts "hmm... there is no story assigned to you! I'll better check for unasigned stories!"
118
- stories = unasigned_stories
119
- end
120
- list_stories_to_output stories.first(10)
131
+ stories = user_stories + other_users_stories
132
+ list_stories_to_output stories.first(9)
121
133
  end
122
134
 
123
- def fetch_stories(count = 100, state = "unstarted,unscheduled")
135
+ def fetch_stories(count = 100, state = "unstarted,started,unscheduled")
124
136
  conditions = { current_state: state, limit: count }
125
137
  @options[:stories] = @options[:project].stories.all(conditions)
126
138
  end
@@ -1,3 +1,3 @@
1
1
  module PivoFlow
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivo_flow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.5
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: 2012-08-06 00:00:00.000000000 Z
12
+ date: 2012-08-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pivotal-tracker