Skip to content

Instantly share code, notes, and snippets.

@keiya
Created August 14, 2023 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keiya/1f2ec624a7e5f775283ad28b4a270c4d to your computer and use it in GitHub Desktop.
Save keiya/1f2ec624a7e5f775283ad28b4a270c4d to your computer and use it in GitHub Desktop.
This Ruby script lists all gems in the current project that contain native extensions. This is useful for diagnosing extension-related issues and assessing project compatibility across different environments.
# typed: false
require 'bundler'
gems = Bundler.load.specs.map(&:name)
extensions = gems.map do |gem|
spec = Gem::Specification.find_by_name(gem)
{ name: gem, extensions: spec.extensions }
end
extensions.each do |extension|
if extension[:extensions].any?
p extension
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment