openstudio-extension 0.2.0 → 0.2.5
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/.gitignore +2 -0
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +45 -1
- data/Jenkinsfile +2 -2
- data/README.md +22 -28
- data/Rakefile +1 -1
- data/lib/change_log.rb +138 -128
- data/lib/measures/openstudio_extension_test_measure/measure.xml +20 -19
- data/lib/openstudio/extension.rb +27 -10
- data/lib/openstudio/extension/core/CreateResults.rb +178 -1
- data/lib/openstudio/extension/core/os_lib_constructions.rb +6 -1
- data/lib/openstudio/extension/core/os_lib_geometry.rb +255 -77
- data/lib/openstudio/extension/core/os_lib_model_generation.rb +2547 -86
- data/lib/openstudio/extension/core/os_lib_reporting.rb +133 -30
- data/lib/openstudio/extension/rake_task.rb +232 -18
- data/lib/openstudio/extension/runner.rb +32 -19
- data/lib/openstudio/extension/runner_config.rb +16 -1
- data/lib/openstudio/extension/version.rb +1 -1
- data/openstudio-extension.gemspec +12 -12
- metadata +30 -33
- data/lib/measures/openstudio_extension_test_measure/tests/openstudio_extension_test_measure_test.rb +0 -74
- data/lib/openstudio/extension/core/os_lib_cofee.rb +0 -259
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75c383235ef747996dd9484f715ab090201aeae62521c44f7166e4664057c83b
|
4
|
+
data.tar.gz: dc5e71c966b27041394772057b6c2625a735d34e6f1864e39d46378483743f3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bca71f3d261ddd15966a690859f01c5c6344259e96069f844ebf0da0bd395c18d79d6d8e48a680faa74a627e30aae38833c00a4c3ae3f29dfd8f4f47a2499b8
|
7
|
+
data.tar.gz: b50492d24de160505451599128ee177289ceac185bfd9ea560cd2447683ecef7c569699f59094c6b531feaf61810c18e027c0aa8ab11b2c9f9b3748a3fae4ee4
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,55 @@
|
|
1
1
|
# OpenStudio Extension Gem
|
2
2
|
|
3
|
+
## Version 0.2.5
|
4
|
+
|
5
|
+
* Support runner options for bundle_install_path and gemfile_path
|
6
|
+
* Laboratory and Data Center Support
|
7
|
+
|
8
|
+
- Fixed [#71]( https://github.com/NREL/openstudio-extension-gem/pull/71 ), another fix for bcl rake tasks
|
9
|
+
- Fixed [#72]( https://github.com/NREL/openstudio-extension-gem/pull/72 ), Add laboratory and data centers to os_lib_model_generation
|
10
|
+
- Fixed [#74]( https://github.com/NREL/openstudio-extension-gem/pull/74 ), adding bundle path and gemfile path options
|
11
|
+
|
12
|
+
## Version 0.2.4
|
13
|
+
|
14
|
+
* Fixed upload of measures to BCL using rake tasks.
|
15
|
+
* Support economizer modeling when create_typical measure is split into two parts
|
16
|
+
|
17
|
+
Closed Issues: 1
|
18
|
+
- Fixed [#64]( https://github.com/NREL/openstudio-extension-gem/issues/64 ), README updates
|
19
|
+
|
20
|
+
## Version 0.2.3
|
21
|
+
|
22
|
+
* Use new version of rubocop style from S3
|
23
|
+
* Remove frozen string literals in comments
|
24
|
+
|
25
|
+
## Version 0.2.2
|
26
|
+
|
27
|
+
* Exclude measure tests from being released with the gem (reduces the size of the installed gem significantly)
|
28
|
+
* Add BCL commands to upload measures
|
29
|
+
* Update GitHub changelog gem to use Octokit compared to github_api (which was last released 3 years ago)
|
30
|
+
* Promote GitHub changelog creation to a rake task to be inherited by all downstream extension gems
|
31
|
+
|
32
|
+
## Version 0.2.1
|
33
|
+
|
34
|
+
* Changes from 0.1.5 (runner.conf bug)
|
35
|
+
* Changes from 0.1.6 (update core library)
|
36
|
+
* Update measure tester to 0.2.2 (with Rubocop 0.54)
|
37
|
+
|
3
38
|
## Version 0.2.0
|
4
39
|
|
5
40
|
* Upgrade Bundler to 2.1.x
|
6
41
|
* Restrict to Ruby ~> 2.5.0
|
7
42
|
* Remove json_pure gem
|
8
43
|
* Update measure tester to 0.2.0 (removes need for github checkout)
|
44
|
+
* Note that this version does not include the changes from Version 0.1.5
|
45
|
+
|
46
|
+
## Version 0.1.6
|
47
|
+
|
48
|
+
* Update core library methods with what was in OpenStudio-measures
|
49
|
+
|
50
|
+
## Version 0.1.5
|
51
|
+
|
52
|
+
* Fix bug to respect the runner.conf file when using Extension::Runner with no options
|
9
53
|
|
10
54
|
## Version 0.1.4
|
11
55
|
|
@@ -25,4 +69,4 @@
|
|
25
69
|
|
26
70
|
## Version 0.1.1
|
27
71
|
|
28
|
-
* Initial release
|
72
|
+
* Initial release
|
data/Jenkinsfile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
//Jenkins pipelines are stored in shared libaries. Please see: https://github.com/
|
1
|
+
//Jenkins pipelines are stored in shared libaries. Please see: https://github.com/NREL/cbci_jenkins_libs
|
2
2
|
|
3
3
|
@Library('cbci_shared_libs') _
|
4
4
|
|
5
5
|
// Build for PR to develop branch only.
|
6
6
|
if ((env.CHANGE_ID) && (env.CHANGE_TARGET) ) { // check if set
|
7
7
|
|
8
|
-
|
8
|
+
openstudio_extension_gems()
|
9
9
|
|
10
10
|
}
|
data/README.md
CHANGED
@@ -31,27 +31,27 @@ Each OpenStudio extension gem should define its own module name to ensure that t
|
|
31
31
|
|
32
32
|
## Installation
|
33
33
|
|
34
|
-
To use this and other extension gems, you will need Ruby 2.
|
34
|
+
To use this and other extension gems, you will need Ruby 2.5.x and OpenStudio 3.0.0 or greater.
|
35
35
|
|
36
36
|
### Windows Installation
|
37
|
-
Install Ruby using the [RubyInstaller](https://rubyinstaller.org/downloads/archives/) for [Ruby 2.
|
37
|
+
Install Ruby using the [RubyInstaller](https://rubyinstaller.org/downloads/archives/) for [Ruby 2.5.5 (x64)](https://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.5.5-x64.exe).
|
38
38
|
|
39
39
|
Install Devkit using the [mingw64](https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe) installer.
|
40
40
|
|
41
|
-
Check the ruby installation returns the correct Ruby version (2.
|
41
|
+
Check the ruby installation returns the correct Ruby version (2.5.x):
|
42
42
|
```
|
43
43
|
ruby -v
|
44
44
|
```
|
45
45
|
|
46
46
|
Install bundler from the command line
|
47
47
|
```
|
48
|
-
gem install bundler -v 1
|
48
|
+
gem install bundler -v 2.1
|
49
49
|
```
|
50
50
|
|
51
|
-
Install OpenStudio. Create a file ```C:\ruby-2.
|
51
|
+
Install OpenStudio. Create a file ```C:\ruby-2.5.5-x64-mingw32\lib\ruby\site_ruby\openstudio.rb``` and point it to your OpenStudio installation by editing the contents. E.g.:
|
52
52
|
|
53
53
|
```ruby
|
54
|
-
require 'C:\openstudio-
|
54
|
+
require 'C:\openstudio-3.0.0\Ruby\openstudio.rb'
|
55
55
|
```
|
56
56
|
|
57
57
|
Verify your OpenStudio and Ruby configuration:
|
@@ -65,19 +65,20 @@ rbenv can be installed via [Homebrew](https://brew.sh/):
|
|
65
65
|
```
|
66
66
|
brew install rbenv
|
67
67
|
rbenv init
|
68
|
-
rbenv install 2.
|
68
|
+
rbenv install 2.5.5
|
69
69
|
```
|
70
70
|
|
71
71
|
Also install bundler
|
72
72
|
```
|
73
|
-
gem install bundler -v 1
|
73
|
+
gem install bundler -v 2.1
|
74
74
|
```
|
75
75
|
|
76
76
|
Install [OpenStudio](https://www.openstudio.net/downloads).
|
77
77
|
|
78
|
-
Add the RUBYLIB environment variable to your `bash_profile` (or similar) file. It should point to the Ruby folder within
|
78
|
+
Add the RUBYLIB environment variable to your `bash_profile` (or similar) file. It should point to the Ruby folder within
|
79
|
+
the OpenStudio Application you just downloaded (replace 3.0.0 with the version you are using):
|
79
80
|
```
|
80
|
-
export RUBYLIB=/Applications/OpenStudio-
|
81
|
+
export RUBYLIB=/Applications/OpenStudio-3.0.0/Ruby
|
81
82
|
```
|
82
83
|
|
83
84
|
|
@@ -145,14 +146,17 @@ Common Rake Tasks that are available to derivative extension gems include:
|
|
145
146
|
|
146
147
|
| Rake Task | Description |
|
147
148
|
| --------- | ----------- |
|
149
|
+
| openstudio:bcl:test_login | Test BCL login |
|
150
|
+
| openstudio:bcl:search_measures | Search BCL |
|
151
|
+
| openstudio:bcl:stage[reset] | Copy the measures/components to a staging location |
|
152
|
+
| openstudio:bcl:push | Upload measures from the staging location |
|
153
|
+
| openstudio:change_log[start_date,end_date,apikey] | Print the change log from GitHub. Specify dates in yyyy-mm-dd format |
|
148
154
|
| openstudio:list_measures | List all measures in the calling gem |
|
149
155
|
| openstudio:measures:add_license | Add License File to measures in the calling gem |
|
150
156
|
| openstudio:measures:add_readme | Add README.md.erb file if it and the README markdown file do not already exist for a measure |
|
151
157
|
| openstudio:measures:copy_resources | Copy the resources files to individual measures in the calling gem |
|
152
158
|
| openstudio:measures:update_copyright | Update copyright on measure files in the calling gem |
|
153
|
-
| openstudio`:runner:`init
|
154
|
-
| openstudio:stage_bcl | Copy the measures to a location that can be uploaded to BCL |
|
155
|
-
| openstudio:push_bcl | Upload measures from the specified location to the BCL |
|
159
|
+
| openstudio`:runner:`init | Create a runner.conf file running simulations |
|
156
160
|
| openstudio:test_with_docker | Use openstudio docker image to run tests |
|
157
161
|
| openstudio:test_with_openstudio | Use openstudio system ruby to run tests |
|
158
162
|
| openstudio:update_measures | Run the CLI task to check for measure updates and update the measure xml files |
|
@@ -175,8 +179,12 @@ The following table contains all current extension gems.
|
|
175
179
|
| OpenStudio Common Measures Gem | openstudio-common-measures | https://github.com/NREL/openstudio-common-measures-gem |
|
176
180
|
| OpenStudio Model Articulation Gem | openstudio-model-articulation | https://github.com/NREL/openstudio-model-articulation-gem |
|
177
181
|
| OpenStudio AEDG Gem | openstudio-aedg | https://github.com/NREL/openstudio-aedg-gem |
|
182
|
+
| OpenStudio Calibration Gem | openstudio-calibration | https://github.com/NREL/openstudio-calibration-gem |
|
183
|
+
| OpenStudio EE Gem | openstudio-ee | https://github.com/NREL/openstudio-ee-gem |
|
178
184
|
| OpenStudio District Systems Gem | openstudio-district-systems | https://github.com/NREL/openstudio-district-systems-gem |
|
179
|
-
|
|
185
|
+
| URBANopt Core Gem | urbanopt-core | https://github.com/urbanopt/urbanopt-core-gem |
|
186
|
+
| URBANopt GeoJSON Gem | urbanopt-geojson | https://github.com/urbanopt/urbanopt-geojson-gem |
|
187
|
+
| URBANopt Scenario Gem | urbanopt-scenario | https://github.com/urbanopt/urbanopt-scenario-gem |
|
180
188
|
| BuildingSync Gem | buildingsync | https://github.com/BuildingSync/BuildingSync-gem |
|
181
189
|
|
182
190
|
### Initializing a new Extension Gem
|
@@ -235,22 +243,8 @@ Or install it yourself as:
|
|
235
243
|
|
236
244
|
# TODO
|
237
245
|
|
238
|
-
- [X] Finalize documentation on naming conventions, etc
|
239
|
-
- [X] Add test measure
|
240
|
-
- [X] Rake task ```openstudio:update_measures```
|
241
|
-
- [X] Rake task ```openstudio:test_with_openstudio```
|
242
|
-
- [ ] Rake task ```stage_bcl``` _DLM: BCL gem should be a development dependency only until we can reduce its dependencies and remove native dependencies? should probably put it into a special group so we can bundle without it in openstudio-gems._
|
243
|
-
- [ ] Rake task ```push_bcl``` _DLM: how do we want to test this?
|
244
|
-
- [X] Get all rake tasks working on Travis
|
245
246
|
- [ ] Capture useful output from Travis (measure dashboard results, log files, zip of build products, etc) and put it somewhere (s3? naming convention?)
|
246
|
-
- [X] ```Extension::openstudio_extension_version``` _DLM: should we rename? should people overwrite this in their class?_
|
247
|
-
- [X] ```Extension::measures_dir``` _DLM: I think this can have a default implementation, right? If something does not need to be overridden should it be a module method rather than a class one? KAF: this is in rake task for now
|
248
|
-
- [X] ```Extension::list_measures``` _DLM: I think this can have a default implementation, right?_KAF: In Rake task for now
|
249
247
|
- [ ] ```Extension::files_dir``` _DLM: I think this can have a default implementation, right?_
|
250
248
|
- [ ] ```Extension::minimum_openstudio_version``` _DLM: should we rename? should people overwrite this in their class?_
|
251
|
-
- [X] ```Runner::initialize``` _DLM: should say that the path argument should be for a dir with a Gemfile right?_
|
252
|
-
- [X] ```Runner::configure_osw``` _DLM: should take in an OSW, add paths to all measure and file dirs for loaded OpenStudio Extensions, write out configured OSW_
|
253
|
-
- [ ] Run rubocop on all of the core files and remove exclusion from .rubocop.yml file.
|
254
249
|
- [ ] Cleanup task after running tests (may need to be in the OpenStudio Measure Tester)
|
255
|
-
- [X] Add a `rake init new_ext_gem` to Rakefile
|
256
250
|
- [ ] Add tests to the extension/core
|
data/Rakefile
CHANGED
@@ -34,7 +34,7 @@ RSpec::Core::RakeTask.new(:spec)
|
|
34
34
|
require 'openstudio/extension/rake_task'
|
35
35
|
require 'openstudio/extension'
|
36
36
|
rake_task = OpenStudio::Extension::RakeTask.new
|
37
|
-
rake_task.set_extension_class(OpenStudio::Extension::Extension)
|
37
|
+
rake_task.set_extension_class(OpenStudio::Extension::Extension, 'nrel/openstudio-extension-gem')
|
38
38
|
|
39
39
|
require 'rubocop/rake_task'
|
40
40
|
RuboCop::RakeTask.new
|
data/lib/change_log.rb
CHANGED
@@ -1,147 +1,157 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
# *******************************************************************************
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
3
|
+
# All rights reserved.
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
6
|
+
#
|
7
|
+
# (1) Redistributions of source code must retain the above copyright notice,
|
8
|
+
# this list of conditions and the following disclaimer.
|
9
|
+
#
|
10
|
+
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
12
|
+
# and/or other materials provided with the distribution.
|
13
|
+
#
|
14
|
+
# (3) Neither the name of the copyright holder nor the names of any contributors
|
15
|
+
# may be used to endorse or promote products derived from this software without
|
16
|
+
# specific prior written permission from the respective party.
|
17
|
+
#
|
18
|
+
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
19
|
+
# of modifications or other derivative works may not use the "OpenStudio"
|
20
|
+
# trademark, "OS", "os", or any other confusingly similar designation without
|
21
|
+
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
22
|
+
#
|
23
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
|
24
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
25
|
+
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
26
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
|
27
|
+
# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
|
28
|
+
# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
29
|
+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
30
|
+
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
31
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
32
|
+
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
33
|
+
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
34
|
+
# *******************************************************************************
|
35
|
+
|
36
|
+
require 'octokit'
|
4
37
|
require 'date'
|
5
38
|
require 'optparse'
|
6
39
|
require 'optparse/date'
|
7
40
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
41
|
+
class ChangeLog
|
42
|
+
def initialize(user_and_repo, start_date = Date.today - 90, end_date = Date.today, apikey = nil)
|
43
|
+
@user_and_repo = user_and_repo
|
44
|
+
@apikey = apikey
|
45
|
+
@start_date = start_date
|
46
|
+
@end_date = end_date
|
47
|
+
|
48
|
+
# Convert dates to time objects
|
49
|
+
@start_date = Time.parse(@start_date.to_s) if start_date.is_a? String
|
50
|
+
@end_date = Time.parse(@end_date.to_s) if end_date.is_a? String
|
51
|
+
# GitHub API uses Time and not the Date class, so ensure that we have Time
|
52
|
+
@start_date = Time.parse(@start_date.to_s)
|
53
|
+
@end_date = Time.parse(@end_date.to_s)
|
54
|
+
|
55
|
+
@total_open_issues = []
|
56
|
+
@total_open_pull_requests = []
|
57
|
+
@new_issues = []
|
58
|
+
@closed_issues = []
|
59
|
+
@accepted_pull_requests = []
|
60
|
+
|
61
|
+
begin
|
62
|
+
@github = Octokit::Client.new
|
63
|
+
if apikey
|
64
|
+
@github = Octokit::Client.new(access_token: apikey)
|
65
|
+
end
|
66
|
+
@github.auto_paginate = true
|
67
|
+
rescue StandardError => e
|
68
|
+
puts e.message
|
69
|
+
# write out the help message
|
70
|
+
ChangeLog.help
|
71
|
+
exit(1)
|
72
|
+
end
|
33
73
|
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
74
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
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)}"
|
75
|
+
# Class method to show how to use the API through Rake.
|
76
|
+
def self.help
|
77
|
+
puts 'Usage: bundle exec rake openstudio:change_log[<start_date>,<end_date>,<apikey>]'
|
78
|
+
puts ' <start_date> = [Optional] Start of data (e.g., 2020-09-06), defaults to 90 days before today'
|
79
|
+
puts ' <end_date> = [Optional] End of data (e.g., 2020-10-06), default to today'
|
80
|
+
puts ' <apikey> = [Optional] GitHub API Key (used for private repos)'
|
81
|
+
puts
|
82
|
+
puts ' Ensure that the GitHub user/repo is set in your Rakefile, for example, '
|
83
|
+
puts " rake_task.set_extension_class(OpenStudio::Extension::Extension, 'nrel/openstudio-extension-gem')"
|
84
|
+
puts
|
85
|
+
puts ' Example usages:'
|
86
|
+
puts ' bundle exec rake openstudio:change_log[2020-01-01]'
|
87
|
+
puts ' bundle exec rake openstudio:change_log[2020-01-01,2020-06-30]'
|
88
|
+
puts ' bundle exec rake openstudio:change_log[2020-01-01,2020-01-10,<private_api_key>]'
|
89
|
+
puts
|
90
|
+
puts ' Notes:'
|
91
|
+
puts ' For creating token, see https://github.com/settings/tokens.'
|
92
|
+
puts ' Note that if passing apikey, then you must pass start_date and end_date as well. There must be no spaces'
|
93
|
+
puts ' between the arguments (see examples above).'
|
81
94
|
end
|
82
|
-
end
|
83
95
|
|
84
|
-
# Process Open Issues
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
96
|
+
# Process Open Issues
|
97
|
+
def process
|
98
|
+
@github.list_issues(@user_and_repo, state: 'all').each do |issue|
|
99
|
+
if issue.state == 'open'
|
100
|
+
if issue.pull_request
|
101
|
+
if issue.created_at >= @start_date && issue.created_at <= @end_date
|
102
|
+
@total_open_pull_requests << issue
|
103
|
+
end
|
104
|
+
else
|
105
|
+
@total_open_issues << issue
|
106
|
+
if issue.created_at >= @start_date && issue.created_at <= @end_date
|
107
|
+
@new_issues << issue
|
108
|
+
end
|
109
|
+
end
|
110
|
+
else
|
111
|
+
# the issue is closed
|
112
|
+
if issue.closed_at >= @start_date && issue.closed_at <= @end_date
|
113
|
+
if issue.pull_request
|
114
|
+
@accepted_pull_requests << issue
|
115
|
+
else
|
116
|
+
@closed_issues << issue
|
117
|
+
end
|
118
|
+
end
|
97
119
|
end
|
98
|
-
else
|
99
|
-
total_open_pull_requests << issue
|
100
120
|
end
|
121
|
+
|
122
|
+
@closed_issues.sort! { |x, y| x.number <=> y.number }
|
123
|
+
@new_issues.sort! { |x, y| x.number <=> y.number }
|
124
|
+
@accepted_pull_requests.sort! { |x, y| x.number <=> y.number }
|
125
|
+
@total_open_pull_requests.sort! { |x, y| x.number <=> y.number }
|
126
|
+
rescue StandardError => e
|
127
|
+
puts e.message
|
128
|
+
ChangeLog.help
|
129
|
+
exit(1)
|
101
130
|
end
|
102
131
|
|
103
|
-
|
104
|
-
|
132
|
+
def print_issue(issue)
|
133
|
+
is_feature = false
|
134
|
+
issue.labels.each { |label| is_feature = true if label.name == 'Feature Request' }
|
105
135
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
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
|
136
|
+
if is_feature
|
137
|
+
"- Improved [##{issue.number}]( #{issue.html_url} ), #{issue.title}"
|
138
|
+
else
|
139
|
+
"- Fixed [\##{issue.number}]( #{issue.html_url} ), #{issue.title}"
|
125
140
|
end
|
126
141
|
end
|
127
142
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
new_issues.
|
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(', ') + ')'
|
143
|
+
def print_issues
|
144
|
+
puts "Total Open Issues: #{@total_open_issues.length}"
|
145
|
+
puts "Total Open Pull Requests: #{@total_open_pull_requests.length}"
|
146
|
+
puts "\nDate Range: #{@start_date.strftime('%m/%d/%y')} - #{@end_date.strftime('%m/%d/%y')}:"
|
147
|
+
puts "\nNew Issues: #{@new_issues.length} (" + @new_issues.map(&:number).join(', ') + ')'
|
140
148
|
|
141
|
-
puts "\nClosed Issues: #{closed_issues.length}"
|
142
|
-
closed_issues.each { |issue| puts print_issue(issue) }
|
149
|
+
puts "\nClosed Issues: #{@closed_issues.length}"
|
150
|
+
@closed_issues.each { |issue| puts print_issue(issue) }
|
143
151
|
|
144
|
-
puts "\nAccepted Pull Requests: #{accepted_pull_requests.length}"
|
145
|
-
accepted_pull_requests.each { |issue| puts print_issue(issue) }
|
152
|
+
puts "\nAccepted Pull Requests: #{@accepted_pull_requests.length}"
|
153
|
+
@accepted_pull_requests.each { |issue| puts print_issue(issue) }
|
146
154
|
|
147
|
-
puts "\nAll Open Issues: #{total_open_issues.length} (" + total_open_issues.map { |issue|
|
155
|
+
puts "\nAll Open Issues: #{@total_open_issues.length} (" + @total_open_issues.map { |issue| "\##{issue.number}" }.join(', ') + ')'
|
156
|
+
end
|
157
|
+
end
|