openstax_utilities 5.1.1 → 5.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6b4a1617ff2a15831620ed25b06188c82509acd7754385a199dc5a720e8c3c8
4
- data.tar.gz: ec843fec376ba727268a5c87935f3b28aa6fcfaa810a445f3703786aa32114fd
3
+ metadata.gz: 1b0d5614455f42b5cdee91e432f30eec08d839ba8e10198412840814e9c634bf
4
+ data.tar.gz: 7c98d368d41ed57e535b7264c7225aeede514a8dd661e9bf2545649fa96c9f2e
5
5
  SHA512:
6
- metadata.gz: 2c05ba5ecb8f2f70444a44f55371586bc8eec3c9dd7057ec6f0d91754530f4107014636e9251c3fa6b5bced827bda5d7efee545884cd4490719ec9b8c5d26806
7
- data.tar.gz: 189bd0b1eb0d2a0822bef91051bd2d5687c8df01d27e44a23bea28448368d3c9731de7baa23d766a0888c5b18d7e70221da9bf0995a6f57688f4998d423399e8
6
+ metadata.gz: 1ba10b245bbcd0bdb522b649f269fd387f4ccf725ebb622f0b7a632c0432964abb9b0599b42c29ad8cfcfc04cba6a5220ed9aa8f5b5eabf468f1d25882da102a
7
+ data.tar.gz: 0b24d819a3d2203465eccc20671b3531f851f402f81bb75efc4ed3a10809f0e0c0e1f02324ea630b42965292aa7342fed4e4ae2bd2a7b601bb371dd302f7b0a2
@@ -1,24 +1,26 @@
1
- ActionController::Base.define_singleton_method(:protect_beta) do |options={}|
2
- options[:username] ||= SecureRandom.hex
3
- options[:password] ||= SecureRandom.hex
4
- options[:enable_always] ||= false
5
- options[:message] ||= ''
6
-
7
- return if !(options[:enable_always] || Rails.env.production?)
1
+ ActiveSupport.on_load(:action_controller_base) do
2
+ ActionController::Base.define_singleton_method(:protect_beta) do |options={}|
3
+ options[:username] ||= SecureRandom.hex
4
+ options[:password] ||= SecureRandom.hex
5
+ options[:enable_always] ||= false
6
+ options[:message] ||= ''
8
7
 
9
- @@protect_beta_options = options
10
- prepend_before_filter :protect_beta
11
- end
8
+ return if !(options[:enable_always] || Rails.env.production?)
12
9
 
13
- ActionController::Base.define_singleton_method(:skip_protect_beta) do |options={}|
14
- skip_before_filter :protect_beta, options
15
- end
10
+ @@protect_beta_options = options
11
+ prepend_before_filter :protect_beta
12
+ end
16
13
 
17
- class ActionController::Base
18
- def protect_beta
19
- options = @@protect_beta_options
20
- authenticate_or_request_with_http_basic(options[:message]) do |username, password|
21
- username == options[:username] && password == options[:password]
14
+ ActionController::Base.define_singleton_method(:skip_protect_beta) do |options={}|
15
+ skip_before_filter :protect_beta, options
16
+ end
17
+
18
+ class ActionController::Base
19
+ def protect_beta
20
+ options = @@protect_beta_options
21
+ authenticate_or_request_with_http_basic(options[:message]) do |username, password|
22
+ username == options[:username] && password == options[:password]
23
+ end
22
24
  end
23
25
  end
24
26
  end
@@ -27,7 +29,7 @@ module OpenStax
27
29
  module Utilities
28
30
  module Access
29
31
 
30
- # Called in a controller to provide an outer level of basic HTTP
32
+ # Called in a controller to provide an outer level of basic HTTP
31
33
  # authentication, typically used when code is deployed during development
32
34
  # and it is not yet ready for public consumption.
33
35
  #
@@ -39,7 +41,7 @@ module OpenStax
39
41
  # @param :username The authentication username; default value is a random hex string
40
42
  # @param :password The authentication password; default value is a random hex string
41
43
  # @param :enable_always The default is the authentication is only enabled
42
- # in production, setting this to true will make it effective in all
44
+ # in production, setting this to true will make it effective in all
43
45
  # environments
44
46
  # @param :message If given, this message will be displayed in the browser's
45
47
  # authentication dialog box.
@@ -21,4 +21,6 @@ module OpenStax::Utilities
21
21
  end
22
22
  end
23
23
 
24
- ActionController::Base.send :helper, OpenStax::Utilities::OsuHelper
24
+ ActiveSupport.on_load(:action_controller_base) do
25
+ ActionController::Base.send :helper, OpenStax::Utilities::OsuHelper
26
+ end
@@ -1,5 +1,5 @@
1
1
  module OpenStax
2
2
  module Utilities
3
- VERSION = '5.1.1'
3
+ VERSION = '5.1.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_utilities
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.1
4
+ version: 5.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-22 00:00:00.000000000 Z
11
+ date: 2024-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -259,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
259
  - !ruby/object:Gem::Version
260
260
  version: '0'
261
261
  requirements: []
262
- rubygems_version: 3.1.6
262
+ rubygems_version: 3.5.21
263
263
  signing_key:
264
264
  specification_version: 4
265
265
  summary: Utilities for OpenStax web sites