Skip to content

Commit 2cee37f

Browse files
committed
feat: Min version Ruby 3.2
Ruby 3.1 is no longer receiving updates as of (31 Mar 2025)
1 parent 1933d4c commit 2cee37f

24 files changed

+139
-22
lines changed

CONTRIBUTING.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,35 @@ For releases to succeed, new gems MUST include the following:
346346
* A `CHANGELOG.md` file.
347347
* A `yard` rake task.
348348

349+
## Updating Ruby version requirements
350+
351+
To update the minimum Ruby version requirement across all gems in the repository, use the `bin/update-ruby-version` script:
352+
353+
```console
354+
# Update to Ruby 3.3 minimum
355+
bin/update-ruby-version 3.3
356+
357+
# Supports patch versions and pre-releases
358+
bin/update-ruby-version 3.2.0
359+
bin/update-ruby-version 3.4.0.alpha
360+
```
361+
362+
The script will:
363+
364+
1. Validate the version format
365+
2. Update `spec.required_ruby_version` in all gemspec files
366+
3. Show a summary of changes
367+
368+
After running the script:
369+
370+
1. Review changes with `git diff`
371+
2. Test against the new minimum Ruby version
372+
3. Update CI configurations in `.github/workflows`
373+
4. Update `contrib/.rubocop.yml` to set the `TargetRubyVersion`
374+
5. Remove any conditional logic handling Ruby versions in Appraisal files that are no longer needed
375+
6. Remove any conditional logic in test cases that are no longer needed
376+
7. Commit with a message like `chore: update minimum Ruby version to 3.3`
377+
349378
[cncf-cla]: https://identity.linuxfoundation.org/projects/cncf
350379
[github-draft]: https://github.blog/2019-02-14-introducing-draft-pull-requests/
351380
[kube-github-workflow-pr]: https://github.com/kubernetes/community/blob/master/contributors/guide/github-workflow.md#7-create-a-pull-request

api/opentelemetry-api.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
2323
::Dir.glob('*.md') +
2424
['LICENSE', '.yardopts']
2525
spec.require_paths = ['lib']
26-
spec.required_ruby_version = '>= 3.1'
26+
spec.required_ruby_version = '>= 3.2'
2727
spec.add_dependency 'logger'
2828

2929
spec.add_development_dependency 'benchmark-ipsa', '~> 0.2.0'

bin/update-ruby-version

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
# Script to update Ruby version requirements in all gemspecs
5+
# Usage: bin/update-ruby-version [new_version]
6+
# Example: bin/update-ruby-version 3.3
7+
8+
require 'fileutils'
9+
require 'rubygems'
10+
11+
def update_gemspec_ruby_version(file_path, new_version)
12+
content = File.read(file_path)
13+
14+
# Pattern to match existing inline version (supports alpha/beta/pre-release versions)
15+
inline_pattern = /spec\.required_ruby_version = '>= [^']+'/
16+
replacement = "spec.required_ruby_version = '>= #{new_version}'"
17+
18+
updated_content = content.gsub(inline_pattern, replacement)
19+
File.write(file_path, updated_content)
20+
end
21+
22+
def find_gemspecs_with_ruby_requirement
23+
# Find all .gemspec files that contain inline Ruby version requirements
24+
gemspec_files = Dir.glob('**/*.gemspec')
25+
26+
gemspec_files.select do |file|
27+
content = File.read(file)
28+
# Match inline version pattern (supports alpha/beta/pre-release versions)
29+
content.match?(/spec\.required_ruby_version = '>= [^']+/)
30+
end
31+
end
32+
33+
# Main execution
34+
def main
35+
new_version = ARGV[0]
36+
37+
# Check if version parameter is provided
38+
if new_version.nil? || new_version.empty?
39+
puts 'Error: No Ruby version specified.'
40+
puts
41+
puts "Usage: #{$0} <new_ruby_version>"
42+
puts 'Examples:'
43+
puts " #{$0} 3.2"
44+
puts " #{$0} 3.3"
45+
puts " #{$0} 3.1.0"
46+
puts
47+
puts 'The version should be a valid Ruby version number (e.g., 3.2, 3.3, 3.1.0)'
48+
exit 1
49+
end
50+
51+
# Validate version format using Ruby's Gem::Version parser
52+
begin
53+
# Try to parse as a valid gem version (this will raise ArgumentError for malformed versions)
54+
Gem::Version.new(new_version)
55+
rescue ArgumentError => e
56+
puts "Error: Invalid Ruby version format '#{new_version}'"
57+
puts "Details: #{e.message}"
58+
puts
59+
puts 'The version must be a valid Ruby version number like:'
60+
puts ' - 3.2'
61+
puts ' - 3.3'
62+
puts ' - 3.1.0'
63+
puts ' - 3.4.0.alpha'
64+
puts ' - 3.3.0.beta1'
65+
puts
66+
puts "Usage: #{$0} <new_ruby_version>"
67+
exit 1
68+
end
69+
70+
puts "Updating Ruby version requirement to: >= #{new_version}"
71+
puts 'Finding gemspec files...'
72+
73+
gemspec_files = find_gemspecs_with_ruby_requirement
74+
puts "Found #{gemspec_files.length} gemspec files to update:"
75+
76+
gemspec_files.each do |file|
77+
update_gemspec_ruby_version(file, new_version)
78+
puts "Updated: #{file}"
79+
end
80+
81+
puts "\nSummary:"
82+
puts "- Total files found: #{gemspec_files.length}"
83+
puts "- Successfully updated: #{gemspec_files.length}"
84+
85+
puts "\nDone! All gemspecs have been updated to require Ruby >= #{new_version}"
86+
end
87+
88+
main if __FILE__ == $0

common/opentelemetry-common.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
2323
::Dir.glob('*.md') +
2424
['LICENSE', '.yardopts']
2525
spec.require_paths = ['lib']
26-
spec.required_ruby_version = '>= 3.1'
26+
spec.required_ruby_version = '>= 3.2'
2727

2828
spec.add_dependency 'opentelemetry-api', '~> 1.0'
2929

contrib/rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins:
77
AllCops:
88
NewCops: disable
99
SuggestExtensions: false
10-
TargetRubyVersion: "3.1"
10+
TargetRubyVersion: "3.2"
1111
Exclude:
1212
- "vendor/**/*"
1313

exporter/jaeger/opentelemetry-exporter-jaeger.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
2424
::Dir.glob('*.md') +
2525
['LICENSE', '.yardopts']
2626
spec.require_paths = ['lib']
27-
spec.required_ruby_version = '>= 3.1'
27+
spec.required_ruby_version = '>= 3.2'
2828

2929
spec.add_dependency 'base64', '>= 0.2.0'
3030
spec.add_dependency 'opentelemetry-api', '~> 1.1'

exporter/otlp-common/opentelemetry-exporter-otlp-common.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
2323
::Dir.glob('*.md') +
2424
['LICENSE', '.yardopts']
2525
spec.require_paths = ['lib']
26-
spec.required_ruby_version = '>= 3.1'
26+
spec.required_ruby_version = '>= 3.2'
2727

2828
spec.add_dependency 'googleapis-common-protos-types', '~> 1.3'
2929
spec.add_dependency 'google-protobuf', '~> 3.19'

exporter/otlp-grpc/opentelemetry-exporter-otlp-grpc.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
2323
::Dir.glob('*.md') +
2424
['LICENSE', '.yardopts']
2525
spec.require_paths = ['lib']
26-
spec.required_ruby_version = '>= 3.1'
26+
spec.required_ruby_version = '>= 3.2'
2727

2828
spec.add_dependency 'grpc'
2929
spec.add_dependency 'opentelemetry-api', '~> 1.1'

exporter/otlp-http/opentelemetry-exporter-otlp-http.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
2323
::Dir.glob('*.md') +
2424
['LICENSE', '.yardopts']
2525
spec.require_paths = ['lib']
26-
spec.required_ruby_version = '>= 3.1'
26+
spec.required_ruby_version = '>= 3.2'
2727

2828
spec.add_dependency 'opentelemetry-api', '~> 1.1'
2929
spec.add_dependency 'opentelemetry-common', '~> 0.20'

exporter/otlp-logs/opentelemetry-exporter-otlp-logs.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
2323
::Dir.glob('*.md') +
2424
['LICENSE', '.yardopts']
2525
spec.require_paths = ['lib']
26-
spec.required_ruby_version = '>= 3.1'
26+
spec.required_ruby_version = '>= 3.2'
2727

2828
spec.add_dependency 'googleapis-common-protos-types', '~> 1.3'
2929
spec.add_dependency 'google-protobuf', '>= 3.18'

0 commit comments

Comments
 (0)