Skip to content
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

Adopt Rails style binary? #562

Closed
skade opened this issue May 30, 2011 · 2 comments
Closed

Adopt Rails style binary? #562

skade opened this issue May 30, 2011 · 2 comments

Comments

@skade
Copy link
Contributor

skade commented May 30, 2011

The rails binary does a clever trick to circumvent the bundle exec-problem. If it detects that it is runs in a Rails project, it basically restarts itself by using script/rails and makes sure it runs in the projects environment. See Details here: http://yehudakatz.com/2011/05/30/gem-versioning-and-bundler-doing-it-right/

Do we want to adopt a similar technique?

@DAddYE
Copy link
Member

DAddYE commented Jun 5, 2011

We use the same way without needs to have a script inside, basically when we load boot.rb we just check Gemfile and deps. Btw thanks for the suggestion!

@DAddYE DAddYE closed this as completed Jun 5, 2011
@skade
Copy link
Contributor Author

skade commented Jun 6, 2011

The linked post exactly elaborates why Rails does not do this, as it is not enough. The problem can be easily seen with Padrino as well.

Using the following Gemfile:

# Padrino
gem 'padrino', "0.9.28"

And:

padrino --version #=> Padrino v. 0.9.29

You get the following:

$ padrino start
[ skade Florian-Gilchers-MacBook-Pro ~/Code/padrino-binary/padrino-test ] padrino start
/Users/skade/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/runtime.rb:31:in `block in setup': You have already activated padrino-core 0.9.29, but your Gemfile requires padrino-core 0.9.28. Consider using bundle exec. (Gem::LoadError)
    from /Users/skade/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `block in each'
    from /Users/skade/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
    from /Users/skade/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
    from /Users/skade/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/runtime.rb:17:in `setup'
    from /Users/skade/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler.rb:107:in `setup'
    from /Users/skade/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/setup.rb:6:in `<top (required)>'
    from <internal:lib/rubygems/custom_require>:33:in `require'
    from <internal:lib/rubygems/custom_require>:33:in `rescue in require'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from /Users/skade/Code/padrino-binary/padrino-test/config/boot.rb:7:in `<top (required)>'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from /Users/skade/.rvm/gems/ruby-1.9.2-p180/gems/padrino-core-0.9.29/lib/padrino-core/cli/base.rb:23:in `start'
    from /Users/skade/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /Users/skade/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /Users/skade/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
    from /Users/skade/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from /Users/skade/.rvm/gems/ruby-1.9.2-p180/gems/padrino-core-0.9.29/bin/padrino:8:in `<top (required)>'
    from /Users/skade/.rvm/gems/ruby-1.9.2-p180/bin/padrino:19:in `load'
    from /Users/skade/.rvm/gems/ruby-1.9.2-p180/bin/padrino:19:in `<main>'

Thats a big hassle for people supporting projects in more than one version of padrino without resorting to .rvmrc-mangling. So some form of self-executing-magic is needed. The question is whether we really want a script/rails-style binary or detect some other magic marker, components for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants