зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] bundler/lib/bundler/installer.rb - fix Windows 'executable_stubs'
Windows normal shell requires binstubs with *.cmd extensions https://github.com/rubygems/rubygems/commit/b46326eb1f
This commit is contained in:
Родитель
48ba9b6106
Коммит
f3ad8a00e2
|
@ -135,12 +135,17 @@ module Bundler
|
|||
next
|
||||
end
|
||||
|
||||
File.open(binstub_path, "w", 0o777 & ~File.umask) do |f|
|
||||
if RUBY_VERSION >= "2.6"
|
||||
f.puts ERB.new(template, :trim_mode => "-").result(binding)
|
||||
else
|
||||
f.puts ERB.new(template, nil, "-").result(binding)
|
||||
end
|
||||
mode = Bundler::WINDOWS ? "wb:UTF-8" : "w"
|
||||
content = if RUBY_VERSION >= "2.6"
|
||||
ERB.new(template, :trim_mode => "-").result(binding)
|
||||
else
|
||||
ERB.new(template, nil, "-").result(binding)
|
||||
end
|
||||
|
||||
File.write(binstub_path, content, :mode => mode, :perm => 0o777 & ~File.umask)
|
||||
if Bundler::WINDOWS
|
||||
prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n"
|
||||
File.write("#{binstub_path}.cmd", prefix + content, :mode => mode)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -175,12 +180,18 @@ module Bundler
|
|||
next if executable == "bundle"
|
||||
executable_path = Pathname(spec.full_gem_path).join(spec.bindir, executable).relative_path_from(bin_path)
|
||||
executable_path = executable_path
|
||||
File.open "#{bin_path}/#{executable}", "w", 0o755 do |f|
|
||||
if RUBY_VERSION >= "2.6"
|
||||
f.puts ERB.new(template, :trim_mode => "-").result(binding)
|
||||
else
|
||||
f.puts ERB.new(template, nil, "-").result(binding)
|
||||
end
|
||||
|
||||
mode = Bundler::WINDOWS ? "wb:UTF-8" : "w"
|
||||
content = if RUBY_VERSION >= "2.6"
|
||||
ERB.new(template, :trim_mode => "-").result(binding)
|
||||
else
|
||||
ERB.new(template, nil, "-").result(binding)
|
||||
end
|
||||
|
||||
File.write("#{bin_path}/#{executable}", content, :mode => mode, :perm => 0o755)
|
||||
if Bundler::WINDOWS
|
||||
prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n"
|
||||
File.write("#{bin_path}/#{executable}.cmd", prefix + content, :mode => mode)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче