Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins: rubocop-performance

AllCops:
TargetRubyVersion: '3.2'
TargetRubyVersion: 3.2
NewCops: enable
Exclude:
- Rakefile
Expand Down
29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,35 @@ index e29acbfc..85622d25 100644
(1/1) Stage this hunk [y,n,q,a,d,e,?]? y
```

## Updating Ruby version requirements

To update the minimum Ruby version requirement across all gems in the repository, use the `bin/update-ruby-version` script:

```console
# Update to Ruby 3.3 minimum
bin/update-ruby-version 3.3

# Supports patch versions and pre-releases
bin/update-ruby-version 3.2.0
bin/update-ruby-version 3.4.0.alpha
```

The script will:

1. Validate the version format
2. Update `spec.required_ruby_version` in all gemspec files
3. Show a summary of changes

After running the script:

1. Review changes with `git diff`
2. Test against the new minimum Ruby version
3. Update CI configurations in `.github/workflows`
4. Update `.rubocop.yml` to set the `TargetRubyVersion`
5. Remove any conditional logic handling Ruby versions in Appraisal files that are no longer needed
6. Remove any conditional logic in test cases that are no longer needed
7. Commit with a message like `chore: update minimum Ruby version to 3.3`

[cncf-cla]: https://identity.linuxfoundation.org/projects/cncf
[github-draft]: https://github.blog/2019-02-14-introducing-draft-pull-requests/
[kube-github-workflow-pr]: https://github.com/kubernetes/community/blob/master/contributors/guide/github-workflow.md#7-create-a-pull-request
Expand Down
88 changes: 88 additions & 0 deletions bin/update-ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# Script to update Ruby version requirements in all gemspecs
# Usage: bin/update-ruby-version [new_version]
# Example: bin/update-ruby-version 3.3

require 'fileutils'
require 'rubygems'

def update_gemspec_ruby_version(file_path, new_version)
content = File.read(file_path)

# Pattern to match existing inline version (supports alpha/beta/pre-release versions)
inline_pattern = /spec\.required_ruby_version = '>= [^']+'/
replacement = "spec.required_ruby_version = '>= #{new_version}'"

updated_content = content.gsub(inline_pattern, replacement)
File.write(file_path, updated_content)
end

def find_gemspecs_with_ruby_requirement
# Find all .gemspec files that contain inline Ruby version requirements
gemspec_files = Dir.glob('**/*.gemspec')

gemspec_files.select do |file|
content = File.read(file)
# Match inline version pattern (supports alpha/beta/pre-release versions)
content.match?(/spec\.required_ruby_version = '>= [^']+/)
end
end

# Main execution
def main
new_version = ARGV[0]

# Check if version parameter is provided
if new_version.nil? || new_version.empty?
puts 'Error: No Ruby version specified.'
puts
puts "Usage: #{$0} <new_ruby_version>"
puts 'Examples:'
puts " #{$0} 3.2"
puts " #{$0} 3.3"
puts " #{$0} 3.1.0"
puts
puts 'The version should be a valid Ruby version number (e.g., 3.2, 3.3, 3.1.0)'
exit 1
end

# Validate version format using Ruby's Gem::Version parser
begin
# Try to parse as a valid gem version (this will raise ArgumentError for malformed versions)
Gem::Version.new(new_version)
rescue ArgumentError => e
puts "Error: Invalid Ruby version format '#{new_version}'"
puts "Details: #{e.message}"
puts
puts 'The version must be a valid Ruby version number like:'
puts ' - 3.2'
puts ' - 3.3'
puts ' - 3.1.0'
puts ' - 3.4.0.alpha'
puts ' - 3.3.0.beta1'
puts
puts "Usage: #{$0} <new_ruby_version>"
exit 1
end

puts "Updating Ruby version requirement to: >= #{new_version}"
puts 'Finding gemspec files...'

gemspec_files = find_gemspecs_with_ruby_requirement
puts "Found #{gemspec_files.length} gemspec files to update:"

gemspec_files.each do |file|
update_gemspec_ruby_version(file, new_version)
puts "Updated: #{file}"
end

puts "\nSummary:"
puts "- Total files found: #{gemspec_files.length}"
puts "- Successfully updated: #{gemspec_files.length}"

puts "\nDone! All gemspecs have been updated to require Ruby >= #{new_version}"
end

main if __FILE__ == $0
1 change: 0 additions & 1 deletion gemspecs/RUBY_REQUIREMENT

This file was deleted.

2 changes: 1 addition & 1 deletion helpers/mysql/opentelemetry-helpers-mysql.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-api', '~> 1.7'
spec.add_dependency 'opentelemetry-common', '~> 0.21'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-common', '~> 0.21'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-common', '~> 0.21'

Expand Down
2 changes: 1 addition & 1 deletion helpers/sql/opentelemetry-helpers-sql.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-api', '~> 1.7'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-active_support', '~> 0.10'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-rack', '~> 0.29'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-active_support', '~> 0.10'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.25'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-active_support', '>= 0.7.0'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.25'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-active_support', '~> 0.10'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.25'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-active_model_serializers', '~> 0.24.0'
spec.add_dependency 'opentelemetry-instrumentation-anthropic', '~> 0.3.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.25'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.25'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.25'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-api', '~> 1.7'
spec.add_dependency 'opentelemetry-common', '~> 0.21'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.25'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.25'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.25'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.25'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.25'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.25'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.25'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-rack', '~> 0.29'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.25'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
spec.homepage = 'https://github.com/open-telemetry/opentelemetry-ruby-contrib'
spec.license = 'Apache-2.0'

spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.25'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = ">= #{File.read(File.expand_path('../../gemspecs/RUBY_REQUIREMENT', __dir__))}"
spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.25'

Expand Down
Loading