bundler-inject 1.0.0 → 1.1.0

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: 834b4bd13923ff8caf120998b70f6c4e1daa653892846b6e6fc20fbd614f8963
4
- data.tar.gz: faa0f483d05511d3bfdac39a87c4cb0f9a8b2ac3b3a3fe02c650c013090f4acb
3
+ metadata.gz: e84c7c5518d1d14f933e9db7934f55f1e86a247b2780a7daa4642210dddf47ed
4
+ data.tar.gz: '08f52153c4b6adcd2a64b13b099243244fb062192716a771b03c378f6a65577a'
5
5
  SHA512:
6
- metadata.gz: a39735242f3323779362935234af1dbeac7eba4b307a0b4f9a497139a3cd06a07cb03d9e52202e72f25a535b51b3b61c34de5d2bf121ea15ec24e628b40f746b
7
- data.tar.gz: 89411f99b21e2b814e36818cee44dd7e5f359080607d497c647789e8208bb76c059d82af5bfb0b8223166dc4be4badf60e0bd3def1b795e974f8f7dd76bdaca2
6
+ metadata.gz: 6505675dc040bc69e09b92278e58cdc0dec7d1619418ef10342b4022d452f3eb7ddf8838f8ef92712d9d613a8c147dd264d50b33fc6198bf9beeee6663793d97
7
+ data.tar.gz: 677daf2acda825f5b547dab00382a5deb6096827af57eb3df91313b1760652a222dee2b8f41d267a76c5145cfac49d1f76c5ceb1ff859bbb8aebe1d259e3580d
data/README.md CHANGED
@@ -77,6 +77,24 @@ otherwise if the options or version specified are significantly different, it
77
77
  will use `override_gem`, otherwise it will just do nothing, deferring to the
78
78
  original declaration.
79
79
 
80
+ ## Configuration
81
+
82
+ To disable warnings that are output to the console when `override_gem` or
83
+ `ensure_gem` is in use, you can update a bundler setting:
84
+
85
+ ```console
86
+ $ bundle config bundler_inject.disable_warn_override_gem true
87
+ ```
88
+
89
+ or use an environment variable:
90
+
91
+ ```console
92
+ $ export BUNDLE_BUNDLER_INJECT__DISABLE_WARN_OVERRIDE_GEM=true
93
+ ```
94
+
95
+ There is a fallback for those that will check the `RAILS_ENV` environment
96
+ variable, and will disable the warning when in `"production"`.
97
+
80
98
  ## What is this sorcery?
81
99
 
82
100
  While this is technically a bundler plugin, bundler-inject does not use the
@@ -1,6 +1,42 @@
1
1
  require "bundler/inject/version"
2
2
  require "bundler/inject/dsl_patch"
3
3
 
4
+ module Bundler
5
+ module Inject
6
+ class << self
7
+ # Check if we should skip outputing warnings
8
+ #
9
+ # This can be set in two ways:
10
+ #
11
+ # - Via bundler's Bundler::Settings
12
+ # - When RAILS_ENV=production is set
13
+ #
14
+ # To configure the setting, you can run:
15
+ #
16
+ # bundle config bundler_inject.disable_warn_override_gem true
17
+ #
18
+ # OR use an environment variable
19
+ #
20
+ # BUNDLE_BUNDLER_INJECT__DISABLE_WARN_OVERRIDE_GEM=true bundle ...
21
+ #
22
+ # If neither are set, it will check for ENV["RAILS_ENV"] is "production",
23
+ # and will skip if it is, but the bundler variable is present (and even
24
+ # set to "false") that will be favored.
25
+ def skip_warnings?
26
+ return @skip_warnings if defined?(@skip_warnings)
27
+
28
+ bundler_setting = Bundler.settings["bundler_inject.disable_warn_override_gem"]
29
+
30
+ if bundler_setting.nil?
31
+ ENV["RAILS_ENV"] == "production"
32
+ else
33
+ bundler_setting
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+
4
40
  Bundler::Dsl.prepend(Bundler::Inject::DslPatch)
5
41
  ObjectSpace.each_object(Bundler::Dsl) do |o|
6
42
  o.singleton_class.prepend(Bundler::Inject::DslPatch)
@@ -69,7 +69,7 @@ module Bundler
69
69
  end
70
70
 
71
71
  def warn_override_gem(calling_file, name, args)
72
- return if ENV["RAILS_ENV"] == "production"
72
+ return if Bundler::Inject.skip_warnings?
73
73
 
74
74
  version, opts = extract_version_opts(args)
75
75
  message = "** override_gem(#{name.inspect}"
@@ -1,5 +1,5 @@
1
1
  module Bundler
2
2
  module Inject
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler-inject
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ManageIQ Authors
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-05 00:00:00.000000000 Z
11
+ date: 2019-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler