-
Notifications
You must be signed in to change notification settings - Fork 599
/
Envfile
47 lines (40 loc) · 1.32 KB
/
Envfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
suite_condition("http.rb is only supported for versions >= 2.0.0") do
RUBY_VERSION >= '2.0.0'
end
instrumentation_methods :chain, :prepend
unless RUBY_PLATFORM == 'java'
gemfile <<-RB
gem 'http' # latest version
gem 'public_suffix', '< 3.0.0' if RUBY_VERSION < "2.1.0"
gem 'rack'
#{ruby3_gem_webrick}
RB
end
# NOTE, some versions of HTTP gem implements body with
# String.new("").force_encoding(@encoding) which won't work
# with Ruby 2.7 and it's automatic freezing of string literals.
# Those versions are capped at Ruby 2.6
# Either just the gem version or Array of gem version and last and supported Ruby versions
HTTPRB_VERSIONS = [
['5.0.1', 2.5],
['4.4.0', 2.3, 2.6],
['4.3.0', 2.3, 2.6],
['4.2.0', 2.3, 2.6],
'3.0.0',
'2.2.2'
]
HTTPRB_VERSIONS.each do |httprb_version|
if httprb_version.is_a?(Array)
httprb_version, first_supported_ruby_version, last_supported_ruby_version = httprb_version
next if httprb_version =~ /^5.0/ && RUBY_PLATFORM == 'java'
next if last_supported_ruby_version && RUBY_VERSION.to_f > last_supported_ruby_version
next if RUBY_VERSION.to_f < first_supported_ruby_version
end
gemfile <<-RB
gem 'http', '~> #{httprb_version}'
gem 'public_suffix', '< 3.0.0' if RUBY_VERSION < "2.1.0"
gem 'rack'
#{ruby3_gem_webrick}
RB
end
# vim: ft=ruby