oslg 0.2.5 → 0.2.7

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
  SHA256:
3
- metadata.gz: 398d4fc89206f836beea1d95578ef91629243c4f037ab9ac304359c16843e6ab
4
- data.tar.gz: dcfb0a23e252ac13a396fda86117d7ae04aa087e9e4ec740c5efb93f2637b701
3
+ metadata.gz: 6309b9c37cd0135fc85fd44a2903d7594ccf1b0d952f64cec3df1b7c9d5f32e9
4
+ data.tar.gz: 1d4b53beb732dd9d0680f59e79e1d078f5d4d0b2289bfe3ac8f224bae3bb0ff4
5
5
  SHA512:
6
- metadata.gz: 5d8b0d2c29ab175e2179d6caaf10b155720a64f2063a1249e8523808020f0f46d0de743c566634e9bcf6e2f6bd0d001eb7470cfc322e67165a0b6841251032f8
7
- data.tar.gz: 95a1e72eb075129b5e7e01f94b5a6c2341c47314733c38ae0d51b7b8b501d2b453259c03c5698a8c77aa3566d6f9a648350b4d09ed4f9ffbf3e74d07069574fd
6
+ metadata.gz: 1edc4f411a77d1aaa0e2c6d48a9847ef3239af027d4699894519a8f1286b639c4a11dbd6bc96c2ef1cec43047d0601b5d01d38f178efde2e638786e890103b5a
7
+ data.tar.gz: 29899ed065067829900502b40ecd053c354a9255954bc18a1b735c30aaf1d6edab6a5c369a37af01b63e5330ef0b27cd8c4855dbecadfc352d1e5733b18f7ff0
@@ -3,11 +3,11 @@ name: Pull Request CI
3
3
  on:
4
4
  pull_request:
5
5
  branches:
6
- - main
6
+ - dev
7
7
 
8
8
  jobs:
9
9
  test_300x:
10
- runs-on: ubuntu-18.04
10
+ runs-on: ubuntu-22.04
11
11
  steps:
12
12
  - name: Check out repository
13
13
  uses: actions/checkout@v2
@@ -23,7 +23,7 @@ jobs:
23
23
  docker exec -t test bundle exec rake
24
24
  docker kill test
25
25
  test_321x:
26
- runs-on: ubuntu-18.04
26
+ runs-on: ubuntu-22.04
27
27
  steps:
28
28
  - name: Check out repository
29
29
  uses: actions/checkout@v2
@@ -39,7 +39,7 @@ jobs:
39
39
  docker exec -t test bundle exec rake
40
40
  docker kill test
41
41
  test_330x:
42
- runs-on: ubuntu-20.04
42
+ runs-on: ubuntu-22.04
43
43
  steps:
44
44
  - name: Check out repository
45
45
  uses: actions/checkout@v2
@@ -55,7 +55,7 @@ jobs:
55
55
  docker exec -t test bundle exec rake
56
56
  docker kill test
57
57
  test_340x:
58
- runs-on: ubuntu-20.04
58
+ runs-on: ubuntu-22.04
59
59
  steps:
60
60
  - name: Check out repository
61
61
  uses: actions/checkout@v2
@@ -70,3 +70,35 @@ jobs:
70
70
  docker exec -t test bundle update
71
71
  docker exec -t test bundle exec rake
72
72
  docker kill test
73
+ test_351x:
74
+ runs-on: ubuntu-22.04
75
+ steps:
76
+ - name: Check out repository
77
+ uses: actions/checkout@v2
78
+ - name: Run Tests
79
+ run: |
80
+ echo $(pwd)
81
+ echo $(ls)
82
+ docker pull nrel/openstudio:3.5.1
83
+ docker run --name test --rm -d -t -v $(pwd):/work -w /work nrel/openstudio:3.5.1
84
+ docker exec -t test pwd
85
+ docker exec -t test ls
86
+ docker exec -t test bundle update
87
+ docker exec -t test bundle exec rake
88
+ docker kill test
89
+ test_361x:
90
+ runs-on: ubuntu-22.04
91
+ steps:
92
+ - name: Check out repository
93
+ uses: actions/checkout@v2
94
+ - name: Run Tests
95
+ run: |
96
+ echo $(pwd)
97
+ echo $(ls)
98
+ docker pull nrel/openstudio:3.6.1
99
+ docker run --name test --rm -d -t -v $(pwd):/work -w /work nrel/openstudio:3.6.1
100
+ docker exec -t test pwd
101
+ docker exec -t test ls
102
+ docker exec -t test bundle update
103
+ docker exec -t test bundle exec rake
104
+ docker kill test
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  BSD 3-Clause License
2
2
 
3
- Copyright (c) 2022, Denis Bourgeois
3
+ Copyright (c) 2022-2023, Denis Bourgeois
4
4
  All rights reserved.
5
5
 
6
6
  Redistribution and use in source and binary forms, with or without
data/README.md CHANGED
@@ -18,7 +18,7 @@ In most cases, critical (and many non-critical) OpenStudio anomalies will be cau
18
18
 
19
19
  ### Recommended use
20
20
 
21
- As a Ruby module, one can access __oslg__ by _extending_ a measure module or class:
21
+ As a Ruby module, one can access __oslg__ by _extending_ a Measure module or class:
22
22
 
23
23
  ```
24
24
  module M
@@ -39,7 +39,7 @@ FATAL
39
39
 
40
40
  DEBUG messages aren't benign at all, but are certainly less informative for the typical Measure user.
41
41
 
42
- Initially, __oslg__ sets 2x internal attributes: `level` (INFO) and `status` (< DEBUG). The `level` attribute is a user-set threshold below which less severe logs (e.g. DEBUG) are ignored. For instance, if `level` were _reset_ to DEBUG (e.g. `M.reset(M::DEBUG)`), then all DEBUG messages would also be logged. The `status` attribute is reset with each new log entry if the latter's log level is more severe than its predecessor (e.g. `status == M::FATAL` if there is a single log entry registered as FATAL). To check the curent __oslg__ `status` (true or false):
42
+ Initially, __oslg__ sets 2x internal attributes: `level` (INFO) and `status` (< DEBUG). The `level` attribute is a user-set threshold below which less severe logs (e.g. DEBUG) are ignored. For instance, if `level` were _reset_ to DEBUG (e.g. `M.reset(M::DEBUG)`), then all DEBUG messages would also be logged. The `status` attribute is reset with each new log entry when the latter's log level is more severe than its predecessors (e.g. `status == M::FATAL` if there is a single log entry registered as FATAL). To check the curent __oslg__ `status` (true or false):
43
43
 
44
44
  ```
45
45
  M.debug?
@@ -54,25 +54,25 @@ It's sometimes not a bad idea to rely on a _clean_ slate (e.g. within RSpecs). T
54
54
  M.clean!
55
55
  ```
56
56
 
57
- EnergyPlus will run, with e.g. out-of-range material or fluid properties, while logging ERROR messages in the process. It remains up to users to decide what to do with simulation results. We recommend something similar with __oslg__. For instance, we suggest logging as __FATAL__ any error that should halt measure processes and prevent OpenStudio from launching an EnergyPlus simulation. This could be missing or poorly-defined OpenStudio files.
57
+ EnergyPlus will run with e.g. out-of-range material or fluid properties, while logging ERROR messages in the process. It remains up to users to decide what to do with simulation results. We recommend something similar with __oslg__. For instance, we suggest logging as __FATAL__ any error that should halt Measure processes and prevent OpenStudio from launching an EnergyPlus simulation. This could be missing or poorly-defined OpenStudio files.
58
58
 
59
59
  ```
60
60
  M.log(M::FATAL, "Missing input JSON file")
61
61
  ```
62
62
 
63
- Consider logging non-fatal __ERROR__ messages when encountering invalid OpenStudio file entries, i.e. well-defined, yet invalid vis-à-vis EnergyPlus limitations. The invalid object could be simply ignored, while the measure pursues its (otherwise valid) calculations ... with OpenStudio ultimately launching an EnergyPlus simulation. If a simulation indeed ran (ultimately a go/no-go decision made by the EnergyPlus simulation engine), it would be up to users to decide if simulation results were valid or useful, given the context - maybe based on __oslg__ logged messages. In short, non-fatal ERROR logs should ideally point to bad input (that users can fix).
63
+ Consider logging non-fatal __ERROR__ messages when encountering invalid OpenStudio file entries, i.e. well-defined, yet invalid vis-à-vis EnergyPlus limitations. The invalid object could be simply ignored, while the Measure pursues its (otherwise valid) calculations ... with OpenStudio ultimately launching an EnergyPlus simulation. If a simulation indeed ran (ultimately a go/no-go decision made by the EnergyPlus simulation engine), it would be up to users to decide if simulation results were valid or useful, given the context - maybe based on __oslg__ logged messages. In short, non-fatal ERROR logs should ideally point to bad input (that users can fix).
64
64
 
65
65
  ```
66
66
  M.log(M::ERROR, "Measure won't process MASSLESS materials")
67
67
  ```
68
68
 
69
- A __WARNING__ could be triggered from inherit limitations of the underlying measure scope or methodology (something users may have little knowledge of beforehand). For instance, surfaces the size of dinner plates are often artifacts of poor 3D model design. It's usually not a good idea to have such small surfaces in an OpenStudio model, but neither OpenStudio nor EnergyPlus will necessarily warn users of such occurrences. It's up to users to decide on the suitable course of action.
69
+ A __WARNING__ could be triggered from inherit limitations of the underlying Measure scope or methodology (something users may have little knowledge of beforehand). For instance, surfaces the size of dinner plates are often artifacts of poor 3D model design. It's usually not a good idea to have such small surfaces in an OpenStudio model, but neither OpenStudio nor EnergyPlus will necessarily warn users of such occurrences. It's up to users to decide on the suitable course of action.
70
70
 
71
71
  ```
72
72
  M.log(M::WARN, "Surface area < 100cm2")
73
73
  ```
74
74
 
75
- There's also the possibility of logging __INFO__-rmative messages for users, e.g. the final state of a measure variable before exiting.
75
+ There's also the possibility of logging __INFO__-rmative messages for users, e.g. the final state of a Measure variable before exiting.
76
76
 
77
77
  ```
78
78
  M.log(M::INFO, "Envelope compliant to prescriptive code requirements")
@@ -131,7 +131,7 @@ def sum(areas, units)
131
131
  end
132
132
  ```
133
133
 
134
- ... would generate the following if both `areas` and `units` arguments were nilled:
134
+ ... would generate the following if both `areas` and `units` arguments were for instance _nilled_:
135
135
  ```
136
136
  "Invalid 'areas' arg #1 (sum)"
137
137
  "Invalid 'units' arg #2 (sum)"
@@ -147,7 +147,7 @@ __mismatch__: for logging incompatible instances vs classes:
147
147
  return M.mismatch("areas", areas, Array, "sum") unless areas.is_a?(Array)
148
148
  ```
149
149
 
150
- If 'areas' were a _String_, __mismatch__ would generate the following DEBUG log message (before returning _nil_):
150
+ If 'areas' were for example a _String_, __mismatch__ would generate the following DEBUG log message (before returning _nil_):
151
151
 
152
152
  ```
153
153
  "'areas' String? expecting Array (sum)"
data/lib/oslg/oslog.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # BSD 3-Clause License
2
2
  #
3
- # Copyright (c) 2022, Denis Bourgeois
3
+ # Copyright (c) 2022-2023, Denis Bourgeois
4
4
  # All rights reserved.
5
5
  #
6
6
  # Redistribution and use in source and binary forms, with or without
@@ -127,6 +127,7 @@ module OSlg
127
127
  # @return [String] "DEBUG", "INFO", "WARN", "ERROR" or "FATAL"
128
128
  def tag(level)
129
129
  return @@tag[level] if level >= DEBUG && level <= FATAL
130
+
130
131
  ""
131
132
  end
132
133
 
@@ -138,6 +139,7 @@ module OSlg
138
139
  # @return [String] preset OSlg message
139
140
  def msg(status)
140
141
  return @@msg[status] if status >= DEBUG && status <= FATAL
142
+
141
143
  ""
142
144
  end
143
145
 
@@ -163,6 +165,7 @@ module OSlg
163
165
  @@logs << {level: level, message: message}
164
166
  @@status = level if level > @@status
165
167
  end
168
+
166
169
  @@status
167
170
  end
168
171
 
@@ -194,10 +197,11 @@ module OSlg
194
197
  mth = mth[0...60] + " ..." if mth.length > 60
195
198
  return res if mth.empty?
196
199
 
197
- msg = "Invalid '#{id}' "
200
+ msg = "Invalid '#{id}' "
198
201
  msg += "arg ##{ord} " if ord > 0
199
202
  msg += "(#{mth})"
200
203
  log(lvl, msg) if lvl >= DEBUG && lvl <= FATAL
204
+
201
205
  res
202
206
  end
203
207
 
@@ -232,6 +236,7 @@ module OSlg
232
236
 
233
237
  msg = "'#{id}' #{obj.class}? expecting #{cl} (#{mth})"
234
238
  log(lvl, msg) if lvl >= DEBUG && lvl <= FATAL
239
+
235
240
  res
236
241
  end
237
242
 
@@ -264,8 +269,9 @@ module OSlg
264
269
  mth = mth[0...60] + " ..." if mth.length > 60
265
270
  return res if mth.empty?
266
271
 
267
- msg = "Missing '#{key}' key in '#{id}' Hash (#{mth})"
272
+ msg = "Missing '#{key}' key in '#{id}' Hash (#{mth})"
268
273
  log(lvl, msg) if lvl >= DEBUG && lvl <= FATAL
274
+
269
275
  res
270
276
  end
271
277
 
@@ -294,8 +300,9 @@ module OSlg
294
300
  mth = mth[0...60] + " ..." if mth.length > 60
295
301
  return res if mth.empty?
296
302
 
297
- msg = "Empty '#{id}' (#{mth})"
303
+ msg = "Empty '#{id}' (#{mth})"
298
304
  log(lvl, msg) if lvl >= DEBUG && lvl <= FATAL
305
+
299
306
  res
300
307
  end
301
308
 
@@ -325,8 +332,9 @@ module OSlg
325
332
  mth = mth[0...60] + " ..." if mth.length > 60
326
333
  return res if mth.empty?
327
334
 
328
- msg = "Zero '#{id}' (#{mth})"
335
+ msg = "Zero '#{id}' (#{mth})"
329
336
  log(lvl, msg) if lvl >= DEBUG && lvl <= FATAL
337
+
330
338
  res
331
339
  end
332
340
 
@@ -355,9 +363,10 @@ module OSlg
355
363
 
356
364
  mth = mth[0...60] + " ..." if mth.length > 60
357
365
  return res if mth.empty?
358
-
359
- msg = "Negative '#{id}' (#{mth})"
366
+
367
+ msg = "Negative '#{id}' (#{mth})"
360
368
  log(lvl, msg) if lvl >= DEBUG && lvl <= FATAL
369
+
361
370
  res
362
371
  end
363
372
 
@@ -368,6 +377,7 @@ module OSlg
368
377
  def clean!
369
378
  @@status = 0
370
379
  @@logs = []
380
+
371
381
  @@level
372
382
  end
373
383
 
data/lib/oslg/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # BSD 3-Clause License
2
2
  #
3
- # Copyright (c) 2022, Denis Bourgeois
3
+ # Copyright (c) 2022-2023, Denis Bourgeois
4
4
  # All rights reserved.
5
5
  #
6
6
  # Redistribution and use in source and binary forms, with or without
@@ -29,5 +29,5 @@
29
29
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
31
  module OSlg
32
- VERSION = "0.2.5".freeze
32
+ VERSION = "0.2.7".freeze
33
33
  end
data/lib/oslg.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # BSD 3-Clause License
2
2
  #
3
- # Copyright (c) 2022, Denis Bourgeois
3
+ # Copyright (c) 2022-2023, Denis Bourgeois
4
4
  # All rights reserved.
5
5
  #
6
6
  # Redistribution and use in source and binary forms, with or without
data/oslg.gemspec CHANGED
@@ -24,14 +24,14 @@ Gem::Specification.new do |s|
24
24
  s.bindir = "exe"
25
25
  s.require_paths = ["lib"]
26
26
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
- s.required_ruby_version = [">= 2.5.0", "< 2.7.3"]
27
+ s.required_ruby_version = [">= 2.5.0", "< 3"]
28
28
  s.metadata = {}
29
29
 
30
30
  s.add_development_dependency "bundler", "~> 2.1"
31
31
  s.add_development_dependency "rake", "~> 13.0"
32
32
  s.add_development_dependency "rspec", "~> 3.11"
33
33
 
34
- s.metadata["homepage_uri"] = s.homepage
34
+ s.metadata["homepage_uri" ] = s.homepage
35
35
  s.metadata["source_code_uri"] = "#{s.homepage}/tree/v#{s.version}"
36
36
  s.metadata["bug_tracker_uri"] = "#{s.homepage}/issues"
37
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oslg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Bourgeois
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-01 00:00:00.000000000 Z
11
+ date: 2023-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,7 +76,7 @@ licenses:
76
76
  - BSD-3-Clause
77
77
  metadata:
78
78
  homepage_uri: https://github.com/rd2/oslg
79
- source_code_uri: https://github.com/rd2/oslg/tree/v0.2.5
79
+ source_code_uri: https://github.com/rd2/oslg/tree/v0.2.7
80
80
  bug_tracker_uri: https://github.com/rd2/oslg/issues
81
81
  post_install_message:
82
82
  rdoc_options: []
@@ -89,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
89
  version: 2.5.0
90
90
  - - "<"
91
91
  - !ruby/object:Gem::Version
92
- version: 2.7.3
92
+ version: '3'
93
93
  required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ">="