New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When installing gems via bundler, they have an incorrect shebang #3

Closed
nevir opened this Issue Aug 16, 2011 · 15 comments

Comments

Projects
None yet
3 participants
@nevir

nevir commented Aug 16, 2011

My environment:

  • OS X Lion
  • rvm-managed ruby 1.9.2-p290

From a clean install w/o gems in the current rvm gemset:

$ gem install rubygems-bundler
$ gem install bundler
$ gem install rake

$ head -1 `which bundle`
#!/usr/bin/env bundler_wrapper
$ head -1 `which rake`
#!/usr/bin/env bundler_wrapper

$ echo -e "source 'http://rubygems.org'\ngem 'compass'" > Gemfile

$ bundle

$ head -1 `which sass`
#!/usr/bin/env ruby
$ head -1 `which compass`
#!/usr/bin/env ruby
@mpapis

This comment has been minimized.

Show comment
Hide comment
@mpapis

mpapis Aug 16, 2011

Member

most likely you have a setting BUNDLE_BIN in ~/.bundle/config or in you environment.

using rubygems-bundler does not affect binaries generated by bundler.

You should turn of that BUNDLE_BIN variable as bundler provided binaries are no longer required for proper working when using rubygems-bundler gem.

Member

mpapis commented Aug 16, 2011

most likely you have a setting BUNDLE_BIN in ~/.bundle/config or in you environment.

using rubygems-bundler does not affect binaries generated by bundler.

You should turn of that BUNDLE_BIN variable as bundler provided binaries are no longer required for proper working when using rubygems-bundler gem.

@nevir

This comment has been minimized.

Show comment
Hide comment
@nevir

nevir Aug 16, 2011

No to both of those :(

$ env | grep BUNDLE_BIN
$ cat ~/.bundle/config
cat: ~/.bundle/config: No such file or directory

nevir commented Aug 16, 2011

No to both of those :(

$ env | grep BUNDLE_BIN
$ cat ~/.bundle/config
cat: ~/.bundle/config: No such file or directory
@nevir

This comment has been minimized.

Show comment
Hide comment
@nevir

nevir Aug 16, 2011

It doesn't look like it's the traditional bundler-binstubs:

gem install sass
cat `which sass`

outputs https://gist.github.com/1150397

gem uninstall sass
echo -e "source 'http://rubygems.org'\ngem 'sass'" > Gemfile
bundle
cat `which sass`

outputs https://gist.github.com/1150403 - identical except for the shebang

gem uninstall sass
bundle --binstubs
cat bin/sass

outputs https://gist.github.com/1150405 - the bundler binstub

nevir commented Aug 16, 2011

It doesn't look like it's the traditional bundler-binstubs:

gem install sass
cat `which sass`

outputs https://gist.github.com/1150397

gem uninstall sass
echo -e "source 'http://rubygems.org'\ngem 'sass'" > Gemfile
bundle
cat `which sass`

outputs https://gist.github.com/1150403 - identical except for the shebang

gem uninstall sass
bundle --binstubs
cat bin/sass

outputs https://gist.github.com/1150405 - the bundler binstub

@mpapis

This comment has been minimized.

Show comment
Hide comment
@mpapis

mpapis Aug 16, 2011

Member

and what is the output of

bundle config bin

bundle should generate wrappers only when the bin is set. if it is generating binaries in other cases it might mean there is a bug ...

for interactive help you can join me on #rubygems-bundler IRC channel on freenode.

Member

mpapis commented Aug 16, 2011

and what is the output of

bundle config bin

bundle should generate wrappers only when the bin is set. if it is generating binaries in other cases it might mean there is a bug ...

for interactive help you can join me on #rubygems-bundler IRC channel on freenode.

@mpapis

This comment has been minimized.

Show comment
Hide comment
@mpapis

mpapis Aug 16, 2011

Member

so this is issue with rubygems, I will check with newest version, thanks

Member

mpapis commented Aug 16, 2011

so this is issue with rubygems, I will check with newest version, thanks

@nevir

This comment has been minimized.

Show comment
Hide comment
@nevir

nevir Aug 16, 2011

Ah, alright. Thanks for looking into this!

Also:

$ gem -v
1.8.6

nevir commented Aug 16, 2011

Ah, alright. Thanks for looking into this!

Also:

$ gem -v
1.8.6
@booch

This comment has been minimized.

Show comment
Hide comment
@booch

booch Aug 20, 2011

I'm having the same problem, with a similar setup. Only difference is that I'm running RubyGems 1.8.8 and RVM. I haven't been able to track down where the problem is in the code, but I suspect that it's in the way Bundler does the gem install -- via a Ruby call instead of the command line.

As a work-around, I've been running gem regenerate_binstubs after every bundle install.

Other than that, I think the plugin is great. Thanks!

booch commented Aug 20, 2011

I'm having the same problem, with a similar setup. Only difference is that I'm running RubyGems 1.8.8 and RVM. I haven't been able to track down where the problem is in the code, but I suspect that it's in the way Bundler does the gem install -- via a Ruby call instead of the command line.

As a work-around, I've been running gem regenerate_binstubs after every bundle install.

Other than that, I think the plugin is great. Thanks!

@mpapis

This comment has been minimized.

Show comment
Hide comment
@mpapis

mpapis Aug 20, 2011

Member

After checking it looks like bundler does not run rubygems plugins, I'm not sure if that is a bug or feature ...

rubygems-bundler uses shebang customization backported from rubygems 1.9, and in 1.9 backporting via rubygems plugin will be not needed - so then it should be working.

For now please use gem regenerate_binstubs as it will solve this problem.

One of main goals of rubygems-bundler is backporting so I will investigate this issue in free time to provide solution to make your life easier.

Member

mpapis commented Aug 20, 2011

After checking it looks like bundler does not run rubygems plugins, I'm not sure if that is a bug or feature ...

rubygems-bundler uses shebang customization backported from rubygems 1.9, and in 1.9 backporting via rubygems plugin will be not needed - so then it should be working.

For now please use gem regenerate_binstubs as it will solve this problem.

One of main goals of rubygems-bundler is backporting so I will investigate this issue in free time to provide solution to make your life easier.

@booch

This comment has been minimized.

Show comment
Hide comment
@booch

booch Aug 20, 2011

OK, I dug deeper, and found that Rubygems only loads plugins when the gem command is run (i.e. when rubygems/gem_runner is loaded). Since neither Bundler nor RubyGems loads that file (except from the gem binary), the rubygems-bundler hooks do not get loaded.

booch commented Aug 20, 2011

OK, I dug deeper, and found that Rubygems only loads plugins when the gem command is run (i.e. when rubygems/gem_runner is loaded). Since neither Bundler nor RubyGems loads that file (except from the gem binary), the rubygems-bundler hooks do not get loaded.

@nevir

This comment has been minimized.

Show comment
Hide comment
@nevir

nevir Aug 20, 2011

Might be worth bringing this up with the bundler guys? They probably want to keep gem-based behavior the same

nevir commented Aug 20, 2011

Might be worth bringing this up with the bundler guys? They probably want to keep gem-based behavior the same

@booch

This comment has been minimized.

Show comment
Hide comment
@booch

booch Aug 22, 2011

I think Rubygems would be the right place to "fix" the problem of hooks only being called when invoked via the gem command.

booch commented Aug 22, 2011

I think Rubygems would be the right place to "fix" the problem of hooks only being called when invoked via the gem command.

@mpapis

This comment has been minimized.

Show comment
Hide comment
@mpapis

mpapis Oct 22, 2011

Member

I think it might be fixed with this change bundler/bundler#1364 could someone confirm ?

Member

mpapis commented Oct 22, 2011

I think it might be fixed with this change bundler/bundler#1364 could someone confirm ?

@mpapis

This comment has been minimized.

Show comment
Hide comment
@mpapis

mpapis Oct 24, 2011

Member

I have tried the above with bundler 1.0.21 (manually applied the changes over installed gem) and it worked fine, I could not get bundler 1.1pre working - but as soon it will be functional this will work as expected.

Member

mpapis commented Oct 24, 2011

I have tried the above with bundler 1.0.21 (manually applied the changes over installed gem) and it worked fine, I could not get bundler 1.1pre working - but as soon it will be functional this will work as expected.

@mpapis mpapis closed this Oct 24, 2011

@mpapis

This comment has been minimized.

Show comment
Hide comment
@mpapis

mpapis Oct 24, 2011

Member

just to make things easier I have released today mpapis-bundler 1.0.21 with support for rubygems plugins and depending on rubygems-bundler, the future is now - details http://niczsoft.com/2011/10/no-more-bundle-exec/

Member

mpapis commented Oct 24, 2011

just to make things easier I have released today mpapis-bundler 1.0.21 with support for rubygems plugins and depending on rubygems-bundler, the future is now - details http://niczsoft.com/2011/10/no-more-bundle-exec/

@mpapis

This comment has been minimized.

Show comment
Hide comment
@mpapis

mpapis Nov 19, 2011

Member

there was an update to bundler and to my fork - gem "mpapis-bundler", "~> 1.0.21.1" - updated to reflect bundler/bundler#1500 (comment) ... rubygems plugins allowed via Gemfile:

group :never do
  gem "rubygems-bundler"
end
Member

mpapis commented Nov 19, 2011

there was an update to bundler and to my fork - gem "mpapis-bundler", "~> 1.0.21.1" - updated to reflect bundler/bundler#1500 (comment) ... rubygems plugins allowed via Gemfile:

group :never do
  gem "rubygems-bundler"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment