Skip to content

Commit

Permalink
Fix path of gem binstubs
Browse files Browse the repository at this point in the history
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 railsinstaller#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 rubygems/rubygems#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.
  • Loading branch information
kemenaran committed Dec 17, 2016
1 parent ac22c13 commit 6170c38
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions resources/railsinstaller/railsinstaller.iss
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6170c38

Please sign in to comment.