Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Ensure binstubs generated when using --standalone point to the standalonde bundle #1588

Closed

Conversation

cowboyd
Copy link
Contributor

@cowboyd cowboyd commented Dec 12, 2011

The binstubs generated by Bundler currently require both rubygems and bundler to be installed in order to execute: requirements not guaranteed at runtime for a standalone bundle.

This introduces a separate method to generate binstubs when generating a standalone bundle. It first adds the root of the standalone to the load path, and then requiring bundler/setup from there.

I was on the fence whether to leave the load path alone and load bundler/setup.rb directly via its path relative to the generated executeable, but in the end decided to go the way I did so that application code requiring 'bundler/setup' will continue to function.

I'm pretty excited about the standalone feature, and I hope that this makes it into 1.1

@indirect
Copy link
Member

Thanks for the patch! We're feature-frozen for 1.1 right now, but the standalone feature is part of the 1.1 release. This patch seems it's a bug fix for binstubs with standalone, so I'm inclined to pull it for the next 1.1 RC.

@cowboyd
Copy link
Contributor Author

cowboyd commented Dec 12, 2011

I agree. The standalone binstubs are pretty broken without this. They'll either raise an error, or perhaps even worse, load code from the wrong place.

@cowboyd
Copy link
Contributor Author

cowboyd commented Dec 12, 2011

I just spotted a bug in that the standalone binstub assumes that it's being run from the directory above bin

If you could hold off merging until I can update the spec and fix it, I'd appreciate it. This will be tomorrow morning. Thanks!

@hone
Copy link
Contributor

hone commented Dec 12, 2011

sure. thanks for the help @cowboyd

@cowboyd
Copy link
Contributor Author

cowboyd commented Dec 13, 2011

Ok, binstubs are callable from within any directory, and the real binary will be loaded relative to the stub file.

hone added a commit that referenced this pull request Dec 14, 2011
---


The binstubs generated by Bundler currently require both rubygems and bundler to be installed in order to execute: requirements not guaranteed at runtime for a standalone bundle.

This introduces a separate method to generate binstubs when generating a standalone bundle. It first adds the root of the standalone to the load path, and then requiring `bundler/setup` from there.

I was on the fence whether to leave the load path alone and load bundler/setup.rb directly via its path relative to the generated executeable, but in the end decided to go the way I did so that application code requiring bundler/setup will continue to function.

Im pretty excited about the standalone feature, and I hope that this makes it into 1.1
@hone
Copy link
Contributor

hone commented Dec 14, 2011

Thanks so much for fixing this.

@hone hone closed this Dec 14, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants