fire_watch 0.2.6 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fire_watch/runner.rb +14 -16
- data/lib/fire_watch/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e69d5bd0206c3b3a44a41068f627b4bd13829eac
|
4
|
+
data.tar.gz: 2489f588654a612f250375ba71a92f32aed3dc2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e3f4d2b5bc3e387fd9960533d398e3d64aede979a7cef03d2327e530bfe057a4ed034efa6c78274e388bc72b3298e1d959f2542f3482268ac1be46c9dfbdf94
|
7
|
+
data.tar.gz: 76b98a17b6f8afea8c34aa9935ffc6169cb300cd5cb1c31ab410e3e042306727f5486d43efac4a57a1fdcf1582ae4fdafb7b04b379e9bfd4295ad15a21278eff
|
data/lib/fire_watch/runner.rb
CHANGED
@@ -4,6 +4,7 @@ require 'github_api'
|
|
4
4
|
|
5
5
|
module FireWatch
|
6
6
|
class Runner
|
7
|
+
ISSUE_REGEX = /.?#(\d+)/
|
7
8
|
def self.invoke
|
8
9
|
|
9
10
|
cli = HighLine.new
|
@@ -34,6 +35,7 @@ module FireWatch
|
|
34
35
|
loop do
|
35
36
|
cli.choose do |menu|
|
36
37
|
menu.prompt = "Add/Remove Milestones (#{selected_milestones.map{|p| p.title}.join(', ')}): "
|
38
|
+
menu.choice("Done Adding Milestones") { done = true } if selected_milestones.count > 0
|
37
39
|
milestones.each do |m|
|
38
40
|
menu.choice(m.title) do
|
39
41
|
if selected_milestones.include? m
|
@@ -43,7 +45,6 @@ module FireWatch
|
|
43
45
|
end
|
44
46
|
end
|
45
47
|
end
|
46
|
-
menu.choice("Done Adding Milestones") { done = true } if selected_milestones.count > 0
|
47
48
|
end
|
48
49
|
break if done
|
49
50
|
end
|
@@ -56,11 +57,14 @@ module FireWatch
|
|
56
57
|
projects = @harvest_client.projects.all
|
57
58
|
selected_projects = []
|
58
59
|
done = false
|
60
|
+
show_all = false
|
59
61
|
loop do
|
60
62
|
cli.choose do |menu|
|
61
63
|
menu.prompt = "Add/Remove Project (#{selected_projects.map{|p| p.name}.join(', ')}): "
|
64
|
+
menu.choice("Done Adding Projects") { done = true } if selected_projects.count > 0
|
62
65
|
clients.sort_by(&:name).each do |client|
|
63
66
|
projects.select{|p| p.client_id == client.id}.sort_by(&:name).each do |p|
|
67
|
+
next unless show_all || p.active
|
64
68
|
menu.choice("#{client.name} - #{p.name}") do
|
65
69
|
if selected_projects.include? p
|
66
70
|
selected_projects.delete(p)
|
@@ -70,7 +74,11 @@ module FireWatch
|
|
70
74
|
end
|
71
75
|
end
|
72
76
|
end
|
73
|
-
|
77
|
+
if show_all
|
78
|
+
menu.choice("Only Show Active Projects") { show_all = false }
|
79
|
+
else
|
80
|
+
menu.choice("Include Inactive Projects") { show_all = true }
|
81
|
+
end
|
74
82
|
end
|
75
83
|
break if done
|
76
84
|
end
|
@@ -118,12 +126,7 @@ module FireWatch
|
|
118
126
|
|
119
127
|
issues.each do |issue|
|
120
128
|
relevant_time_entries, time_entries = time_entries.partition do |entry|
|
121
|
-
|
122
|
-
if match_data.nil?
|
123
|
-
false
|
124
|
-
else
|
125
|
-
match_data["issue_number"].eql? issue.number.to_s
|
126
|
-
end
|
129
|
+
entry.notes.scan(ISSUE_REGEX).flatten.any?{|m| m.eql? issue.number.to_s }
|
127
130
|
end
|
128
131
|
|
129
132
|
if relevant_time_entries.empty?
|
@@ -151,7 +154,7 @@ module FireWatch
|
|
151
154
|
projects.select{|p| user_time_entries.map(&:project_id).uniq.include? p.id}.map(&:name).join(', '),
|
152
155
|
"#{user.first_name} #{user.last_name}", # Who
|
153
156
|
!issue.labels.nil? && !issue.labels.find{|l| l.name.include?"size:"}.nil? ? issue.labels.find{|l| l.name.include?"size:"}.name : "",
|
154
|
-
user_time_entries.inject(0){|sum, e| sum + e.hours },
|
157
|
+
user_time_entries.inject(0){|sum, e| sum + (e.hours / e.notes.scan(ISSUE_REGEX).flatten.count) },
|
155
158
|
issue.state,
|
156
159
|
"",
|
157
160
|
issue.labels.nil? ? "" : issue.labels.map{|l| l.name}.join(', ')
|
@@ -162,12 +165,7 @@ module FireWatch
|
|
162
165
|
|
163
166
|
pull_requests.each do |pr|
|
164
167
|
relevant_time_entries, time_entries = time_entries.partition do |entry|
|
165
|
-
|
166
|
-
if match_data.nil?
|
167
|
-
false
|
168
|
-
else
|
169
|
-
match_data["issue_number"].eql? pr.number.to_s
|
170
|
-
end
|
168
|
+
entry.notes.scan(ISSUE_REGEX).flatten.any?{|m| m.eql? issue.number.to_s }
|
171
169
|
end
|
172
170
|
if relevant_time_entries.empty?
|
173
171
|
csv << [
|
@@ -194,7 +192,7 @@ module FireWatch
|
|
194
192
|
projects.select{|p| user_time_entries.map(&:project_id).uniq.include? p.id}.map(&:name).join(', '),
|
195
193
|
"#{user.first_name} #{user.last_name}", # Who
|
196
194
|
!pr.labels.nil? && !pr.labels.find{|l| l.name.include?"size:"}.nil? ? pr.labels.find{|l| l.name.include?"size:"}.name : "",
|
197
|
-
user_time_entries.inject(0){|sum, e| sum + e.hours },
|
195
|
+
user_time_entries.inject(0){|sum, e| sum + (e.hours / e.notes.scan(ISSUE_REGEX).flatten.count) },
|
198
196
|
pr.state,
|
199
197
|
pr.merged ? "Y" : "N",
|
200
198
|
pr.labels.nil? ? "" : issue.labels.map{|l| l.name}.join(', ')
|
data/lib/fire_watch/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fire_watch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Weakley
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: harvested
|