pivo_flow 0.3.9 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -3
- data/lib/pivo_flow/cli.rb +13 -12
- data/lib/pivo_flow/pivotal.rb +30 -4
- data/lib/pivo_flow/version.rb +1 -1
- data/lib/pivo_flow.rb +1 -0
- data/pivo_flow.gemspec +1 -0
- metadata +18 -2
data/README.md
CHANGED
@@ -49,18 +49,23 @@ Display current gem version
|
|
49
49
|
|
50
50
|
pf version
|
51
51
|
|
52
|
+
Show current STORY_ID from temp file
|
53
|
+
|
54
|
+
pf current
|
55
|
+
|
52
56
|
## Git-hooks
|
53
57
|
|
54
58
|
This gem installs a `pepare-commit-msg` hook by adding a reference to `pf-prepare-commit-msg` file. In short: you shouldn't be worried about your own `prepare-commit-msg` hook, the one added by `pivo_flow` will be added in the last line of original hook file.
|
55
59
|
|
56
60
|
## Roadmap
|
57
61
|
|
58
|
-
###
|
62
|
+
### 0.4 Current release
|
59
63
|
|
60
|
-
* story statistics
|
61
64
|
* colorized output
|
65
|
+
* **TODO** story statistics
|
66
|
+
* **TODO** git statistics (number of commits in some peroid, average, etc.)
|
62
67
|
|
63
|
-
### 0.3
|
68
|
+
### 0.3
|
64
69
|
|
65
70
|
* single-story view with comments and tasks
|
66
71
|
* flow:
|
data/lib/pivo_flow/cli.rb
CHANGED
@@ -100,17 +100,18 @@ module PivoFlow
|
|
100
100
|
@options = {}
|
101
101
|
|
102
102
|
opt_parser = OptionParser.new do |opts|
|
103
|
-
opts.banner = "
|
103
|
+
opts.banner = "\nPivoFlow ver. #{PivoFlow::VERSION}\nUsage: pf <COMMAND> [OPTIONS]\n"
|
104
104
|
opts.separator "Commands"
|
105
|
-
opts.separator " clear
|
106
|
-
opts.separator "
|
107
|
-
opts.separator "
|
108
|
-
opts.separator "
|
109
|
-
opts.separator "
|
110
|
-
opts.separator "
|
111
|
-
opts.separator "
|
112
|
-
opts.separator "
|
113
|
-
opts.separator "
|
105
|
+
opts.separator " clear clear STORY_ID from temp file"
|
106
|
+
opts.separator " current show STORY_ID from temp file"
|
107
|
+
opts.separator " deliver show finished stories and mark selected as delivered in Pivotal Tracker"
|
108
|
+
opts.separator " help show this message"
|
109
|
+
opts.separator " finish [STORY_ID] finish story on Pivotal"
|
110
|
+
opts.separator " info show info about current story"
|
111
|
+
opts.separator " reconfig clear API_TOKEN and PROJECT_ID from git config and setup new values"
|
112
|
+
opts.separator " start <STORY_ID> start a story of given ID"
|
113
|
+
opts.separator " stories list stories for current project"
|
114
|
+
opts.separator " version show gem version"
|
114
115
|
opts.separator ""
|
115
116
|
opts.separator "Options"
|
116
117
|
|
@@ -124,11 +125,11 @@ module PivoFlow
|
|
124
125
|
return 1
|
125
126
|
end
|
126
127
|
|
127
|
-
opts.on("-t <API_TOKEN>", "--token <API_TOKEN>", "
|
128
|
+
opts.on("-t <API_TOKEN>", "--token <API_TOKEN>", "Set Pivotal Tracker API TOKEN") do |api_token|
|
128
129
|
@options["api-token"] = api_token
|
129
130
|
end
|
130
131
|
|
131
|
-
opts.on("-p <PROJECT_ID>", "--project <PROJECT_ID>", Numeric, "
|
132
|
+
opts.on("-p <PROJECT_ID>", "--project <PROJECT_ID>", Numeric, "Set Pivotal Tracker PROJECT_ID") do |project_id|
|
132
133
|
@options["project-id"] = project_id
|
133
134
|
end
|
134
135
|
|
data/lib/pivo_flow/pivotal.rb
CHANGED
@@ -90,7 +90,7 @@ module PivoFlow
|
|
90
90
|
puts "\n[TASKS]"
|
91
91
|
story.tasks.all.count.zero? ? puts(" no tasks") : print_tasks(story.tasks.all)
|
92
92
|
puts "\n[NOTES]"
|
93
|
-
story.
|
93
|
+
story_notes(story).count.zero? ? puts(" no notes") : print_notes(story_notes(story))
|
94
94
|
end
|
95
95
|
|
96
96
|
def find_story story_id
|
@@ -98,6 +98,11 @@ module PivoFlow
|
|
98
98
|
story.nil? ? @options[:project].stories.find(story_id) : story
|
99
99
|
end
|
100
100
|
|
101
|
+
def story_notes story, exclude_commits=true
|
102
|
+
return story.notes.all unless exclude_commits
|
103
|
+
story.notes.all.select { |n| n.text !~ /Commit by/ }
|
104
|
+
end
|
105
|
+
|
101
106
|
def story_string story, long=false
|
102
107
|
vars = {
|
103
108
|
story_id: story.id,
|
@@ -119,10 +124,31 @@ module PivoFlow
|
|
119
124
|
Description: %{description}
|
120
125
|
Estimate: %{estimate}" % vars
|
121
126
|
else
|
122
|
-
"[#%{story_id}] (%{started}) %{story_type} [%{estimate} pts.] %{owner} %{name}" % vars
|
127
|
+
"[#%{story_id}] (%{started}) %{story_type} [%{estimate} pts.] %{owner} %{name}".colorize(story_color(story)) % vars
|
123
128
|
end
|
124
129
|
end
|
125
130
|
|
131
|
+
def users_story?(story)
|
132
|
+
story.owned_by == user_name
|
133
|
+
end
|
134
|
+
|
135
|
+
def story_color story
|
136
|
+
if users_story?(story)
|
137
|
+
case story.story_type
|
138
|
+
when "feature" then :green
|
139
|
+
when "bug" then :red
|
140
|
+
when "chore" then :yellow
|
141
|
+
else :white
|
142
|
+
end
|
143
|
+
else
|
144
|
+
case story.story_type
|
145
|
+
when "feature" then :light_green
|
146
|
+
when "bug" then :light_red
|
147
|
+
when "chore" then :ligh_yellow
|
148
|
+
else :light_white
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
126
152
|
|
127
153
|
def print_tasks tasks
|
128
154
|
tasks.each { |task| puts task_string(task) }
|
@@ -226,8 +252,8 @@ module PivoFlow
|
|
226
252
|
list_stories_to_output stories.first(9)
|
227
253
|
end
|
228
254
|
|
229
|
-
def fetch_stories(count = 100, state = "unstarted,started,unscheduled,rejected")
|
230
|
-
conditions = { current_state: state, limit: count }
|
255
|
+
def fetch_stories(count = 100, state = "unstarted,started,unscheduled,rejected", story_type = "feature,chore,bug")
|
256
|
+
conditions = { current_state: state, limit: count, story_type: story_type }
|
231
257
|
@options[:stories] = @options[:project].stories.all(conditions)
|
232
258
|
end
|
233
259
|
|
data/lib/pivo_flow/version.rb
CHANGED
data/lib/pivo_flow.rb
CHANGED
data/pivo_flow.gemspec
CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.add_runtime_dependency "pivotal-tracker"
|
19
19
|
gem.add_runtime_dependency "grit"
|
20
20
|
gem.add_runtime_dependency "highline"
|
21
|
+
gem.add_runtime_dependency "colorize"
|
21
22
|
|
22
23
|
gem.add_development_dependency "rspec"
|
23
24
|
gem.add_development_dependency "simplecov"
|
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.
|
4
|
+
version: 0.4.0
|
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-
|
12
|
+
date: 2012-08-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pivotal-tracker
|
@@ -59,6 +59,22 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: colorize
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
62
78
|
- !ruby/object:Gem::Dependency
|
63
79
|
name: rspec
|
64
80
|
requirement: !ruby/object:Gem::Requirement
|