berkeley_library-av-core 0.4.0 → 0.4.1

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: 472efcb19a77e962d85c419d61cbc4fd809d3ce3a963c984a22e68009273258e
4
- data.tar.gz: e6954a8b128105ac9d416970b0f6fdca9d96c17535a8bd4f28a68be823dc19ca
3
+ metadata.gz: 569fd96dfe6a21d1063777121fdc2d8f56d5dd032f0f666d4a09139f9d67bf72
4
+ data.tar.gz: ecb0b263d9b9e89a5cdb8a2c6fadc5bf26f5e0fcdc089ece07eaef2c0c56a0fd
5
5
  SHA512:
6
- metadata.gz: a4cf4b944c3a3616739bd936334b0d0d1e04ab59ac6098b299d8f06bd8753cec3c5ffb207b049c5ab8974ceaa4088e849c5083bb0e81ec1c309ba47cb196aa37
7
- data.tar.gz: a56fb208be8b1ff8889d8d83c6c109068ec81b566200fd24a8f76ba8a1106c267e338d39c59d88564939ab283c9520f038bbf4d0f8d0d367974c3dd03acb2b75
6
+ metadata.gz: ece212939d614f6b1818325f6105d6e0dbd41b5ce29cf6ff5b728a66ba6431bdbba7415116e456d94328c5e8241c3285f0ce41b486b7913e88dc252305fe910e
7
+ data.tar.gz: e7f9fa98fe978ad7fd4c2697913203397ec0b03cdf3896c6a3541b1122f5353d80368e61639db4be0d078fa53a37086ce947afbe6466b0417355b9d32d527c99
data/CHANGES.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 0.4.1 (2023-02-21)
2
+
3
+ - Add `BerkeleyLibrary::AV::Config.log_settings!`
4
+
5
+ # 0.4.0 (2023-01-05)
6
+
7
+ - Initial public release to RubyGems
8
+
1
9
  # 0.3.0 (2022-02-01)
2
10
 
3
11
  - Rename `Record#ucb_access?` and `Metadata#ucb_access?` to `calnet_or_ip?` for clarity.
@@ -1,4 +1,5 @@
1
- require 'berkeley_library/util/uris'
1
+ require 'berkeley_library/logging'
2
+ require 'berkeley_library/util'
2
3
 
3
4
  module BerkeleyLibrary
4
5
  module AV
@@ -34,6 +35,8 @@ module BerkeleyLibrary
34
35
 
35
36
  # View state key to use when generating Alma permalinks, e.g. `iqob43`; see
36
37
  # https://knowledge.exlibrisgroup.com/Primo/Knowledge_Articles/What_is_the_key_in_short_permalinks%3F
38
+ #
39
+ # Note that despite the name 'key', this is not a secret.
37
40
  def alma_permalink_key
38
41
  @alma_permalink_key ||= value_from_rails_config(:alma_permalink_key)
39
42
  end
@@ -158,8 +161,19 @@ module BerkeleyLibrary
158
161
  raise ArgumentError, "Missing AV configuration settings: #{missing_settings.join(', ')}"
159
162
  end
160
163
 
164
+ # Logs settings to the specified logger, or to the default logger.
165
+ # @param to_logger The logger to log to, if not the default.
166
+ def log_settings!(to_logger: BerkeleyLibrary::Logging.logger)
167
+ settings = REQUIRED_SETTINGS.to_h { |attr| [attr, loggable_value(send(attr))] }
168
+ to_logger.info("#{name} settings:", settings:)
169
+ end
170
+
161
171
  private
162
172
 
173
+ def loggable_value(v)
174
+ v.is_a?(URI) ? v.to_s : v
175
+ end
176
+
163
177
  def sru_base_uri_for(domain, inst_code)
164
178
  URIs.append("https://#{domain}/view/sru/", inst_code)
165
179
  end
@@ -8,8 +8,8 @@ module BerkeleyLibrary
8
8
  SUMMARY = 'UC Berkeley Library audio/video core code'.freeze
9
9
  DESCRIPTION = 'Gem for UC Berkeley Library shared audio/video code'.freeze
10
10
  LICENSE = 'MIT'.freeze
11
- VERSION = '0.4.0'.freeze
12
- HOMEPAGE = 'https://git.lib.berkeley.edu/lap/av_core'.freeze
11
+ VERSION = '0.4.1'.freeze
12
+ HOMEPAGE = 'https://github.com/BerkeleyLibrary/av-core'.freeze
13
13
 
14
14
  private_class_method :new
15
15
  end
@@ -9,7 +9,7 @@ module BerkeleyLibrary
9
9
  Config.send(:clear!)
10
10
  end
11
11
 
12
- describe(:configured?) do
12
+ describe :configured? do
13
13
  it 'defaults to false' do
14
14
  expect(AV.configured?).to eq(false)
15
15
  end
@@ -66,7 +66,7 @@ module BerkeleyLibrary
66
66
  end
67
67
  end
68
68
 
69
- describe(:missing) do
69
+ describe :missing do
70
70
  it 'defaults to all settings' do
71
71
  expect(Config.missing).to eq(Config::REQUIRED_SETTINGS)
72
72
  end
@@ -107,6 +107,52 @@ module BerkeleyLibrary
107
107
  end
108
108
  end
109
109
 
110
+ describe :log_settings! do
111
+ it 'logs all settings' do
112
+ settings = {
113
+ avplayer_base_uri: 'http://avplayer.example.edu',
114
+ alma_sru_host: 'berkeley.alma.exlibrisgroup.com',
115
+ alma_primo_host: 'search.library.berkeley.edu',
116
+ alma_institution_code: '01UCS_BER',
117
+ alma_permalink_key: 'iqob43',
118
+ tind_base_uri: 'http://tind.example.edu',
119
+ wowza_base_uri: 'http://wowza.example.edu'
120
+ }
121
+ settings.each { |setting, value| Config.send("#{setting}=", value) }
122
+
123
+ expect(BerkeleyLibrary::Logging.logger)
124
+ .to receive(:info).with(/config/i, settings:)
125
+ Config.log_settings!
126
+ end
127
+
128
+ it 'logs nil for missing settings' do
129
+ settings = Config::REQUIRED_SETTINGS.to_h { |attr| [attr, nil] }
130
+
131
+ expect(BerkeleyLibrary::Logging.logger)
132
+ .to receive(:info).with(/config/i, settings:)
133
+ Config.log_settings!
134
+ end
135
+
136
+ it 'accepts a custom logger' do
137
+ settings = {
138
+ avplayer_base_uri: 'http://avplayer.example.edu',
139
+ alma_sru_host: 'berkeley.alma.exlibrisgroup.com',
140
+ alma_primo_host: 'search.library.berkeley.edu',
141
+ alma_institution_code: '01UCS_BER',
142
+ alma_permalink_key: 'iqob43',
143
+ tind_base_uri: 'http://tind.example.edu',
144
+ wowza_base_uri: 'http://wowza.example.edu'
145
+ }
146
+ settings.each { |setting, value| Config.send("#{setting}=", value) }
147
+
148
+ logger = instance_double(Ougai::Logger)
149
+ expect(logger)
150
+ .to receive(:info).with(/config/i, settings:)
151
+
152
+ Config.log_settings!(to_logger: logger)
153
+ end
154
+ end
155
+
110
156
  describe :avplayer_base_uri= do
111
157
  it 'converts strings to URIs' do
112
158
  expected_uri = URI.parse('http://avplayer.example.edu')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berkeley_library-av-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Moles
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-05 00:00:00.000000000 Z
11
+ date: 2023-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: berkeley_library-logging
@@ -336,7 +336,6 @@ files:
336
336
  - ".simplecov"
337
337
  - CHANGES.md
338
338
  - Gemfile
339
- - Jenkinsfile
340
339
  - LICENSE.md
341
340
  - README.md
342
341
  - Rakefile
@@ -422,7 +421,7 @@ files:
422
421
  - spec/lib/berkeley_library/av/types/file_type_spec.rb
423
422
  - spec/lib/berkeley_library/av/util_spec.rb
424
423
  - spec/spec_helper.rb
425
- homepage: https://git.lib.berkeley.edu/lap/av_core
424
+ homepage: https://github.com/BerkeleyLibrary/av-core
426
425
  licenses:
427
426
  - MIT
428
427
  metadata:
data/Jenkinsfile DELETED
@@ -1,16 +0,0 @@
1
- dockerComposePipeline(
2
- commands: [
3
- 'bundle exec rake coverage',
4
- 'bundle exec rake rubocop',
5
- 'bundle exec rake bundle:audit',
6
- 'bundle exec rake gem'
7
- ],
8
- artifacts: [
9
- junit: 'artifacts/rspec/**/*.xml',
10
- html : [
11
- 'Code Coverage': 'artifacts/rcov',
12
- 'RuboCop' : 'artifacts/rubocop'
13
- ],
14
- raw : ['artifacts/**/*.gem']
15
- ]
16
- )