From 6170c386eb0dd2676fa51e7fd4654be81734cd25 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Sat, 17 Dec 2016 14:30:05 -0800 Subject: [PATCH] Fix path of gem binstubs Since rubygems v2.4.2, Windows binstubs for gem executables are generated with a hardcoded path to Ruby. This leads to the binstubs shipping with RailsInstaller-Windows being unusable, because they reference the Ruby path on the maintainer machine, rather than the machine that executed the installer (see #81). This is due to a fix in rubygems, which explicitely hardcodes the Ruby path in the binstubs, to work around a Bundler issue (see https://github.com/rubygems/rubygems/pull/942). The author of the patch notes that it makes Ruby installations non-portable across machines - which is exacly the issue that we encounter there. The intended workaround for people needing portable installations is to re-generate the binstubs locally, by executing `gem pristine --all --executables-only`. This is how this PR implements the fix: it simply re-generates the binstubs with the correct path at the end of the installation. In the future, I may attempt to fix the issue upstream in rubygems, by allowing `--env-shebang` to generate a portable Ruby path again, as it was suggested in the original pull request. --- resources/railsinstaller/railsinstaller.iss | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/railsinstaller/railsinstaller.iss b/resources/railsinstaller/railsinstaller.iss index d8628f2..cbb71c6 100644 --- a/resources/railsinstaller/railsinstaller.iss +++ b/resources/railsinstaller/railsinstaller.iss @@ -130,6 +130,7 @@ Name: {group}\{cm:UninstallProgram,{#InstallerName}}; Filename: {uninstallexe} [Run] Filename: "{app}\{#RubyPath}\bin\ruby.exe"; Parameters: "dk.rb install --force"; WorkingDir: "{app}\DevKit"; Flags: runhidden +Filename: "{app}\{#RubyPath}\bin\gem.bat"; Parameters: "pristine --all --only-executables"; WorkingDir: "{app}\{#RubyPath}\bin"; Flags: runhidden Filename: {sys}\cmd.exe; Parameters: /E:ON /K {app}\{#RubyPath}\setup_environment.bat {app}; WorkingDir: {sd}\Sites; Description: "Configure git and ssh when installation has completed."; Check: InstallGit; Flags: postinstall nowait skipifsilent ; TODO: Instead of running the full vcredist, simply extract and bundle the dll