openstudio-extension 0.1.6 → 0.2.4

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
- SHA1:
3
- metadata.gz: 3faa07577e5a2980e7cacc747e5fb9f3ceb5cdb7
4
- data.tar.gz: b4e220c8aca2e0227e65866ded3d1af1b7b19958
2
+ SHA256:
3
+ metadata.gz: 6c5468ce39e3e858462a84b10da6eaf36ef110c8d6722256619eee95c4f0032c
4
+ data.tar.gz: d536d3216133d81b115ef61eab4ebc04c31d5842a23463674f038d1c65f92501
5
5
  SHA512:
6
- metadata.gz: 23ec9c229a5618bc27932844884998bb41fac6f57c5753d2d79f2c2702652e37e7836d42e75e9f3c78a2e0321729284fec4a012e80995dee89359f3b7a7fa440
7
- data.tar.gz: da121f8ec77b913ec6d61c528ffb78841ec645dcd0fb7b126df4668f87f3df74e56f7ef8bf9068d6b81b4e02ae4aa17922a9d33abba4fc94a52dc509cae28ff3
6
+ metadata.gz: f9305edc0f0a8fa54ba0ec4e0a4243f219a8d701018ec4dea4a2fb9662d1fe61f88923dce2abbe5c42e0f2f58a7dfc0eb3de3c632e7de3f3f160e728f032ea1e
7
+ data.tar.gz: 77b9a0cdba958bda77d308847c92478ba4ee2a8d20884af8498cc1982782b16a8f5fa38f5c9e59ed9a2badaa55527dbacd77e549d123533315500776c52e8c50
data/.gitignore CHANGED
@@ -13,6 +13,8 @@
13
13
  /test/
14
14
  /lib/measures/test_results
15
15
  /lib/measures/.rubocop*
16
+ /lib/measures/staged
17
+ /lib/measures/staged/*
16
18
 
17
19
  # rspec failure tracking
18
20
  .rspec_status
@@ -6,5 +6,5 @@ AllCops:
6
6
  - lib/openstudio/extension/core/**/*
7
7
 
8
8
  inherit_from:
9
- - http://s3.amazonaws.com/openstudio-resources/styles/rubocop.yml
9
+ - http://s3.amazonaws.com/openstudio-resources/styles/rubocop_v3.yml
10
10
 
@@ -1,5 +1,39 @@
1
1
  # OpenStudio Extension Gem
2
2
 
3
+ ## Version 0.2.4
4
+
5
+ * Fixed upload of measures to BCL using rake tasks.
6
+ * Support economizer modeling when create_typical measure is split into two parts
7
+
8
+ Closed Issues: 1
9
+ - Fixed [#64]( https://github.com/NREL/openstudio-extension-gem/issues/64 ), README updates
10
+
11
+ ## Version 0.2.3
12
+
13
+ * Use new version of rubocop style from S3
14
+ * Remove frozen string literals in comments
15
+
16
+ ## Version 0.2.2
17
+
18
+ * Exclude measure tests from being released with the gem (reduces the size of the installed gem significantly)
19
+ * Add BCL commands to upload measures
20
+ * Update GitHub changelog gem to use Octokit compared to github_api (which was last released 3 years ago)
21
+ * Promote GitHub changelog creation to a rake task to be inherited by all downstream extension gems
22
+
23
+ ## Version 0.2.1
24
+
25
+ * Changes from 0.1.5 (runner.conf bug)
26
+ * Changes from 0.1.6 (update core library)
27
+ * Update measure tester to 0.2.2 (with Rubocop 0.54)
28
+
29
+ ## Version 0.2.0
30
+
31
+ * Upgrade Bundler to 2.1.x
32
+ * Restrict to Ruby ~> 2.5.0
33
+ * Remove json_pure gem
34
+ * Update measure tester to 0.2.0 (removes need for github checkout)
35
+ * Note that this version does not include the changes from Version 0.1.5
36
+
3
37
  ## Version 0.1.6
4
38
 
5
39
  * Update core library methods with what was in OpenStudio-measures
@@ -26,4 +60,4 @@
26
60
 
27
61
  ## Version 0.1.1
28
62
 
29
- * Initial release
63
+ * Initial release
data/Gemfile CHANGED
@@ -2,5 +2,3 @@ source 'http://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in openstudio-extension.gemspec
4
4
  gemspec
5
-
6
- gem 'simplecov', github: 'NREL/simplecov'
@@ -1,4 +1,4 @@
1
- //Jenkins pipelines are stored in shared libaries. Please see: https://github.com/tijcolem/nrel_cbci_jenkins_libs
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
 
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.2.4 and OpenStudio 2.7.1 or greater.
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.2.4 (x64)](https://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.2.4-x64.exe).
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.2.4):
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.17
48
+ gem install bundler -v 2.1
49
49
  ```
50
50
 
51
- Install OpenStudio. Create a file ```C:\ruby-2.2.4-x64-mingw32\lib\ruby\site_ruby\openstudio.rb``` and point it to your OpenStudio installation by editing the contents. E.g.:
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-2.7.1\Ruby\openstudio.rb'
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.2.4
68
+ rbenv install 2.5.5
69
69
  ```
70
70
 
71
71
  Also install bundler
72
72
  ```
73
- gem install bundler -v 1.17
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 the OpenStudio Application you just downloaded (replace 2.7.2 with the version you are using):
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-2.7.2/Ruby
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
159
  | openstudio`:runner:`init | Create a runner.conf file running simulations |
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 |
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
- | UrbanOpt GeoJSON Gem | urbanopt-geojson | https://github.com/urbanopt/urbanopt-geojson-gem |
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,11 +243,8 @@ Or install it yourself as:
235
243
 
236
244
  # TODO
237
245
 
238
- - [ ] 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._
239
- - [ ] Rake task ```push_bcl``` _DLM: how do we want to test this?
240
246
  - [ ] Capture useful output from Travis (measure dashboard results, log files, zip of build products, etc) and put it somewhere (s3? naming convention?)
241
247
  - [ ] ```Extension::files_dir``` _DLM: I think this can have a default implementation, right?_
242
248
  - [ ] ```Extension::minimum_openstudio_version``` _DLM: should we rename? should people overwrite this in their class?_
243
- - [ ] Run rubocop on all of the core files and remove exclusion from .rubocop.yml file.
244
249
  - [ ] Cleanup task after running tests (may need to be in the OpenStudio Measure Tester)
245
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
@@ -0,0 +1,157 @@
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'
37
+ require 'date'
38
+ require 'optparse'
39
+ require 'optparse/date'
40
+
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
73
+ end
74
+
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).'
94
+ end
95
+
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
119
+ end
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)
130
+ end
131
+
132
+ def print_issue(issue)
133
+ is_feature = false
134
+ issue.labels.each { |label| is_feature = true if label.name == 'Feature Request' }
135
+
136
+ if is_feature
137
+ "- Improved [##{issue.number}]( #{issue.html_url} ), #{issue.title}"
138
+ else
139
+ "- Fixed [\##{issue.number}]( #{issue.html_url} ), #{issue.title}"
140
+ end
141
+ end
142
+
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(', ') + ')'
148
+
149
+ puts "\nClosed Issues: #{@closed_issues.length}"
150
+ @closed_issues.each { |issue| puts print_issue(issue) }
151
+
152
+ puts "\nAccepted Pull Requests: #{@accepted_pull_requests.length}"
153
+ @accepted_pull_requests.each { |issue| puts print_issue(issue) }
154
+
155
+ puts "\nAll Open Issues: #{@total_open_issues.length} (" + @total_open_issues.map { |issue| "\##{issue.number}" }.join(', ') + ')'
156
+ end
157
+ end
@@ -1,17 +1,18 @@
1
+ <?xml version="1.0"?>
1
2
  <measure>
2
3
  <schema_version>3.0</schema_version>
3
4
  <name>openstudio_extension_test_measure</name>
4
5
  <uid>36b99a29-41e1-4d85-9272-85d43b966e5a</uid>
5
- <version_id>e9fedf04-7619-4c93-a865-0e54adfe3507</version_id>
6
- <version_modified>20190430T155209Z</version_modified>
6
+ <version_id>edf7f103-9f51-4944-a5af-1d8fa2b0c9b7</version_id>
7
+ <version_modified>20200427T230714Z</version_modified>
7
8
  <xml_checksum>49BEF039</xml_checksum>
8
9
  <class_name>OpenStudioExtensionTestMeasure</class_name>
9
10
  <display_name>OpenStudio Extension Test Measure</display_name>
10
- <description>Rotate your building relative to its current orientation. This will not rotate site shading objects.</description>
11
- <modeler_description>Get the North Axis field for the OS:Building object and adjusted it based on the user specified value. If the starting value is 20 degrees and the user value is 5 degrees, then the resulting value is 25 degrees.</modeler_description>
12
- <arguments/>
13
- <outputs/>
14
- <provenances/>
11
+ <description>A measure that tests OpenStudio Extension gem functionality</description>
12
+ <modeler_description>This is a test measure that tests OpenStudio Extension gem functionality.</modeler_description>
13
+ <arguments />
14
+ <outputs />
15
+ <provenances />
15
16
  <tags>
16
17
  <tag>Envelope.Form</tag>
17
18
  </tags>
@@ -38,12 +39,6 @@
38
39
  </attribute>
39
40
  </attributes>
40
41
  <files>
41
- <file>
42
- <filename>LICENSE.md</filename>
43
- <filetype>md</filetype>
44
- <usage_type>license</usage_type>
45
- <checksum>9640B6CB</checksum>
46
- </file>
47
42
  <file>
48
43
  <filename>README.md.erb</filename>
49
44
  <filetype>erb</filetype>
@@ -51,16 +46,16 @@
51
46
  <checksum>703C9964</checksum>
52
47
  </file>
53
48
  <file>
54
- <filename>README.md</filename>
49
+ <filename>LICENSE.md</filename>
55
50
  <filetype>md</filetype>
56
- <usage_type>readme</usage_type>
57
- <checksum>7258830F</checksum>
51
+ <usage_type>license</usage_type>
52
+ <checksum>E0468DD6</checksum>
58
53
  </file>
59
54
  <file>
60
55
  <filename>OpenStudioExtensionTestMeasure_Test.rb</filename>
61
56
  <filetype>rb</filetype>
62
57
  <usage_type>test</usage_type>
63
- <checksum>8452EA9A</checksum>
58
+ <checksum>66A00EA8</checksum>
64
59
  </file>
65
60
  <file>
66
61
  <version>
@@ -71,13 +66,19 @@
71
66
  <filename>measure.rb</filename>
72
67
  <filetype>rb</filetype>
73
68
  <usage_type>script</usage_type>
74
- <checksum>E5793A49</checksum>
69
+ <checksum>51BB85EF</checksum>
75
70
  </file>
76
71
  <file>
77
72
  <filename>os_lib_helper_methods.rb</filename>
78
73
  <filetype>rb</filetype>
79
74
  <usage_type>resource</usage_type>
80
- <checksum>22515A49</checksum>
75
+ <checksum>07B01D67</checksum>
76
+ </file>
77
+ <file>
78
+ <filename>README.md</filename>
79
+ <filetype>md</filetype>
80
+ <usage_type>readme</usage_type>
81
+ <checksum>7258830F</checksum>
81
82
  </file>
82
83
  </files>
83
84
  </measure>
@@ -101,11 +101,9 @@ module OpenStudio
101
101
  def self.all_measure_dirs
102
102
  result = []
103
103
  all_extensions.each do |obj|
104
- begin
105
- dir = obj.new.measures_dir
106
- result << dir if dir
107
- rescue StandardError
108
- end
104
+ dir = obj.new.measures_dir
105
+ result << dir if dir
106
+ rescue StandardError
109
107
  end
110
108
  return result.uniq
111
109
  end
@@ -117,11 +115,9 @@ module OpenStudio
117
115
  def self.all_file_dirs
118
116
  result = []
119
117
  all_extensions.each do |obj|
120
- begin
121
- dir = obj.new.files_dir
122
- result << dir if dir
123
- rescue StandardError
124
- end
118
+ dir = obj.new.files_dir
119
+ result << dir if dir
120
+ rescue StandardError
125
121
  end
126
122
  return result.uniq
127
123
  end
@@ -230,5 +226,26 @@ module OpenStudio
230
226
 
231
227
  return osw
232
228
  end
229
+
230
+ ##
231
+ # Module method used to check whether a measure is present in an OSW file
232
+ ##
233
+ # @param [Hash] in_osw Initial OSW object as a Hash, keys should be symbolized
234
+ # @param [String] measure_dir_name Directory name of measure to set argument on
235
+ # @param [String] step_name Optional argument, if present used to further identify the measure
236
+ #
237
+ # @return [Boolean] true or false
238
+ def self.measure_in_osw(osw, measure_dir_name, step_name = nil)
239
+ result = false
240
+ osw[:steps].each do |step|
241
+ if step[:measure_dir_name] == measure_dir_name
242
+ if step_name.nil? || step[:name] == step_name
243
+ result = true
244
+ end
245
+ end
246
+ end
247
+
248
+ return result
249
+ end
233
250
  end
234
251
  end