fire_watch 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e69d5bd0206c3b3a44a41068f627b4bd13829eac
4
- data.tar.gz: 2489f588654a612f250375ba71a92f32aed3dc2d
3
+ metadata.gz: cfa0004ed0a9acacb699033f67db6c67c3c90894
4
+ data.tar.gz: 3ffd8276d86496c01f156a9a71e89326b5ba852a
5
5
  SHA512:
6
- metadata.gz: 9e3f4d2b5bc3e387fd9960533d398e3d64aede979a7cef03d2327e530bfe057a4ed034efa6c78274e388bc72b3298e1d959f2542f3482268ac1be46c9dfbdf94
7
- data.tar.gz: 76b98a17b6f8afea8c34aa9935ffc6169cb300cd5cb1c31ab410e3e042306727f5486d43efac4a57a1fdcf1582ae4fdafb7b04b379e9bfd4295ad15a21278eff
6
+ metadata.gz: a37be9fdecddb4dc47b2395d76cb6c16a57d38292183fb0e71aff1189a26161381049637027f7c173fda6220e109e3967d5cdbc5748f69b0366e3eb98ac29f82
7
+ data.tar.gz: b053ce65811870ba2c33546ca53df7eea4ab09e16fb28bb704db7349456cea08b0641d212535c0b75eff19f265ff9eeb7ab1b46ec81bf304869b71b2bc227dda
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_runtime_dependency "harvested", "~> 3.1"
33
33
  spec.add_runtime_dependency "highline", "~> 1.7"
34
34
  spec.add_runtime_dependency "github_api", "~> 0.17"
35
+ spec.add_runtime_dependency "ruby-progressbar", "~>1.8"
35
36
 
36
37
  spec.add_development_dependency "bundler", "~> 1.15"
37
38
  spec.add_development_dependency "rake", "~> 10.0"
@@ -1,6 +1,7 @@
1
1
  require 'highline'
2
2
  require 'harvested'
3
3
  require 'github_api'
4
+ require 'ruby-progressbar'
4
5
 
5
6
  module FireWatch
6
7
  class Runner
@@ -18,7 +19,10 @@ module FireWatch
18
19
  end
19
20
  end
20
21
 
22
+ puts "Fetching Repos from Github..."
21
23
  repos = @github_client.repos.list(org: 'wildland').sort_by{|r| r.name}
24
+
25
+
22
26
  selected_repo = nil
23
27
  cli.choose do |menu|
24
28
  menu.prompt = "Select Github Repo:"
@@ -29,12 +33,14 @@ module FireWatch
29
33
  end
30
34
  end
31
35
 
36
+ puts "Fetching Milestones from Github..."
32
37
  milestones = @github_client.issues.milestones.list(user: 'wildland',repo: selected_repo.name, state: 'all').sort_by{|m| m.title}
38
+
33
39
  selected_milestones = []
34
40
  done = false
35
41
  loop do
36
42
  cli.choose do |menu|
37
- menu.prompt = "Add/Remove Milestones (#{selected_milestones.map{|p| p.title}.join(', ')}): "
43
+ menu.prompt = "Add/Remove Milestones (#{selected_milestones.map(&:title).join(', ')}): "
38
44
  menu.choice("Done Adding Milestones") { done = true } if selected_milestones.count > 0
39
45
  milestones.each do |m|
40
46
  menu.choice(m.title) do
@@ -53,14 +59,17 @@ module FireWatch
53
59
  harvest_username = cli.ask('Harvest Username: ')
54
60
  harvest_password = cli.ask('Harvest Password: ') { |q| q.echo = 'x' }
55
61
  @harvest_client = Harvest.client(username: harvest_username, password: harvest_password, subdomain: 'wildland')
62
+
63
+ puts "Fetching Clients and Projects from Harvest..."
56
64
  clients = @harvest_client.clients.all
57
65
  projects = @harvest_client.projects.all
66
+
58
67
  selected_projects = []
59
68
  done = false
60
69
  show_all = false
61
70
  loop do
62
71
  cli.choose do |menu|
63
- menu.prompt = "Add/Remove Project (#{selected_projects.map{|p| p.name}.join(', ')}): "
72
+ menu.prompt = "Add/Remove Project (#{selected_projects.map(&:name).join(', ')}): "
64
73
  menu.choice("Done Adding Projects") { done = true } if selected_projects.count > 0
65
74
  clients.sort_by(&:name).each do |client|
66
75
  projects.select{|p| p.client_id == client.id}.sort_by(&:name).each do |p|
@@ -83,6 +92,7 @@ module FireWatch
83
92
  break if done
84
93
  end
85
94
 
95
+ puts "Fetching Users from Harvest..."
86
96
  harvest_users = @harvest_client.users.all
87
97
 
88
98
  time_entries = []
@@ -102,6 +112,9 @@ module FireWatch
102
112
  #Process Data
103
113
  csv_file_name = cli.ask('File name for report?').concat('.csv')
104
114
 
115
+ puts "Generating Report with " + selected_milestones.map(&:title).join(', ') + " vs " + selected_projects.map(&:name).join(', ')
116
+ puts "Saving to #{csv_file_name}"
117
+ progressbar = ProgressBar.create(format: "%a %b\u{15E7}%i %p%% %t", progress_mark: ' ', remainder_mark: "\u{FF65}", starting_at: 10)
105
118
  CSV.open(csv_file_name, "wb", force_quotes: true) do |csv|
106
119
  csv << [
107
120
  "Repo",
@@ -119,7 +132,6 @@ module FireWatch
119
132
 
120
133
  selected_milestones.each do |selected_milestone|
121
134
  issues, pull_request_issues = @github_client.issues.list(user: 'wildland', repo: selected_repo.name, milestone: selected_milestone.number, state: 'all').partition{|i| i.pull_request == nil}
122
-
123
135
  pull_requests = pull_request_issues.map do |i|
124
136
  @github_client.pull_requests.get(user: 'wildland', repo: selected_repo.name, number: i.number).body
125
137
  end
@@ -161,6 +173,7 @@ module FireWatch
161
173
  ]
162
174
  end
163
175
  end
176
+ progressbar.increment
164
177
  end
165
178
 
166
179
  pull_requests.each do |pr|
@@ -199,9 +212,11 @@ module FireWatch
199
212
  ]
200
213
  end
201
214
  end
215
+ progressbar.increment
202
216
  end
203
217
  end
204
218
  end
219
+ progressbar.finish
205
220
 
206
221
  if time_entries.count > 0 && cli.agree("#{time_entries.count} Time entries not in this milestone. Create a list of them?")
207
222
  time_entries_file_name = cli.ask('File name for report?').concat('.csv')
@@ -1,3 +1,3 @@
1
1
  module FireWatch
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fire_watch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Weakley
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.17'
55
+ - !ruby/object:Gem::Dependency
56
+ name: ruby-progressbar
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.8'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.8'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement