10000 Backport https://github.com/ruby/ruby/pull/9673 for Ruby 3.3 by hsbt · Pull Request #10350 · ruby/ruby · GitHub
[go: up one dir, main page]

Skip to content

Backport https://github.com/ruby/ruby/pull/9673 for Ruby 3.3 #10350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 28, 2024
Prev Previous commit
Next Next commit
Consistently put requirable features in default gemspecs file list
  • Loading branch information
deivid-rodriguez authored and hsbt committed Apr 30, 2024
commit a166a86699e719011b9b302d38cc18bf64ba018d
20 changes: 10 additions & 10 deletions tool/rbinstall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -745,24 +745,24 @@ def initialize(gemspec, srcdir, relative_base)
end

def collect
libraries.sort
requirable_features.sort
end

class Ext < self
def libraries
def requirable_features
# install ext only when it's configured
return [] unless File.exist?(makefile_path)

ruby_libraries + ext_libraries
ruby_features + ext_features
end

private

def ruby_libraries
def ruby_features
Dir.glob("**/*.rb", base: "#{makefile_dir}/lib")
end

def ext_libraries
def ext_features
makefile = File.read(makefile_path)

name = makefile[/^TARGET[ \t]*=[ \t]*((?:.*\\\n)*.*)/, 1]
Expand All @@ -782,24 +782,24 @@ def makefile_dir
end

class Lib < self
def libraries
def requirable_features
gemname = File.basename(gemspec, ".gemspec")
base = relative_base || gemname
# for lib/net/net-smtp.gemspec
if m = /.*(?=-(.*)\z)/.match(gemname)
base = File.join(base, *m.to_a.select {|n| !base.include?(n)})
end
files = Dir.glob("lib/#{base}{.rb,/**/*.rb}", base: srcdir)
files = Dir.glob("#{base}{.rb,/**/*.rb}", base: "#{srcdir}/lib")
if !relative_base and files.empty? # no files at the toplevel
# pseudo gem like ruby2_keywords
files << "lib/#{gemname}.rb"
files << "#{gemname}.rb"
end

case gemname
when "net-http"
files << "lib/net/https.rb"
files << "net/https.rb"
when "optparse"
files << "lib/optionparser.rb"
files << "optionparser.rb"
end

files
Expand Down
0