Hello List,
The current and beta versions of RubyGems suffer from a location
specific problem:
Installing RubyGems (ruby setup.rb install) will mark the .cmd to a
specific path (Gem.ruby) which will brake if user move the folder
around (or during creation of installer like One-Click installer).
Also, installing gems create stubs that call the same ruby executable
(Gem.ruby) and the script "without path", which is broken (since it
will try to locate "script" in the current directory).
http://pastie.caboo.se/107250
This patch provides a "naive" solution to the problem, using the ruby
installation where the stub is located, and also using the
extension-less ruby script.
As shown in the stub script, there is a door open to provide a
workaround for win9x, but I didn't (since I commented on previous
post: lack the installation to try it).
Later,
--
Luis Lavena
Multimedia systems
-
Leaders are made, they are not born. They are made by hard effort,
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi
Index: lib/rubygems/installer.rb
===================================================================
--- lib/rubygems/installer.rb (revision 1458)
+++ lib/rubygems/installer.rb (working copy)
@@ -186,7 +186,7 @@
if Gem.win_platform? then
script_name = filename + ".cmd"
File.open(File.join(bindir, File.basename(script_name)), "w") do |file|
- file.puts "@#{Gem.ruby} \"#{File.join(bindir,filename)}\" %*"
+ file.puts windows_stub_script
end
end
end
@@ -305,6 +305,19 @@
TEXT
end
+ # Return the windows stub script
+ def windows_stub_script
+ <<-TEXT
[EMAIL PROTECTED] OFF
+IF NOT "%~f0" == "~f0" GOTO :WinNT
+:WinNT
+SET RUBYSCRIPT=%~f0
+SET RUBYSCRIPT=%RUBYSCRIPT:.cmd=%
+"%~d0%~p0ruby.exe" "%RUBYSCRIPT%" %*
+SET RUBYSCRIPT=
+TEXT
+ end
+
def build_extensions
return if @spec.extensions.empty?
say "Building native extensions. This could take a while..."
Index: setup.rb
===================================================================
--- setup.rb (revision 1458)
+++ setup.rb (working copy)
@@ -90,7 +90,15 @@
bin_cmd_file = File.join Dir.tmpdir, "#{bin_file}.cmd"
File.open bin_cmd_file, 'w' do |file|
- file.puts %{@"#{Gem.ruby}" "#{bin_file}" %1 %2 %3 %4 %5 %6 %7 %8 %9}
+ file.puts <<-TEXT
[EMAIL PROTECTED] OFF
+IF NOT "%~f0" == "~f0" GOTO :WinNT
+:WinNT
+SET RUBYSCRIPT=%~f0
+SET RUBYSCRIPT=%RUBYSCRIPT:.cmd=%
+"%~d0%~p0ruby.exe" "%RUBYSCRIPT%" %*
+SET RUBYSCRIPT=
+TEXT
end
install bin_cmd_file, "#{dest_file}.cmd", :mode => 0755
_______________________________________________
Rubygems-developers mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rubygems-developers