Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
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
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'
spec.add_dependency 'opentelemetry-logs-api', '~> 0.1'
Expand Down
Loading