diff options
Diffstat (limited to 'lib/rubygems/ext')
-rw-r--r-- | lib/rubygems/ext/build_error.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/ext/builder.rb | 32 | ||||
-rw-r--r-- | lib/rubygems/ext/cargo_builder.rb | 14 | ||||
-rw-r--r-- | lib/rubygems/ext/cmake_builder.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/ext/configure_builder.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/ext/ext_conf_builder.rb | 12 | ||||
-rw-r--r-- | lib/rubygems/ext/rake_builder.rb | 6 |
7 files changed, 36 insertions, 36 deletions
diff --git a/lib/rubygems/ext/build_error.rb b/lib/rubygems/ext/build_error.rb index 8ef57ed91a..727bc065c2 100644 --- a/lib/rubygems/ext/build_error.rb +++ b/lib/rubygems/ext/build_error.rb @@ -2,7 +2,7 @@ ## # Raised when there is an error while building extensions. -require_relative '../exceptions' +require_relative "../exceptions" class Gem::Ext::BuildError < Gem::InstallError end diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb index 99dd2c162c..c5a03806b9 100644 --- a/lib/rubygems/ext/builder.rb +++ b/lib/rubygems/ext/builder.rb @@ -5,7 +5,7 @@ # See LICENSE.txt for permissions. #++ -require_relative '../user_interaction' +require_relative "../user_interaction" class Gem::Ext::Builder include Gem::UserInteraction @@ -18,29 +18,29 @@ class Gem::Ext::Builder end def self.make(dest_path, results, make_dir = Dir.pwd, sitedir = nil) - unless File.exist? File.join(make_dir, 'Makefile') - raise Gem::InstallError, 'Makefile not found' + unless File.exist? File.join(make_dir, "Makefile") + raise Gem::InstallError, "Makefile not found" end # try to find make program from Ruby configure arguments first - RbConfig::CONFIG['configure_args'] =~ /with-make-prog\=(\w+)/ - make_program_name = ENV['MAKE'] || ENV['make'] || $1 + RbConfig::CONFIG["configure_args"] =~ /with-make-prog\=(\w+)/ + make_program_name = ENV["MAKE"] || ENV["make"] || $1 unless make_program_name - make_program_name = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make' + make_program_name = (/mswin/ =~ RUBY_PLATFORM) ? "nmake" : "make" end make_program = Shellwords.split(make_program_name) # The installation of the bundled gems is failed when DESTDIR is empty in mswin platform. - destdir = (/\bnmake/i !~ make_program_name || ENV['DESTDIR'] && ENV['DESTDIR'] != "") ? 'DESTDIR=%s' % ENV['DESTDIR'] : '' + destdir = (/\bnmake/i !~ make_program_name || ENV["DESTDIR"] && ENV["DESTDIR"] != "") ? "DESTDIR=%s" % ENV["DESTDIR"] : "" env = [destdir] if sitedir - env << 'sitearchdir=%s' % sitedir - env << 'sitelibdir=%s' % sitedir + env << "sitearchdir=%s" % sitedir + env << "sitelibdir=%s" % sitedir end - ['clean', '', 'install'].each do |target| + ["clean", "", "install"].each do |target| # Pass DESTDIR via command line to override what's in MAKEFLAGS cmd = [ *make_program, @@ -50,7 +50,7 @@ class Gem::Ext::Builder begin run(cmd, results, "make #{target}".rstrip, make_dir) rescue Gem::InstallError - raise unless target == 'clean' # ignore clean failure + raise unless target == "clean" # ignore clean failure end end end @@ -59,7 +59,7 @@ class Gem::Ext::Builder verbose = Gem.configuration.really_verbose begin - rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], nil + rubygems_gemdeps, ENV["RUBYGEMS_GEMDEPS"] = ENV["RUBYGEMS_GEMDEPS"], nil if verbose puts("current directory: #{dir}") p(command) @@ -70,7 +70,7 @@ class Gem::Ext::Builder require "open3" # Set $SOURCE_DATE_EPOCH for the subprocess. - build_env = { 'SOURCE_DATE_EPOCH' => Gem.source_date_epoch_string }.merge(env) + build_env = { "SOURCE_DATE_EPOCH" => Gem.source_date_epoch_string }.merge(env) output, status = begin Open3.capture2e(build_env, *command, :chdir => dir) rescue => error @@ -82,7 +82,7 @@ class Gem::Ext::Builder results << output end ensure - ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps + ENV["RUBYGEMS_GEMDEPS"] = rubygems_gemdeps end unless status.success? @@ -212,11 +212,11 @@ EOF # Writes +output+ to gem_make.out in the extension install directory. def write_gem_make_out(output) # :nodoc: - destination = File.join @spec.extension_dir, 'gem_make.out' + destination = File.join @spec.extension_dir, "gem_make.out" FileUtils.mkdir_p @spec.extension_dir - File.open destination, 'wb' do |io| + File.open destination, "wb" do |io| io.puts output end diff --git a/lib/rubygems/ext/cargo_builder.rb b/lib/rubygems/ext/cargo_builder.rb index 232c0a313d..e33b07a8a2 100644 --- a/lib/rubygems/ext/cargo_builder.rb +++ b/lib/rubygems/ext/cargo_builder.rb @@ -29,14 +29,14 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder def build_crate(dest_path, results, args, cargo_dir) env = build_env cmd = cargo_command(cargo_dir, dest_path, args) - runner.call cmd, results, 'cargo', cargo_dir, env + runner.call cmd, results, "cargo", cargo_dir, env results end def build_env build_env = rb_config_env - build_env["RUBY_STATIC"] = "true" if ruby_static? && ENV.key?('RUBY_STATIC') + build_env["RUBY_STATIC"] = "true" if ruby_static? && ENV.key?("RUBY_STATIC") build_env end @@ -46,7 +46,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder cmd = [] cmd += [cargo, "rustc"] - cmd += ["--target", ENV['CARGO_BUILD_TARGET']] if ENV['CARGO_BUILD_TARGET'] + cmd += ["--target", ENV["CARGO_BUILD_TARGET"]] if ENV["CARGO_BUILD_TARGET"] cmd += ["--target-dir", dest_path] cmd += ["--manifest-path", manifest] cmd += ["--lib"] @@ -144,13 +144,13 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder def cargo_dylib_path(dest_path) prefix = so_ext == "dll" ? "" : "lib" path_parts = [dest_path] - path_parts << ENV['CARGO_BUILD_TARGET'] if ENV['CARGO_BUILD_TARGET'] + path_parts << ENV["CARGO_BUILD_TARGET"] if ENV["CARGO_BUILD_TARGET"] path_parts += [profile_target_directory, "#{prefix}#{cargo_crate_name}.#{so_ext}"] File.join(*path_parts) end def cargo_crate_name - spec.metadata.fetch('cargo_crate_name', spec.name).tr('-', '_') + spec.metadata.fetch("cargo_crate_name", spec.name).tr("-", "_") end def rustc_dynamic_linker_flags(dest_dir) @@ -297,8 +297,8 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder def profile_target_directory case profile - when :release then 'release' - when :dev then 'debug' + when :release then "release" + when :dev then "debug" else raise "unknown target directory for profile: #{profile}" end end diff --git a/lib/rubygems/ext/cmake_builder.rb b/lib/rubygems/ext/cmake_builder.rb index e47cabef84..b162664784 100644 --- a/lib/rubygems/ext/cmake_builder.rb +++ b/lib/rubygems/ext/cmake_builder.rb @@ -2,8 +2,8 @@ class Gem::Ext::CmakeBuilder < Gem::Ext::Builder def self.build(extension, dest_path, results, args=[], lib_dir=nil, cmake_dir=Dir.pwd) - unless File.exist?(File.join(cmake_dir, 'Makefile')) - require_relative '../command' + unless File.exist?(File.join(cmake_dir, "Makefile")) + require_relative "../command" cmd = ["cmake", ".", "-DCMAKE_INSTALL_PREFIX=#{dest_path}", *Gem::Command.build_args] run cmd, results, class_name, cmake_dir diff --git a/lib/rubygems/ext/configure_builder.rb b/lib/rubygems/ext/configure_builder.rb index eb2f9fce61..51106c6370 100644 --- a/lib/rubygems/ext/configure_builder.rb +++ b/lib/rubygems/ext/configure_builder.rb @@ -7,7 +7,7 @@ class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder def self.build(extension, dest_path, results, args=[], lib_dir=nil, configure_dir=Dir.pwd) - unless File.exist?(File.join(configure_dir, 'Makefile')) + unless File.exist?(File.join(configure_dir, "Makefile")) cmd = ["sh", "./configure", "--prefix=#{dest_path}", *args] run cmd, results, class_name, configure_dir diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb index 2f0183fe2f..f8920596d5 100644 --- a/lib/rubygems/ext/ext_conf_builder.rb +++ b/lib/rubygems/ext/ext_conf_builder.rb @@ -7,8 +7,8 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder def self.build(extension, dest_path, results, args=[], lib_dir=nil, extension_dir=Dir.pwd) - require 'fileutils' - require 'tempfile' + require "fileutils" + require "tempfile" tmp_dest = Dir.mktmpdir(".gem.", extension_dir) @@ -22,16 +22,16 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder begin require "shellwords" - cmd = Gem.ruby.shellsplit << "-I" << File.expand_path('../..', __dir__) << File.basename(extension) + cmd = Gem.ruby.shellsplit << "-I" << File.expand_path("../..", __dir__) << File.basename(extension) cmd.push(*args) run(cmd, results, class_name, extension_dir) do |s, r| - mkmf_log = File.join(extension_dir, 'mkmf.log') + mkmf_log = File.join(extension_dir, "mkmf.log") if File.exist? mkmf_log unless s.success? r << "To see why this extension failed to compile, please check" \ " the mkmf.log which can be found here:\n" - r << " " + File.join(dest_path, 'mkmf.log') + "\n" + r << " " + File.join(dest_path, "mkmf.log") + "\n" end FileUtils.mv mkmf_log, dest_path end @@ -67,7 +67,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder private def self.get_relative_path(path, base) - path[0..base.length - 1] = '.' if path.start_with?(base) + path[0..base.length - 1] = "." if path.start_with?(base) path end end diff --git a/lib/rubygems/ext/rake_builder.rb b/lib/rubygems/ext/rake_builder.rb index fed98e741c..9f2e099d40 100644 --- a/lib/rubygems/ext/rake_builder.rb +++ b/lib/rubygems/ext/rake_builder.rb @@ -11,16 +11,16 @@ class Gem::Ext::RakeBuilder < Gem::Ext::Builder run([Gem.ruby, File.basename(extension), *args], results, class_name, extension_dir) end - rake = ENV['rake'] + rake = ENV["rake"] if rake require "shellwords" rake = rake.shellsplit else begin - rake = [Gem.ruby, "-I#{File.expand_path("../..", __dir__)}", "-rrubygems", Gem.bin_path('rake', 'rake')] + rake = [Gem.ruby, "-I#{File.expand_path("../..", __dir__)}", "-rrubygems", Gem.bin_path("rake", "rake")] rescue Gem::Exception - rake = [Gem.default_exec_format % 'rake'] + rake = [Gem.default_exec_format % "rake"] end end |