urbanopt-core 0.3.0.pre1 → 0.3.0.pre2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -1
- data/Rakefile +1 -1
- data/lib/urbanopt/core/version.rb +1 -1
- metadata +1 -2
- data/lib/change_log.rb +0 -147
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c04b04812a1d54d896f1a8c0ed5739ebedd62c0a4c0e68b3e25312e987bca3c1
|
4
|
+
data.tar.gz: 9c474ac55e6c26ef0f36101a667a8044e634bb1b016a6fc49d8b49b06a451c49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a562196c878ecc57bd9817826da9fe894356107a3337bd4eaad102fce3f830363fd491b5c89b675eda7e68d1c86856411d28081619f7e44c0d88b52253a41049
|
7
|
+
data.tar.gz: 98d41cd9fcf1ec3487e632cd5aa06335eed0ab0c84bf4b338753d738b2b5961ffa38fbe3b62d9cbaa8bda1144ee0f11a93d3d6ed9e2e1f4bc3ad6508640ed46d
|
data/CHANGELOG.md
CHANGED
data/Rakefile
CHANGED
@@ -37,7 +37,7 @@ RSpec::Core::RakeTask.new(:spec)
|
|
37
37
|
require 'openstudio/extension/rake_task'
|
38
38
|
require 'urbanopt/core'
|
39
39
|
rake_task = OpenStudio::Extension::RakeTask.new
|
40
|
-
rake_task.set_extension_class(URBANopt::Core::Extension)
|
40
|
+
rake_task.set_extension_class(URBANopt::Core::Extension, 'urbanopt/urbanopt-core-gem')
|
41
41
|
|
42
42
|
require 'rubocop/rake_task'
|
43
43
|
RuboCop::RakeTask.new
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: urbanopt-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.0.
|
4
|
+
version: 0.3.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Macumber
|
@@ -89,7 +89,6 @@ files:
|
|
89
89
|
- doc_templates/copyright_erb.txt
|
90
90
|
- doc_templates/copyright_js.txt
|
91
91
|
- doc_templates/copyright_ruby.txt
|
92
|
-
- lib/change_log.rb
|
93
92
|
- lib/measures/.gitkeep
|
94
93
|
- lib/urbanopt/core.rb
|
95
94
|
- lib/urbanopt/core/extension.rb
|
data/lib/change_log.rb
DELETED
@@ -1,147 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'github_api'
|
4
|
-
require 'date'
|
5
|
-
require 'optparse'
|
6
|
-
require 'optparse/date'
|
7
|
-
|
8
|
-
# Instructions:
|
9
|
-
# Get a token from github's settings (https://github.com/settings/tokens)
|
10
|
-
#
|
11
|
-
# Example:
|
12
|
-
# ruby change_log.rb -t abcdefghijklmnopqrstuvwxyz -s 2017-09-06
|
13
|
-
#
|
14
|
-
|
15
|
-
options = {}
|
16
|
-
OptionParser.new do |opts|
|
17
|
-
opts.banner = "Usage: change_log.rb [options]\n" \
|
18
|
-
'Prints New, Open, Closed Issues, and number of accepted PRs'
|
19
|
-
opts.separator ''
|
20
|
-
|
21
|
-
# defaults, go back 90 days
|
22
|
-
options[:start_date] = Date.today - 90
|
23
|
-
options[:end_date] = Date.today
|
24
|
-
|
25
|
-
opts.on('-s', '--start-date [DATE]', Date, 'Start of data (e.g. 2017-09-06)') do |v|
|
26
|
-
options[:start_date] = v
|
27
|
-
end
|
28
|
-
opts.on('-e', '--end-date [DATE]', Date, 'End of data (e.g. 2017-09-13)') do |v|
|
29
|
-
options[:end_date] = v
|
30
|
-
end
|
31
|
-
opts.on('-t', '--token [String]', String, 'Github API Token') do |v|
|
32
|
-
options[:token] = v
|
33
|
-
end
|
34
|
-
end.parse!
|
35
|
-
|
36
|
-
# Convert dates to time objects
|
37
|
-
options[:start_date] = Time.parse(options[:start_date].to_s)
|
38
|
-
options[:end_date] = Time.parse(options[:end_date].to_s)
|
39
|
-
puts options
|
40
|
-
|
41
|
-
### Repository options
|
42
|
-
repo_owner = 'URBANopt'
|
43
|
-
repo = 'urbanopt-core-gem'
|
44
|
-
|
45
|
-
github = Github.new
|
46
|
-
if options[:token]
|
47
|
-
puts 'Using github token'
|
48
|
-
github = Github.new oauth_token: options[:token]
|
49
|
-
end
|
50
|
-
|
51
|
-
total_open_issues = []
|
52
|
-
total_open_pull_requests = []
|
53
|
-
new_issues = []
|
54
|
-
closed_issues = []
|
55
|
-
accepted_pull_requests = []
|
56
|
-
|
57
|
-
def get_num(issue)
|
58
|
-
issue.html_url.split('/')[-1].to_i
|
59
|
-
end
|
60
|
-
|
61
|
-
def get_issue_num(issue)
|
62
|
-
"\##{get_num(issue)}"
|
63
|
-
end
|
64
|
-
|
65
|
-
def get_html_url(issue)
|
66
|
-
issue.html_url
|
67
|
-
end
|
68
|
-
|
69
|
-
def get_title(issue)
|
70
|
-
issue.title
|
71
|
-
end
|
72
|
-
|
73
|
-
def print_issue(issue)
|
74
|
-
is_feature = false
|
75
|
-
issue.labels.each { |label| is_feature = true if label.name == 'Feature Request' }
|
76
|
-
|
77
|
-
if is_feature
|
78
|
-
"- Improved [#{get_issue_num(issue)}]( #{get_html_url(issue)} ), #{get_title(issue)}"
|
79
|
-
else
|
80
|
-
"- Fixed [#{get_issue_num(issue)}]( #{get_html_url(issue)} ), #{get_title(issue)}"
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
# Process Open Issues
|
85
|
-
results = -1
|
86
|
-
page = 1
|
87
|
-
while results != 0
|
88
|
-
resp = github.issues.list user: repo_owner, repo: repo, sort: 'created', direction: 'asc',
|
89
|
-
state: 'open', per_page: 100, page: page
|
90
|
-
results = resp.length
|
91
|
-
resp.env[:body].each do |issue, _index|
|
92
|
-
created = Time.parse(issue.created_at)
|
93
|
-
if !issue.key?(:pull_request)
|
94
|
-
total_open_issues << issue
|
95
|
-
if created >= options[:start_date] && created <= options[:end_date]
|
96
|
-
new_issues << issue
|
97
|
-
end
|
98
|
-
else
|
99
|
-
total_open_pull_requests << issue
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
page += 1
|
104
|
-
end
|
105
|
-
|
106
|
-
# Process Closed Issues
|
107
|
-
results = -1
|
108
|
-
page = 1
|
109
|
-
while results != 0
|
110
|
-
resp = github.issues.list user: repo_owner, repo: repo, sort: 'created', direction: 'asc',
|
111
|
-
state: 'closed', per_page: 100, page: page
|
112
|
-
results = resp.length
|
113
|
-
resp.env[:body].each do |issue, _index|
|
114
|
-
created = Time.parse(issue.created_at)
|
115
|
-
closed = Time.parse(issue.closed_at)
|
116
|
-
if !issue.key?(:pull_request)
|
117
|
-
if created >= options[:start_date] && created <= options[:end_date]
|
118
|
-
new_issues << issue
|
119
|
-
end
|
120
|
-
if closed >= options[:start_date] && closed <= options[:end_date]
|
121
|
-
closed_issues << issue
|
122
|
-
end
|
123
|
-
elsif closed >= options[:start_date] && closed <= options[:end_date]
|
124
|
-
accepted_pull_requests << issue
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
page += 1
|
129
|
-
end
|
130
|
-
|
131
|
-
closed_issues.sort! { |x, y| get_num(x) <=> get_num(y) }
|
132
|
-
new_issues.sort! { |x, y| get_num(x) <=> get_num(y) }
|
133
|
-
accepted_pull_requests.sort! { |x, y| get_num(x) <=> get_num(y) }
|
134
|
-
total_open_pull_requests.sort! { |x, y| get_num(x) <=> get_num(y) }
|
135
|
-
|
136
|
-
puts "Total Open Issues: #{total_open_issues.length}"
|
137
|
-
puts "Total Open Pull Requests: #{total_open_pull_requests.length}"
|
138
|
-
puts "\nDate Range: #{options[:start_date].strftime('%m/%d/%y')} - #{options[:end_date].strftime('%m/%d/%y')}:"
|
139
|
-
puts "\nNew Issues: #{new_issues.length} (" + new_issues.map { |issue| get_issue_num(issue) }.join(', ') + ')'
|
140
|
-
|
141
|
-
puts "\nClosed Issues: #{closed_issues.length}"
|
142
|
-
closed_issues.each { |issue| puts print_issue(issue) }
|
143
|
-
|
144
|
-
puts "\nAccepted Pull Requests: #{accepted_pull_requests.length}"
|
145
|
-
accepted_pull_requests.each { |issue| puts print_issue(issue) }
|
146
|
-
|
147
|
-
puts "\nAll Open Issues: #{total_open_issues.length} (" + total_open_issues.map { |issue| get_issue_num(issue) }.join(', ') + ')'
|