washout_builder 1.7.4 → 2.0.4
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 +4 -4
- data/.travis.yml +15 -14
- data/Appraisals +8 -2
- data/README.md +22 -1
- data/Rakefile +3 -3
- data/app/controllers/washout_builder/washout_builder_controller.rb +9 -9
- data/app/helpers/washout_builder_complex_type_helper.rb +4 -2
- data/app/helpers/washout_builder_method_arguments_helper.rb +4 -2
- data/app/helpers/washout_builder_method_list_helper.rb +4 -2
- data/app/helpers/washout_builder_method_return_type_helper.rb +6 -4
- data/app/helpers/washout_builder_shared_helper.rb +29 -0
- data/app/views/wash_with_html/doc.builder +6 -6
- data/gemfiles/rails_6.1.3.gemfile +8 -0
- data/install-travis-bundler.sh +12 -10
- data/lib/washout_builder.rb +0 -1
- data/lib/washout_builder/document/complex_type.rb +35 -54
- data/lib/washout_builder/document/exception_model.rb +17 -18
- data/lib/washout_builder/document/generator.rb +6 -6
- data/lib/washout_builder/engine.rb +1 -0
- data/lib/washout_builder/env_checker.rb +2 -2
- data/lib/washout_builder/soap.rb +2 -2
- data/lib/washout_builder/version.rb +2 -2
- data/spec/app/controllers/washout_builder_controller_spec.rb +4 -4
- data/spec/dummy/app/views/layouts/application.html.erb +1 -1
- data/spec/dummy/public/404.html +1 -1
- data/spec/dummy/public/422.html +1 -1
- data/spec/dummy/public/500.html +1 -1
- data/spec/lib/washout_builder/document/complex_type_spec.rb +32 -36
- data/spec/lib/washout_builder/document/exception_model_spec.rb +5 -5
- data/spec/spec_helper.rb +37 -2
- data/spec/support/complex_types/test_type.rb +1 -2
- data/washout_builder.gemspec +3 -2
- metadata +55 -60
- data/lib/washout_builder/param.rb +0 -50
@@ -16,18 +16,18 @@ module WashoutBuilder
|
|
16
16
|
# @see #find_fault_model_structure
|
17
17
|
# @see #fault_without_inheritable_elements
|
18
18
|
#
|
19
|
-
# @param [Array<Hash>]
|
19
|
+
# @param [Array<Hash>] classes_defined An array that contains all the information about all the exception classes found so far
|
20
20
|
# @param [Boolean] _debug = false An optional parameter used for debugging purposes
|
21
21
|
# @return [Array<Class>] Array with all the exception classes from which the current exception class inherits from
|
22
22
|
# @api public
|
23
|
-
def get_fault_class_ancestors(
|
23
|
+
def get_fault_class_ancestors(classes_defined, _debug = false)
|
24
24
|
bool_the_same = false
|
25
25
|
ancestors = fault_ancestors
|
26
26
|
if ancestors.blank?
|
27
|
-
|
27
|
+
classes_defined << fault_ancestor_hash(find_fault_model_structure, [])
|
28
28
|
else
|
29
|
-
|
30
|
-
ancestors[0].get_fault_class_ancestors(
|
29
|
+
classes_defined << fault_ancestor_hash(fault_without_inheritable_elements(ancestors), ancestors)
|
30
|
+
ancestors[0].get_fault_class_ancestors(classes_defined)
|
31
31
|
end
|
32
32
|
ancestors unless bool_the_same
|
33
33
|
end
|
@@ -47,7 +47,7 @@ module WashoutBuilder
|
|
47
47
|
# @return [Array<Class>] Returns an array with all the classes from which the current exception class inherits from
|
48
48
|
# @api public
|
49
49
|
def fault_ancestors
|
50
|
-
get_complex_type_ancestors(self,
|
50
|
+
get_complex_type_ancestors(self, %w(ActiveRecord::Base Object BasicObject Exception))
|
51
51
|
end
|
52
52
|
|
53
53
|
# constructs the structure of the current exception class by holding the instance, the structure, and its ancestors
|
@@ -80,9 +80,9 @@ module WashoutBuilder
|
|
80
80
|
# @api public
|
81
81
|
def check_valid_fault_method?(method)
|
82
82
|
method != :== && method != :! &&
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
(instance_methods.include?(:"#{method}=") ||
|
84
|
+
instance_methods.include?(:"#{method}")
|
85
|
+
)
|
86
86
|
end
|
87
87
|
|
88
88
|
# tries to fins all instance methods that have both a setter and a getter of the curent class
|
@@ -90,7 +90,6 @@ module WashoutBuilder
|
|
90
90
|
# @return [Array<String>] An array with all the atrributes and instance methods that have both a setter and a getter
|
91
91
|
# @api public
|
92
92
|
def find_fault_attributes
|
93
|
-
attrs = []
|
94
93
|
attrs = instance_methods(nil).map do |method|
|
95
94
|
method.to_s if check_valid_fault_method?(method)
|
96
95
|
end
|
@@ -105,12 +104,12 @@ module WashoutBuilder
|
|
105
104
|
# @api public
|
106
105
|
def get_fault_type_method(method_name)
|
107
106
|
case method_name.to_s.downcase
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
107
|
+
when 'code'
|
108
|
+
'integer'
|
109
|
+
when 'message', 'backtrace'
|
110
|
+
'string'
|
111
|
+
else
|
112
|
+
'string'
|
114
113
|
end
|
115
114
|
end
|
116
115
|
|
@@ -126,8 +125,8 @@ module WashoutBuilder
|
|
126
125
|
method_name = method_name.to_s.end_with?('=') ? method_name.to_s.delete('=') : method_name
|
127
126
|
primitive_type = get_fault_type_method(method_name)
|
128
127
|
h["#{method_name}"] = {
|
129
|
-
|
130
|
-
|
128
|
+
primitive: "#{primitive_type}",
|
129
|
+
member_type: nil
|
131
130
|
}
|
132
131
|
end
|
133
132
|
h
|
@@ -164,11 +164,11 @@ module WashoutBuilder
|
|
164
164
|
# @return [Array<WashOut::Param>] Returns an array with all the complex types sorted alphabetically
|
165
165
|
# @api public
|
166
166
|
def complex_types
|
167
|
-
|
167
|
+
classes_defined = []
|
168
168
|
(input_types + output_types).each do |p|
|
169
|
-
|
169
|
+
classes_defined.concat(p.get_nested_complex_types(config, classes_defined))
|
170
170
|
end
|
171
|
-
|
171
|
+
sort_complex_types(classes_defined, 'class')
|
172
172
|
end
|
173
173
|
|
174
174
|
# Returns an array with all the operations that can raise an exception at least or more
|
@@ -205,9 +205,9 @@ module WashoutBuilder
|
|
205
205
|
# @api public
|
206
206
|
def get_complex_fault_types(base_fault_array)
|
207
207
|
fault_types = []
|
208
|
-
|
209
|
-
|
210
|
-
|
208
|
+
classes_defined = filter_exceptions_raised
|
209
|
+
classes_defined = classes_defined.blank? ? base_fault_array : classes_defined.concat(base_fault_array)
|
210
|
+
classes_defined.each { |exception_class| exception_class.get_fault_class_ancestors(fault_types, true) } unless classes_defined.blank?
|
211
211
|
fault_types
|
212
212
|
end
|
213
213
|
|
@@ -4,6 +4,7 @@ module WashoutBuilder
|
|
4
4
|
class Engine < ::Rails::Engine
|
5
5
|
isolate_namespace WashoutBuilder
|
6
6
|
config.washout_builder = ActiveSupport::OrderedOptions.new
|
7
|
+
|
7
8
|
initializer 'washout_builder.configuration' do |app|
|
8
9
|
mounted_path = app.config.washout_builder[:mounted_path]
|
9
10
|
if WashoutBuilder::EnvChecker.new(app).available_for_env?(Rails.env)
|
@@ -9,7 +9,7 @@ module WashoutBuilder
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def available_for_env?(env_name)
|
12
|
-
if
|
12
|
+
if whitelist.present? || blacklist.present?
|
13
13
|
if whitelist.find{|a| blacklist.include?(a) }.blank?
|
14
14
|
if whitelist.include?('*') || (!valid_for_env?(blacklist, env_name) && valid_for_env?(whitelist, env_name))
|
15
15
|
return true
|
@@ -18,7 +18,7 @@ module WashoutBuilder
|
|
18
18
|
else
|
19
19
|
return true
|
20
20
|
end
|
21
|
-
|
21
|
+
false
|
22
22
|
end
|
23
23
|
|
24
24
|
|
data/lib/washout_builder/soap.rb
CHANGED
@@ -37,8 +37,8 @@ module WashoutBuilder
|
|
37
37
|
current_action = soap_actions[action]
|
38
38
|
base_param_class = WashoutBuilder::Type.base_param_class
|
39
39
|
return if base_param_class.blank?
|
40
|
-
current_action[:builder_in] = base_param_class.
|
41
|
-
current_action[:builder_out] = base_param_class.
|
40
|
+
current_action[:builder_in] = base_param_class.parse_def(soap_config, options[:args])
|
41
|
+
current_action[:builder_out] = base_param_class.parse_def(soap_config, options[:return])
|
42
42
|
current_action[:args_description] = options[:args_description].present? && options[:args_description].is_a?(Hash) ? options[:args_description].stringify_keys : {}
|
43
43
|
current_action
|
44
44
|
end
|
@@ -8,9 +8,9 @@ module WashoutBuilder
|
|
8
8
|
# the module that is used to generate the gem version
|
9
9
|
module VERSION
|
10
10
|
# the major version of the gem
|
11
|
-
MAJOR =
|
11
|
+
MAJOR = 2
|
12
12
|
# the minor version of the gem
|
13
|
-
MINOR =
|
13
|
+
MINOR = 0
|
14
14
|
# the tiny version of the gem
|
15
15
|
TINY = 4
|
16
16
|
# if the version should be a prerelease
|
@@ -11,8 +11,8 @@ describe WashoutBuilder::WashoutBuilderController, type: :controller do
|
|
11
11
|
|
12
12
|
let(:soap_config) do
|
13
13
|
OpenStruct.new(
|
14
|
-
|
15
|
-
|
14
|
+
camelize_wsdl: false,
|
15
|
+
namespace: '/api/wsdl'
|
16
16
|
)
|
17
17
|
end
|
18
18
|
|
@@ -33,7 +33,7 @@ describe WashoutBuilder::WashoutBuilderController, type: :controller do
|
|
33
33
|
it 'renders the template' do
|
34
34
|
get :all
|
35
35
|
expect(subject.instance_variable_get(:@file_to_serve)).to eq('wash_with_html/all_services')
|
36
|
-
expect(response.
|
36
|
+
expect(response.media_type).to eq("text/html")
|
37
37
|
expect(response).to have_http_status(:ok)
|
38
38
|
end
|
39
39
|
|
@@ -52,7 +52,7 @@ describe WashoutBuilder::WashoutBuilderController, type: :controller do
|
|
52
52
|
get :all, params
|
53
53
|
end
|
54
54
|
expect(subject.instance_variable_get(:@file_to_serve)).to eq('wash_with_html/doc')
|
55
|
-
expect(response.
|
55
|
+
expect(response.media_type).to eq("text/html")
|
56
56
|
expect(response).to have_http_status(:ok)
|
57
57
|
end
|
58
58
|
end
|
data/spec/dummy/public/404.html
CHANGED
data/spec/dummy/public/422.html
CHANGED
data/spec/dummy/public/500.html
CHANGED
@@ -4,9 +4,9 @@ require 'spec_helper'
|
|
4
4
|
describe WashoutBuilder::Document::ComplexType do
|
5
5
|
let(:soap_config) do
|
6
6
|
OpenStruct.new(
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
camelize_wsdl: false,
|
8
|
+
namespace: '/api/wsdl',
|
9
|
+
description: 'some description'
|
10
10
|
)
|
11
11
|
end
|
12
12
|
|
@@ -14,33 +14,29 @@ describe WashoutBuilder::Document::ComplexType do
|
|
14
14
|
let(:namespaced_object) { get_wash_out_param(Api::TestType) }
|
15
15
|
|
16
16
|
it 'returns the complex class name' do
|
17
|
-
expect(subject.find_complex_class_name).to eq('
|
17
|
+
expect(subject.find_complex_class_name).to eq('Project')
|
18
18
|
end
|
19
19
|
|
20
|
-
it 'returns the complex class
|
21
|
-
expect(
|
20
|
+
it 'returns the complex class with namespace' do
|
21
|
+
expect(namespaced_object.find_complex_class_name).to eq('Project')
|
22
22
|
end
|
23
23
|
|
24
|
-
it '
|
25
|
-
|
24
|
+
it 'does not return error if classname already detected (only used for hashes) and same structure' do
|
25
|
+
subject.stubs(:classified?).returns(false)
|
26
|
+
subject.stubs(:basic_type).returns('ProjectType')
|
27
|
+
classes_defined = [{ class: 'ProjectType', obj: get_wash_out_param(ProjectType), ancestors: [] }]
|
28
|
+
expect { subject.find_complex_class_name(classes_defined) }.to_not raise_error(RuntimeError, 'Duplicate use of `ProjectType` type name. Consider using classified types.')
|
26
29
|
end
|
27
30
|
|
28
31
|
it 'returns error if classname already detected (only used for hashes)' do
|
29
32
|
subject.stubs(:classified?).returns(false)
|
30
33
|
subject.stubs(:basic_type).returns('ProjectType')
|
31
|
-
|
32
|
-
expect { subject.find_complex_class_name(
|
34
|
+
classes_defined = [{ class: 'ProjectType', obj: get_wash_out_param(Api::TestType), ancestors: [] }]
|
35
|
+
expect { subject.find_complex_class_name(classes_defined) }.to raise_error(RuntimeError, 'Duplicate use of `ProjectType` type name. Consider using classified types.')
|
33
36
|
end
|
34
37
|
|
35
38
|
it 'returns the param structure' do
|
36
|
-
expect(subject.find_param_structure).to eq(
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'fixes the first descendant ' do
|
40
|
-
descendant = get_wash_out_param(ProjectType.wash_out_param_map)
|
41
|
-
subject.fix_descendant_wash_out_type(soap_config, ProjectType)
|
42
|
-
expect(subject.name).to eq(descendant.name)
|
43
|
-
expect(subject.map[0].find_param_structure).to eq(descendant.map[0].find_param_structure)
|
39
|
+
expect(subject.find_param_structure).to eq("description"=>"string", "name"=>"string", "users"=>"struct")
|
44
40
|
end
|
45
41
|
|
46
42
|
it 'same as ancestor' do
|
@@ -79,18 +75,18 @@ describe WashoutBuilder::Document::ComplexType do
|
|
79
75
|
|
80
76
|
describe '#complex_type_descendants' do
|
81
77
|
it 'returns empty array if not struct?' do
|
82
|
-
|
78
|
+
classes_defined = []
|
83
79
|
subject.stubs(:struct?).returns(false)
|
84
|
-
expect(subject.complex_type_descendants(soap_config,
|
80
|
+
expect(subject.complex_type_descendants(soap_config, classes_defined)).to eq(classes_defined)
|
85
81
|
end
|
86
82
|
|
87
83
|
it 'returns the descendants if struct?' do
|
88
|
-
|
84
|
+
classes_defined = []
|
89
85
|
subject.map.each do |obj|
|
90
|
-
obj.expects(:get_nested_complex_types).with(soap_config,
|
86
|
+
obj.expects(:get_nested_complex_types).with(soap_config, classes_defined).returns([obj.name])
|
91
87
|
end
|
92
88
|
subject.stubs(:struct?).returns(true)
|
93
|
-
expect(subject.complex_type_descendants(soap_config,
|
89
|
+
expect(subject.complex_type_descendants(soap_config, classes_defined)).to eq(subject.map.map(&:name))
|
94
90
|
end
|
95
91
|
end
|
96
92
|
|
@@ -101,21 +97,20 @@ describe WashoutBuilder::Document::ComplexType do
|
|
101
97
|
let(:expected) { [complex_type_hash] }
|
102
98
|
|
103
99
|
it 'returns the complex class ancestors' do
|
104
|
-
|
105
|
-
subject.expects(:find_complex_class_name).with(
|
106
|
-
subject.expects(:
|
107
|
-
subject.expects(:complex_type_ancestors).with(soap_config, complex_class,
|
100
|
+
classes_defined = []
|
101
|
+
subject.expects(:find_complex_class_name).with(classes_defined).returns(complex_class)
|
102
|
+
subject.expects(:find_class_from_string).with(complex_class).returns(nil)
|
103
|
+
subject.expects(:complex_type_ancestors).with(soap_config, complex_class, classes_defined).returns(ancestors)
|
108
104
|
subject.expects(:complex_type_hash).with(complex_class, subject, ancestors).returns(complex_type_hash)
|
109
105
|
subject.expects(:complex_type_descendants).with(soap_config, [complex_type_hash]).returns(expected)
|
110
|
-
expect(subject.get_nested_complex_types(soap_config,
|
106
|
+
expect(subject.get_nested_complex_types(soap_config, classes_defined)).to eq(expected)
|
111
107
|
end
|
112
108
|
|
113
109
|
it 'returns the the descendants' do
|
114
|
-
|
110
|
+
classes_defined = nil
|
115
111
|
subject.expects(:find_complex_class_name).with([]).returns(nil)
|
116
|
-
subject.expects(:fix_descendant_wash_out_type).with(soap_config, nil).returns(true)
|
117
112
|
subject.expects(:complex_type_descendants).with(soap_config, []).returns(expected)
|
118
|
-
expect(subject.get_nested_complex_types(soap_config,
|
113
|
+
expect(subject.get_nested_complex_types(soap_config, classes_defined)).to eq(expected)
|
119
114
|
end
|
120
115
|
end
|
121
116
|
|
@@ -139,7 +134,7 @@ describe WashoutBuilder::Document::ComplexType do
|
|
139
134
|
|
140
135
|
describe '#get_class_ancestors' do
|
141
136
|
let(:class_name) { 'ProjectType' }
|
142
|
-
let(:
|
137
|
+
let(:classes_defined) { [] }
|
143
138
|
let(:ancestors) { ['SomeInexistentClass'] }
|
144
139
|
let(:ancestor_structure) { { ancestors[0].to_s.downcase => 'bla' } }
|
145
140
|
let(:top_ancestors) {}
|
@@ -147,7 +142,7 @@ describe WashoutBuilder::Document::ComplexType do
|
|
147
142
|
|
148
143
|
it 'returns nil if no ancestors' do
|
149
144
|
subject.expects(:get_ancestors).with(class_name).returns(nil)
|
150
|
-
expect(subject.get_class_ancestors(soap_config, class_name,
|
145
|
+
expect(subject.get_class_ancestors(soap_config, class_name, classes_defined)).to eq(nil)
|
151
146
|
end
|
152
147
|
|
153
148
|
it 'returns the ancestors and the top ones' do
|
@@ -157,15 +152,16 @@ describe WashoutBuilder::Document::ComplexType do
|
|
157
152
|
WashOut::Param.stubs(:parse_def).returns([namespaced_object])
|
158
153
|
subject.expects(:same_structure_as_ancestor?).with(namespaced_object).returns(false)
|
159
154
|
subject.expects(:complex_type_hash).returns(complex_type_hash)
|
160
|
-
expect(subject.get_class_ancestors(soap_config, class_name,
|
155
|
+
expect(subject.get_class_ancestors(soap_config, class_name, classes_defined)).to eq([complex_type_hash])
|
161
156
|
end
|
162
157
|
|
163
158
|
it 'returns nil if same structure as ancestor' do
|
159
|
+
namespaced_object
|
164
160
|
subject.expects(:get_ancestors).with(class_name).returns(ancestors)
|
165
161
|
subject.expects(:ancestor_structure).with(ancestors).returns(ancestor_structure)
|
166
|
-
WashOut::Param.stubs(:parse_def).returns([namespaced_object])
|
162
|
+
WashOut::Param.stubs(:parse_def).with(soap_config, ancestor_structure).returns([namespaced_object])
|
167
163
|
subject.expects(:same_structure_as_ancestor?).with(namespaced_object).returns(true)
|
168
|
-
expect(subject.get_class_ancestors(soap_config, class_name,
|
164
|
+
expect(subject.get_class_ancestors(soap_config, class_name, classes_defined)).to eq(nil)
|
169
165
|
end
|
170
166
|
end
|
171
167
|
end
|
@@ -20,7 +20,7 @@ describe WashoutBuilder::Document::ExceptionModel do
|
|
20
20
|
|
21
21
|
specify { expect(InheritedExceptionModel.included_modules).to include(WashoutBuilder::Document::SharedComplexType) }
|
22
22
|
|
23
|
-
def
|
23
|
+
def exception_ancestor_hash(subject, structure, ancestors)
|
24
24
|
{ fault: subject, structure: structure, ancestors: ancestors }
|
25
25
|
end
|
26
26
|
|
@@ -48,11 +48,11 @@ describe WashoutBuilder::Document::ExceptionModel do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'fault_ancestor_hash' do
|
51
|
-
expect(subject.fault_ancestor_hash(structure, ancestors)).to eq(
|
51
|
+
expect(subject.fault_ancestor_hash(structure, ancestors)).to eq(exception_ancestor_hash(subject, structure, ancestors))
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'gets the fault_ancestors' do
|
55
|
-
subject.expects(:get_complex_type_ancestors).with(subject,
|
55
|
+
subject.expects(:get_complex_type_ancestors).with(subject, %w(ActiveRecord::Base Object BasicObject Exception)).returns(ancestors)
|
56
56
|
expect(subject.fault_ancestors).to eq ancestors
|
57
57
|
end
|
58
58
|
|
@@ -69,12 +69,12 @@ describe WashoutBuilder::Document::ExceptionModel do
|
|
69
69
|
it 'gets the ancestors' do
|
70
70
|
subject.expects(:fault_ancestors).returns(nil)
|
71
71
|
subject.expects(:find_fault_model_structure).returns(structure)
|
72
|
-
subject.expects(:fault_ancestor_hash).with(structure, []).returns(
|
72
|
+
subject.expects(:fault_ancestor_hash).with(structure, []).returns(exception_ancestor_hash(subject, structure, ancestors))
|
73
73
|
expect(subject.get_fault_class_ancestors([])).to eq(nil)
|
74
74
|
end
|
75
75
|
|
76
76
|
it 'gets the ancestors' do
|
77
|
-
expected_defined =
|
77
|
+
expected_defined = exception_ancestor_hash(subject, structure, ancestors)
|
78
78
|
subject.expects(:fault_ancestors).returns(ancestors)
|
79
79
|
subject.expects(:fault_without_inheritable_elements).with(ancestors).returns(structure)
|
80
80
|
subject.expects(:fault_ancestor_hash).returns(expected_defined)
|
data/spec/spec_helper.rb
CHANGED
@@ -98,11 +98,11 @@ end
|
|
98
98
|
class WashoutBuilderTestError < base_exception
|
99
99
|
end
|
100
100
|
|
101
|
-
def get_wash_out_param(
|
101
|
+
def get_wash_out_param(class_or_struct, soap_config = OpenStruct.new(
|
102
102
|
camelize_wsdl: false,
|
103
103
|
namespace: '/api/wsdl'
|
104
104
|
))
|
105
|
-
WashOut::Param.
|
105
|
+
WashOut::Param.parse_def(soap_config, class_or_struct)[0]
|
106
106
|
end
|
107
107
|
|
108
108
|
class Hash
|
@@ -133,6 +133,16 @@ class Hash
|
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
136
|
+
Builder::XmlBase.class_eval do
|
137
|
+
|
138
|
+
alias_method :old_method_missing, :method_missing
|
139
|
+
|
140
|
+
def method_missing(sym, *args, &block)
|
141
|
+
return if ['inspect'].include?(sym.to_s)
|
142
|
+
old_method_missing(sym, *args, &block)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
136
146
|
unless defined?(silence_stream) # Rails 5
|
137
147
|
def silence_stream(stream)
|
138
148
|
old_stream = stream.dup
|
@@ -144,3 +154,28 @@ unless defined?(silence_stream) # Rails 5
|
|
144
154
|
old_stream.close
|
145
155
|
end
|
146
156
|
end
|
157
|
+
|
158
|
+
# TODO: remove this when wasabi will update their code
|
159
|
+
require 'uri'
|
160
|
+
if !defined?(::URI.unescape)
|
161
|
+
::URI.class_eval do
|
162
|
+
# this was removed in this commit
|
163
|
+
# https://github.com/ruby/uri/commit/61c6a47ebf1f2726b60a2bbd70964d64e14b1f98
|
164
|
+
# so we are adding it back because we need to be compatible with wasabi on ruby 3.0.0
|
165
|
+
module UriEscapeBackport
|
166
|
+
|
167
|
+
def escape(*arg)
|
168
|
+
::URI::DEFAULT_PARSER.escape(*arg)
|
169
|
+
end
|
170
|
+
|
171
|
+
alias encode escape
|
172
|
+
|
173
|
+
def unescape(*arg)
|
174
|
+
::URI::DEFAULT_PARSER.unescape(*arg)
|
175
|
+
end
|
176
|
+
|
177
|
+
alias decode unescape
|
178
|
+
end
|
179
|
+
extend UriEscapeBackport
|
180
|
+
end
|
181
|
+
end
|