Consistently put requirable features in default gemspecs file list
This commit is contained in:
parent
bece07e6c3
commit
2b703eed46
@ -549,24 +549,24 @@ module RbInstall
|
|||||||
end
|
end
|
||||||
|
|
||||||
def collect
|
def collect
|
||||||
libraries.sort
|
requirable_features.sort
|
||||||
end
|
end
|
||||||
|
|
||||||
class Ext < self
|
class Ext < self
|
||||||
def libraries
|
def requirable_features
|
||||||
# install ext only when it's configured
|
# install ext only when it's configured
|
||||||
return [] unless File.exist?(makefile_path)
|
return [] unless File.exist?(makefile_path)
|
||||||
|
|
||||||
ruby_libraries + ext_libraries
|
ruby_features + ext_features
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def ruby_libraries
|
def ruby_features
|
||||||
Dir.glob("**/*.rb", base: "#{makefile_dir}/lib")
|
Dir.glob("**/*.rb", base: "#{makefile_dir}/lib")
|
||||||
end
|
end
|
||||||
|
|
||||||
def ext_libraries
|
def ext_features
|
||||||
makefile = File.read(makefile_path)
|
makefile = File.read(makefile_path)
|
||||||
|
|
||||||
name = makefile[/^TARGET[ \t]*=[ \t]*((?:.*\\\n)*.*)/, 1]
|
name = makefile[/^TARGET[ \t]*=[ \t]*((?:.*\\\n)*.*)/, 1]
|
||||||
@ -586,24 +586,24 @@ module RbInstall
|
|||||||
end
|
end
|
||||||
|
|
||||||
class Lib < self
|
class Lib < self
|
||||||
def libraries
|
def requirable_features
|
||||||
gemname = File.basename(gemspec, ".gemspec")
|
gemname = File.basename(gemspec, ".gemspec")
|
||||||
base = relative_base || gemname
|
base = relative_base || gemname
|
||||||
# for lib/net/net-smtp.gemspec
|
# for lib/net/net-smtp.gemspec
|
||||||
if m = /.*(?=-(.*)\z)/.match(gemname)
|
if m = /.*(?=-(.*)\z)/.match(gemname)
|
||||||
base = File.join(base, *m.to_a.select {|n| !base.include?(n)})
|
base = File.join(base, *m.to_a.select {|n| !base.include?(n)})
|
||||||
end
|
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
|
if !relative_base and files.empty? # no files at the toplevel
|
||||||
# pseudo gem like ruby2_keywords
|
# pseudo gem like ruby2_keywords
|
||||||
files << "lib/#{gemname}.rb"
|
files << "#{gemname}.rb"
|
||||||
end
|
end
|
||||||
|
|
||||||
case gemname
|
case gemname
|
||||||
when "net-http"
|
when "net-http"
|
||||||
files << "lib/net/https.rb"
|
files << "net/https.rb"
|
||||||
when "optparse"
|
when "optparse"
|
||||||
files << "lib/optionparser.rb"
|
files << "optionparser.rb"
|
||||||
end
|
end
|
||||||
|
|
||||||
files
|
files
|
||||||
|
Loading…
x
Reference in New Issue
Block a user