Skip to content

Commit

Permalink
update script
Browse files Browse the repository at this point in the history
  • Loading branch information
quinna-h committed Jan 15, 2025
1 parent e458643 commit db71f90
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
22 changes: 2 additions & 20 deletions .github/scripts/find_gem_version_bounds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,13 @@ def parse_gemfiles(directory = 'gemfiles/')
runtime = File.basename(gemfile_name).split('_').first # ruby or jruby
next unless %w[ruby jruby].include?(runtime)
# parse the gemfile
if gemfile_name.end_with?(".gemfile")
process_gemfile(gemfile_name, runtime)
elsif gemfile_name.end_with?('.gemfile.lock')
if gemfile_name.end_with?('.gemfile.lock')
process_lockfile(gemfile_name, runtime)
end
end

end

def process_gemfile(gemfile_name, runtime)
begin
definition = Bundler::Definition.build(gemfile_name, nil, nil)
definition.dependencies.each do |dependency|
gem_name = dependency.name
version = dependency.requirement.to_s
unspecified = version.strip == '' || version == ">= 0"
update_gem_versions(runtime, gem_name, version, unspecified)
end
rescue Bundler::GemfileError => e
puts "Error reading Gemfile: #{e.message}"
end
end

def process_lockfile(gemfile_name, runtime)
lockfile_contents = File.read(gemfile_name)
parser = Bundler::LockfileParser.new(lockfile_contents)
Expand Down Expand Up @@ -98,6 +82,7 @@ def version_valid?(version, unspecified)
Gem::Version.new(version)
true
rescue ArgumentError
puts "#{version} is invalid format."
false
end

Expand Down Expand Up @@ -148,9 +133,6 @@ def resolve_integration_name(integration)

def write_output
@integration_json_mapping = @integration_json_mapping.sort.to_h
@integration_json_mapping.each do |integration, versions|
versions.map! { |v| v == Float::INFINITY ? 'infinity' : v }
end
File.write("gem_output.json", JSON.pretty_generate(@integration_json_mapping))
end
end
Expand Down
4 changes: 0 additions & 4 deletions .github/scripts/generate_table_versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
separator = "|-------------|----------|-----------|----------|----------|\n"
rows = data.map do |integration_name, versions|
ruby_min, ruby_max, jruby_min, jruby_max = versions.map do |v|
if v == "infinity"
"latest"
else
v || "None"
end
end
"| #{integration_name} | #{ruby_min} | #{ruby_max} | #{jruby_min} | #{jruby_max} |"
end
Expand Down

0 comments on commit db71f90

Please sign in to comment.