anyway_config 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -5
- data/CHANGELOG.md +4 -0
- data/anyway_config.gemspec +1 -1
- data/gemfiles/railsmaster.gemfile +1 -0
- data/lib/anyway/config.rb +8 -3
- data/lib/anyway/ext/jruby.rb +91 -0
- data/lib/anyway/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a97f6978750cef7720cc23ca182e8a6456655cb8ece18d1becdcd5e58262b7b9
|
4
|
+
data.tar.gz: 5be2a8fc609273c759cef30b3eaf3c6d470716dc722ebd2a75a32b4209fe42a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e7c52fde9b0db72b7429748d0950286facbd82731e98375494dbd4dedec4efd448cc83bc30df8802a98e25c8bd230587ee2d8e09475aab8541410df1208672e
|
7
|
+
data.tar.gz: 932f662e306d85328a9a9131dcb8daab211bb87ee2f1177b68cce1c3b8c315ab2bd4ac4cd2e148c992e02f3ac4bfa4a0c32600b345957f61178cdd9aaa3c3d79
|
data/.travis.yml
CHANGED
@@ -8,7 +8,8 @@ notifications:
|
|
8
8
|
email: false
|
9
9
|
|
10
10
|
before_install:
|
11
|
-
- gem
|
11
|
+
- gem update --system
|
12
|
+
- gem install bundler -v '< 2'
|
12
13
|
|
13
14
|
matrix:
|
14
15
|
include:
|
@@ -16,12 +17,14 @@ matrix:
|
|
16
17
|
gemfile: gemfiles/railsmaster.gemfile
|
17
18
|
- rvm: jruby-9.2.5.0
|
18
19
|
gemfile: gemfiles/jruby.gemfile
|
19
|
-
- rvm:
|
20
|
+
- rvm: jruby-9.1.15.0
|
21
|
+
gemfile: gemfiles/jruby.gemfile
|
22
|
+
- rvm: 2.5.1
|
20
23
|
gemfile: gemfiles/rails5.gemfile
|
21
|
-
- rvm: 2.
|
24
|
+
- rvm: 2.5.1
|
22
25
|
gemfile: gemfiles/rails42.gemfile
|
26
|
+
- rvm: 2.3.2
|
27
|
+
gemfile: gemfiles/rails5.gemfile
|
23
28
|
allow_failures:
|
24
29
|
- rvm: ruby-head
|
25
30
|
gemfile: gemfiles/railsmaster.gemfile
|
26
|
-
- rvm: jruby-9.2.5.0
|
27
|
-
gemfile: gemfiles/jruby.gemfile
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 1.4.3 (2019-02-04)
|
6
|
+
|
7
|
+
- Add a temporary fix for JRuby regression [#5550](https://github.com/jruby/jruby/issues/5550). ([@palkan][])
|
8
|
+
|
5
9
|
## 1.4.2 (2018-01-05)
|
6
10
|
|
7
11
|
- Fix: detect Rails by presence of `Rails::VERSION` (instead of just `Rails`). ([@palkan][])
|
data/anyway_config.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.require_paths = ["lib"]
|
23
23
|
s.required_ruby_version = '>= 2.3'
|
24
24
|
|
25
|
-
s.add_development_dependency "bundler", "
|
25
|
+
s.add_development_dependency "bundler", ">= 1.15"
|
26
26
|
s.add_development_dependency "rspec", "~> 3.5"
|
27
27
|
s.add_development_dependency "rubocop", "~> 0.60.0"
|
28
28
|
s.add_development_dependency "simplecov", ">= 0.3.8"
|
data/lib/anyway/config.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'anyway/ext/jruby' if defined? JRUBY_VERSION
|
3
4
|
require 'anyway/ext/deep_dup'
|
4
5
|
require 'anyway/ext/deep_freeze'
|
5
6
|
require 'anyway/ext/hash'
|
@@ -7,9 +8,13 @@ require 'anyway/ext/string_serialize'
|
|
7
8
|
require 'anyway/option_parser_builder'
|
8
9
|
|
9
10
|
module Anyway # :nodoc:
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
if defined? JRUBY_VERSION
|
12
|
+
using Anyway::Ext::JRuby
|
13
|
+
else
|
14
|
+
using Anyway::Ext::DeepDup
|
15
|
+
using Anyway::Ext::DeepFreeze
|
16
|
+
using Anyway::Ext::Hash
|
17
|
+
end
|
13
18
|
using Anyway::Ext::StringSerialize
|
14
19
|
|
15
20
|
# Base config class
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anyway
|
4
|
+
module Ext
|
5
|
+
# JRuby 9.2.5.0. has a regression which breaks multiple refinements for the same
|
6
|
+
# class, so we put them in one God-refinement
|
7
|
+
# See https://github.com/jruby/jruby/issues/5550
|
8
|
+
#
|
9
|
+
# Should be fixed in 9.2.6.0
|
10
|
+
module JRuby
|
11
|
+
refine ::Hash do
|
12
|
+
# Based on ActiveSupport http://api.rubyonrails.org/classes/Hash.html#method-i-deep_dup
|
13
|
+
def deep_dup
|
14
|
+
each_with_object(dup) do |(key, value), hash|
|
15
|
+
hash[key] = if value.is_a?(::Hash) || value.is_a?(::Array)
|
16
|
+
value.deep_dup
|
17
|
+
else
|
18
|
+
value
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def deep_freeze
|
24
|
+
freeze
|
25
|
+
each_value do |value|
|
26
|
+
value.deep_freeze if value.is_a?(::Hash) || value.is_a?(::Array)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# From ActiveSupport http://api.rubyonrails.org/classes/Hash.html#method-i-deep_merge
|
31
|
+
def deep_merge!(other_hash)
|
32
|
+
other_hash.each_pair do |current_key, other_value|
|
33
|
+
this_value = self[current_key]
|
34
|
+
|
35
|
+
if this_value.is_a?(::Hash) && other_value.is_a?(::Hash)
|
36
|
+
this_value.deep_merge!(other_value)
|
37
|
+
this_value
|
38
|
+
else
|
39
|
+
self[current_key] = other_value
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
self
|
44
|
+
end
|
45
|
+
|
46
|
+
def stringify_keys!
|
47
|
+
keys.each do |key|
|
48
|
+
value = delete(key)
|
49
|
+
value.stringify_keys! if value.is_a?(::Hash)
|
50
|
+
self[key.to_s] = value
|
51
|
+
end
|
52
|
+
|
53
|
+
self
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
refine ::Array do
|
58
|
+
# From ActiveSupport http://api.rubyonrails.org/classes/Array.html#method-i-deep_dup
|
59
|
+
def deep_dup
|
60
|
+
map do |value|
|
61
|
+
if value.is_a?(::Hash) || value.is_a?(::Array)
|
62
|
+
value.deep_dup
|
63
|
+
else
|
64
|
+
value
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def deep_freeze
|
70
|
+
freeze
|
71
|
+
each do |value|
|
72
|
+
value.deep_freeze if value.is_a?(::Hash) || value.is_a?(::Array)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
if defined?(::ActiveSupport::HashWithIndifferentAccess)
|
78
|
+
refine ::ActiveSupport::HashWithIndifferentAccess do
|
79
|
+
def deep_freeze
|
80
|
+
freeze
|
81
|
+
each_value do |value|
|
82
|
+
value.deep_freeze if value.is_a?(::Hash) || value.is_a?(::Array)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
using self
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
data/lib/anyway/version.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anyway_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.15'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.15'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- lib/anyway/ext/deep_dup.rb
|
97
97
|
- lib/anyway/ext/deep_freeze.rb
|
98
98
|
- lib/anyway/ext/hash.rb
|
99
|
+
- lib/anyway/ext/jruby.rb
|
99
100
|
- lib/anyway/ext/string_serialize.rb
|
100
101
|
- lib/anyway/option_parser_builder.rb
|
101
102
|
- lib/anyway/rails/config.rb
|