Skip to content

Commit f253c5b

Browse files
committed
(PUP-11718) Remove conditionals for old Rubies
Puppet 8 will have a minimum version of Ruby 3.1.0. This commit removes conditional code to check for versions of Ruby less than 3.1.0.
1 parent 026b89a commit f253c5b

File tree

4 files changed

+6
-33
lines changed

4 files changed

+6
-33
lines changed

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ group(:test) do
4242
gem "rspec", "~> 3.1", require: false
4343
gem "rspec-expectations", ["~> 3.9", "!= 3.9.3"]
4444
gem "rspec-its", "~> 1.1", require: false
45-
gem 'vcr', RUBY_VERSION.to_f >= 3.2 ? '~> 6.1' : '~> 5.0', require: false
45+
gem 'vcr', '~> 6.1', require: false
4646
gem 'webmock', '~> 3.0', require: false
47-
gem 'webrick', '~> 1.7', require: false if RUBY_VERSION.to_f >= 3.0
47+
gem 'webrick', '~> 1.7', require: false
4848
gem 'yard', require: false
4949

5050
gem 'rubocop', '1.28.0', require: false, platforms: [:ruby]

lib/puppet/util.rb

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,10 @@ def default_env
3434
end
3535
module_function :default_env
3636

37-
if RUBY_VERSION >= "2.6"
38-
def create_erb(content)
39-
ERB.new(content, trim_mode: '-')
40-
end
41-
else
42-
def create_erb(content)
43-
ERB.new(content, 0, '-')
44-
end
37+
def create_erb(content)
38+
ERB.new(content, trim_mode: '-')
4539
end
40+
4641
module_function :create_erb
4742

4843
# @param name [String] The name of the environment variable to retrieve

lib/puppet/util/monkey_patches.rb

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,6 @@ def daemonize
2929
end
3030
end
3131

32-
if RUBY_VERSION.to_f < 3.0
33-
# absolute/relative were optimized to avoid chop_basename in ruby 3
34-
# see https://github.com/ruby/ruby/commit/39312cf4d6c2ab3f07d688ad1a467c8f84b58db0
35-
require 'pathname'
36-
class Pathname
37-
if File.dirname('A:') == 'A:.' # DOSish drive letter
38-
ABSOLUTE_PATH = /\A(?:[A-Za-z]:|#{SEPARATOR_PAT})/o
39-
else
40-
ABSOLUTE_PATH = /\A#{SEPARATOR_PAT}/o
41-
end
42-
private_constant :ABSOLUTE_PATH
43-
44-
def absolute?
45-
ABSOLUTE_PATH.match? @path
46-
end
47-
48-
def relative?
49-
!absolute?
50-
end
51-
end
52-
end
53-
5432
# (#19151) Reject all SSLv2 ciphers and handshakes
5533
require_relative '../../puppet/ssl/openssl_loader'
5634
unless Puppet::Util::Platform.jruby_fips?

spec/unit/http/factory_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def create_connection(site)
140140
end
141141

142142
context 'tls' do
143-
it "sets the minimum version to TLS 1.0", if: RUBY_VERSION.to_f >= 2.5 do
143+
it "sets the minimum version to TLS 1.0" do
144144
conn = create_connection(site)
145145
expect(conn.min_version).to eq(OpenSSL::SSL::TLS1_VERSION)
146146
end

0 commit comments

Comments
 (0)