Sha256: c302407b2da484b20f7e55a3c7343796cf137d39f018dded5fd906df91ba9068
Contents?: true
Size: 999 Bytes
Versions: 6
Compression:
Stored size: 999 Bytes
Contents
require 'fileutils' require 'pathname' os_file_path = 'rubygems/defaults/operating_system.rb' def registration_snippet(file_path) relative_paths = <%= paths %>.map do |p| Pathname.new(p).relative_path_from(Pathname.new(file_path)).to_s end <<EOF Gem.pre_install do |gem_installer| unless gem_installer.spec.extensions.empty? tool_paths = #{relative_paths}.map do |p| File.expand_path(p, __FILE__).gsub(File::SEPARATOR, File::ALT_SEPARATOR) end tool_path = tool_paths.join(File::PATH_SEPARATOR) unless ENV['PATH'].include?(tool_path) Gem.ui.say("Adding native build tools to path: " + tool_path) if Gem.configuration.verbose ENV['PATH'] = [tool_path, ENV['PATH']].join(File::PATH_SEPARATOR) end end end EOF end ['rubylibdir', 'sitelibdir'].each do |rubygems_path| file_path = File.join(RbConfig::CONFIG[rubygems_path], os_file_path) FileUtils.mkdir_p(File.dirname(file_path)) File.open(file_path, 'w') do |file| file.write(registration_snippet(file_path)) end end
Version data entries
6 entries across 6 versions & 1 rubygems