urbanopt-cli 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
+
1
2
  module URBANopt
2
3
  module CLI
3
- VERSION = '0.2.0'.freeze
4
+ VERSION = '0.3.0'.freeze
4
5
  end
5
6
  end
@@ -29,18 +29,16 @@ Gem::Specification.new do |spec|
29
29
  # spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
30
  spec.executables = ['uo']
31
31
  spec.require_paths = ['lib']
32
- spec.required_ruby_version = '~> 2.2.4'
33
-
34
- # use specific versions of these dependencies while using Ruby 2.2
35
- spec.add_development_dependency 'rack', '2.1.2'
32
+ spec.required_ruby_version = '~> 2.5.0'
36
33
 
37
34
  # use specific versions of urbanopt and openstudio dependencies while under heavy development
38
- spec.add_dependency 'urbanopt-geojson', '0.2.0'
39
- spec.add_dependency 'urbanopt-scenario', '0.2.0'
40
-
41
- spec.add_development_dependency 'bundler', '~> 1.17'
42
- spec.add_development_dependency 'github_api', '~> 0.18'
43
- spec.add_development_dependency 'rake', '~> 12.3'
44
- spec.add_development_dependency 'rspec', '~> 3.0'
35
+ spec.add_dependency 'optimist'
36
+ spec.add_dependency 'urbanopt-geojson', '~> 0.3.0'
37
+ spec.add_dependency 'urbanopt-reopt', '~> 0.3.0'
38
+ spec.add_dependency 'urbanopt-scenario', '~> 0.3.0'
39
+
40
+ spec.add_development_dependency 'bundler', '~> 2.1'
41
+ spec.add_development_dependency 'rake', '~> 13.0'
42
+ spec.add_development_dependency 'rspec', '~> 3.7'
45
43
  spec.add_development_dependency 'rubocop', '~> 0.54.0'
46
44
  end
metadata CHANGED
@@ -1,113 +1,113 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urbanopt-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Moore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-31 00:00:00.000000000 Z
11
+ date: 2020-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rack
14
+ name: optimist
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 2.1.2
20
- type: :development
19
+ version: '0'
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 2.1.2
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: urbanopt-geojson
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '='
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.2.0
33
+ version: 0.3.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '='
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.2.0
40
+ version: 0.3.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: urbanopt-scenario
42
+ name: urbanopt-reopt
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '='
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.2.0
47
+ version: 0.3.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '='
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.2.0
54
+ version: 0.3.0
55
55
  - !ruby/object:Gem::Dependency
56
- name: bundler
56
+ name: urbanopt-scenario
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.17'
62
- type: :development
61
+ version: 0.3.0
62
+ type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.17'
68
+ version: 0.3.0
69
69
  - !ruby/object:Gem::Dependency
70
- name: github_api
70
+ name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.18'
75
+ version: '2.1'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.18'
82
+ version: '2.1'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '12.3'
89
+ version: '13.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '12.3'
96
+ version: '13.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '3.0'
103
+ version: '3.7'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '3.0'
110
+ version: '3.7'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rubocop
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -136,7 +136,6 @@ files:
136
136
  - ".gitignore"
137
137
  - ".rspec"
138
138
  - ".rubocop.yml"
139
- - ".ruby-version"
140
139
  - CHANGELOG.md
141
140
  - CONTRIBUTING.md
142
141
  - Gemfile
@@ -162,7 +161,6 @@ files:
162
161
  - example_files/weather/USA_NY_Buffalo-Greater.Buffalo.Intl.AP.725280_TMY3.ddy
163
162
  - example_files/weather/USA_NY_Buffalo-Greater.Buffalo.Intl.AP.725280_TMY3.epw
164
163
  - example_files/weather/USA_NY_Buffalo-Greater.Buffalo.Intl.AP.725280_TMY3.stat
165
- - lib/change_log.rb
166
164
  - lib/uo_cli.rb
167
165
  - lib/uo_cli/version.rb
168
166
  - uo_cli.gemspec
@@ -179,15 +177,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
179
177
  requirements:
180
178
  - - "~>"
181
179
  - !ruby/object:Gem::Version
182
- version: 2.2.4
180
+ version: 2.5.0
183
181
  required_rubygems_version: !ruby/object:Gem::Requirement
184
182
  requirements:
185
183
  - - ">="
186
184
  - !ruby/object:Gem::Version
187
185
  version: '0'
188
186
  requirements: []
189
- rubyforge_project:
190
- rubygems_version: 2.4.5.1
187
+ rubygems_version: 3.1.2
191
188
  signing_key:
192
189
  specification_version: 4
193
190
  summary: URBANopt CLI
@@ -1,152 +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
- # For security, set your token as an env variable. This script is prepared for one called GITHUB_CHANGELOG_TOKEN
11
- #
12
- # Example:
13
- # ruby change_log.rb -t abcdefghijklmnopqrstuvwxyz -s 2017-09-06
14
- #
15
-
16
- options = {}
17
- OptionParser.new do |opts|
18
- opts.banner = "Usage: change_log.rb [options]\n" \
19
- 'Prints New, Open, Closed Issues, and number of accepted PRs'
20
- opts.separator ''
21
-
22
- # defaults, go back 90 days
23
- options[:start_date] = Date.today - 90
24
- # Add one day to end date to make it inclusive of current day.
25
- options[:end_date] = Date.today + 1
26
-
27
- opts.on('-s', '--start-date [DATE]', Date, 'Start of data (e.g. 2017-09-06)') do |v|
28
- options[:start_date] = v
29
- end
30
- opts.on('-e', '--end-date [DATE]', Date, 'End of data (e.g. 2017-09-13)') do |v|
31
- options[:end_date] = v
32
- end
33
- opts.on('-t', '--token [String]', String, 'Github API Token') do |v|
34
- options[:token] = v
35
- end
36
- end.parse!
37
-
38
- # Convert dates to time objects
39
- options[:start_date] = Time.parse(options[:start_date].to_s)
40
- options[:end_date] = Time.parse(options[:end_date].to_s)
41
- puts options
42
-
43
- ### Repository options
44
- repo_owner = 'URBANopt'
45
- repo = 'uo-cli'
46
-
47
- github = Github.new
48
- if options[:token]
49
- puts 'Using github token'
50
- github = Github.new oauth_token: options[:token]
51
- elsif ENV['GITHUB_CHANGELOG_TOKEN']
52
- puts 'Using Github token from user environment'
53
- github = Github.new oauth_token: ENV['GITHUB_CHANGELOG_TOKEN']
54
- end
55
-
56
- total_open_issues = []
57
- total_open_pull_requests = []
58
- new_issues = []
59
- closed_issues = []
60
- accepted_pull_requests = []
61
-
62
- def get_num(issue)
63
- issue.html_url.split('/')[-1].to_i
64
- end
65
-
66
- def get_issue_num(issue)
67
- "\##{get_num(issue)}"
68
- end
69
-
70
- def get_html_url(issue)
71
- issue.html_url
72
- end
73
-
74
- def get_title(issue)
75
- issue.title
76
- end
77
-
78
- def print_issue(issue)
79
- is_feature = false
80
- issue.labels.each { |label| is_feature = true if label.name == 'Feature Request' }
81
-
82
- if is_feature
83
- "- Improved [#{get_issue_num(issue)}]( #{get_html_url(issue)} ), #{get_title(issue)}"
84
- else
85
- "- Fixed [#{get_issue_num(issue)}]( #{get_html_url(issue)} ), #{get_title(issue)}"
86
- end
87
- end
88
-
89
- # Process Open Issues
90
- results = -1
91
- page = 1
92
- while results != 0
93
- resp = github.issues.list user: repo_owner, repo: repo, sort: 'created', direction: 'asc',
94
- state: 'open', per_page: 100, page: page
95
- results = resp.length
96
- resp.env[:body].each do |issue, _index|
97
- created = Time.parse(issue.created_at)
98
- if !issue.key?(:pull_request)
99
- total_open_issues << issue
100
- if created >= options[:start_date] && created <= options[:end_date]
101
- new_issues << issue
102
- end
103
- else
104
- total_open_pull_requests << issue
105
- end
106
- end
107
-
108
- page += 1
109
- end
110
-
111
- # Process Closed Issues
112
- results = -1
113
- page = 1
114
- while results != 0
115
- resp = github.issues.list user: repo_owner, repo: repo, sort: 'created', direction: 'asc',
116
- state: 'closed', per_page: 100, page: page
117
- results = resp.length
118
- resp.env[:body].each do |issue, _index|
119
- created = Time.parse(issue.created_at)
120
- closed = Time.parse(issue.closed_at)
121
- if !issue.key?(:pull_request)
122
- if created >= options[:start_date] && created <= options[:end_date]
123
- new_issues << issue
124
- end
125
- if closed >= options[:start_date] && closed <= options[:end_date]
126
- closed_issues << issue
127
- end
128
- elsif closed >= options[:start_date] && closed <= options[:end_date]
129
- accepted_pull_requests << issue
130
- end
131
- end
132
-
133
- page += 1
134
- end
135
-
136
- closed_issues.sort! { |x, y| get_num(x) <=> get_num(y) }
137
- new_issues.sort! { |x, y| get_num(x) <=> get_num(y) }
138
- accepted_pull_requests.sort! { |x, y| get_num(x) <=> get_num(y) }
139
- total_open_pull_requests.sort! { |x, y| get_num(x) <=> get_num(y) }
140
-
141
- puts "Total Open Issues: #{total_open_issues.length}"
142
- puts "Total Open Pull Requests: #{total_open_pull_requests.length}"
143
- puts "\nDate Range: #{options[:start_date].strftime('%m/%d/%y')} - #{options[:end_date].strftime('%m/%d/%y')}:"
144
- puts "\nNew Issues: #{new_issues.length} (" + new_issues.map { |issue| get_issue_num(issue) }.join(', ') + ')'
145
-
146
- puts "\nClosed Issues: #{closed_issues.length}"
147
- closed_issues.each { |issue| puts print_issue(issue) }
148
-
149
- puts "\nAccepted Pull Requests: #{accepted_pull_requests.length}"
150
- accepted_pull_requests.each { |issue| puts print_issue(issue) }
151
-
152
- puts "\nAll Open Issues: #{total_open_issues.length} (" + total_open_issues.map { |issue| get_issue_num(issue) }.join(', ') + ')'