monterail / guidelines

[DEPRECATED] We are Ruby on Rails experts from Poland. Think hussars. Solid & winged. These are our guidelines.
71 stars 17 forks source link

Use bin directory in active way #139

Closed sheerun closed 11 years ago

sheerun commented 11 years ago

From Rails 4 error messages:

Looks like your app's ./bin/rails is a stub that was generated by Bundler.

In Rails 4, your app's bin/ directory contains executables that are versioned
like any other source code, rather than stubs that are generated on demand.

Here's how to upgrade:

  bundle config --delete bin    # Turn off Bundler's stub generator
  rake rails:update:bin         # Use the new Rails 4 executables
  git add bin                   # Add bin/ to source control

You may need to remove bin/ from your .gitignore as well.

When you install a gem whose executable you want to use in your app,
generate it and add it to source control:

  bundle binstubs some-gem-name
  git add bin/new-executable
sheerun commented 11 years ago

Also we should get used to calling bin/rails instead of rails, bin/rake instead of bundle exec rake etc.

teamon commented 11 years ago

Why?

sheerun commented 11 years ago

"When you install a gem whose executable you want to use in your app, generate it and add it to source control:"

teamon commented 11 years ago

Again, why?

sheerun commented 11 years ago

Why we should use bundle exec? I think Rails proposal is very good.

teamon commented 11 years ago

I still haven't head a single argument. Btw - https://github.com/mpapis/rubygems-bundler

sheerun commented 11 years ago

This gem is generating stubs, but outside the directory. Using bin/ commands is especially useful on server side. You don't need to care from which directory you call bundle exec. You're 100% sure the commands are called in context of your project. No need for manually setting ENV variables.

sheerun commented 11 years ago

Any trick using rbenv, rvm or alias is just hack and hiding the truth, that you're really calling stub or bundle exec.

teamon commented 11 years ago

ENV variables? oO

Server side != development. Adding bin to repository does not matter for server side and only makes development harder

teamon commented 11 years ago

rvm or rbenv have nothing to do with bundler

sheerun commented 11 years ago

Of course it matters on server. You can use stubs added to repo on server without any changes.

teamon commented 11 years ago

... or just add --binstubs to bundle install.

sheerun commented 11 years ago

When using --binstubs it isn't clear what commands are supposed to be actually used in application. Also the autosuggestion using tab is much worse.

teamon commented 11 years ago

... on server side ...

sheerun commented 11 years ago

And we will be using Rails 4 in future. The bin directory will be in repository, so bundle install --binstubs will be pain even on development.

teamon commented 11 years ago

I'd suggest more criticism for rails core team. echo /bin >> .gitignore

sheerun commented 11 years ago

I think it's wonderful decision. No need for criticism. Local binstubs should not be placed in repository.

teamon commented 11 years ago

Give me one argument, just one.

sheerun commented 11 years ago

I gave you more than one.

jandudulski commented 11 years ago

I agree that binstubs are better than bundle exec on server side, but as @teamon I don't get any reasons to keep them in repo and during local development. How rails core team arguments such decision?

sheerun commented 11 years ago

I didn't find any argumentation.