webvalve 0.9.6 → 0.9.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
  SHA1:
3
- metadata.gz: 85339410fa30aa4cb403ec0ec9466439a116e56e
4
- data.tar.gz: 679473da643fc5b0dee1fc6e47d80943f20f0558
3
+ metadata.gz: d20ff6188f40da891f473d759c59756663969c5d
4
+ data.tar.gz: 25c6f27d9285afaa2d0affe93f1e6b34052b9d64
5
5
  SHA512:
6
- metadata.gz: ee3ccf5b6d9820bf37023428235fc9716d5323f0bcc65e1dca00d38a37d3db3fbb73105ea2ff056ebb77646fa82caeb54b4d045623663952a4ce8a1a091a6554
7
- data.tar.gz: e87a9ab43c489f4f652d6462672272976c6de1d6f372d0e3dafc2e0bd29865710f67b02e01ba23a550bce2a23e072e9dbf0b87d546fbf335f22370db8567a319
6
+ metadata.gz: 0c71debf9c31b8df724f6bf5751630a180dce3de6a3e3888057874abbb9533f6f8fca46b2198658eb3a00898792252c27dbb3aca041bbfc5e8a36737b46eb660
7
+ data.tar.gz: 197ad5715b1851d086b8ead3550318a937468bfa9b6b92072fb7743252a6075aac0db5882df8a4d0b2fb94743210fc242181785cc47e2b585dadc11c7a1c1143
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ and this project aims to adhere to [Semantic Versioning](http://semver.org/spec/
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.9.7] - 2018-09-30
10
+ ### Changed
11
+ - Improved WEBVALVED_ENABLED behavior from @haffla (https://github.com/Betterment/webvalve/pull/24)
12
+
9
13
  ## [0.9.6] - 2018-06-27
10
14
  ### Changed
11
15
  - fix changelog links
@@ -14,6 +18,7 @@ and this project aims to adhere to [Semantic Versioning](http://semver.org/spec/
14
18
  ### Changed
15
19
  - WebMock 3+ support from @messanjah (https://github.com/Betterment/webvalve/pull/22)
16
20
 
17
- [Unreleased]: https://github.com/Betterment/webvalve/compare/v0.9.6...HEAD
21
+ [Unreleased]: https://github.com/Betterment/webvalve/compare/v0.9.7...HEAD
22
+ [0.9.7]: https://github.com/Betterment/webvalve/compare/v0.9.6...v0.9.7
18
23
  [0.9.6]: https://github.com/Betterment/webvalve/compare/v0.9.5...v0.9.6
19
24
  [0.9.5]: https://github.com/Betterment/webvalve/compare/v0.9.4...v0.9.5
@@ -1,15 +1,17 @@
1
1
  module WebValve
2
2
  class Railtie < ::Rails::Railtie
3
- if WebValve.enabled?
4
- initializer 'webvalve.set_autoload_paths', before: :set_autoload_paths do |app|
3
+ initializer 'webvalve.set_autoload_paths', before: :set_autoload_paths do |app|
4
+ if WebValve.enabled?
5
5
  WebValve.config_paths << app.root
6
6
 
7
7
  WebValve.config_paths.each do |root|
8
8
  app.config.eager_load_paths << root.join('webvalve').to_s
9
9
  end
10
10
  end
11
+ end
11
12
 
12
- initializer 'webvalve.setup' do
13
+ initializer 'webvalve.setup' do
14
+ if WebValve.enabled?
13
15
  WebValve.config_paths.each do |root|
14
16
  path = root.join('config', 'webvalve.rb').to_s
15
17
  load path if File.exist?(path)
@@ -1,3 +1,3 @@
1
1
  module WebValve
2
- VERSION = "0.9.6"
2
+ VERSION = "0.9.7"
3
3
  end
data/lib/webvalve.rb CHANGED
@@ -16,6 +16,7 @@ module WebValve
16
16
  # @!method reset
17
17
  # @see WebValve::Manager#reset
18
18
  delegate :setup, :register, :whitelist_url, :reset, to: :manager
19
+ attr_writer :logger
19
20
 
20
21
  def enabled?
21
22
  if env.in?(ALWAYS_ENABLED_ENVS)
@@ -35,8 +36,24 @@ module WebValve
35
36
  @config_paths ||= Set.new
36
37
  end
37
38
 
39
+ def logger
40
+ @logger ||=
41
+ if defined?(::Rails)
42
+ # Rails.logger can be nil
43
+ ::Rails.logger || default_logger
44
+ else
45
+ default_logger
46
+ end
47
+ end
48
+
49
+ def default_logger
50
+ ActiveSupport::Logger.new(STDOUT).tap do |l|
51
+ l.formatter = ::Logger::Formatter.new
52
+ end
53
+ end
54
+
38
55
  if defined?(::Rails)
39
- delegate :env, :env=, :logger, :logger=, to: ::Rails
56
+ delegate :env, :env=, to: ::Rails
40
57
  else
41
58
  def env
42
59
  @env ||= (ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development').inquiry
@@ -45,16 +62,6 @@ module WebValve
45
62
  def env=(env)
46
63
  @env = env&.inquiry
47
64
  end
48
-
49
- def logger
50
- @logger ||= ActiveSupport::Logger.new(STDOUT).tap do |l|
51
- l.formatter = ::Logger::Formatter.new
52
- end
53
- end
54
-
55
- def logger=(logger)
56
- @logger = logger
57
- end
58
65
  end
59
66
 
60
67
  def manager
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webvalve
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Moore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-27 00:00:00.000000000 Z
11
+ date: 2018-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport