Introduce ./bin for your app's executables: bin/bundle, bin/rails, bin/rake #8786

Merged
merged 1 commit into from Jan 7, 2013

Conversation

Projects
None yet
8 participants
Owner

jeremy commented Jan 6, 2013

Executable scripts are versioned code like the rest of your app. To generate a stub for a bundled gem: 'bundle binstubs unicorn' and 'git add bin/unicorn'

Owner

rafaelfranca commented Jan 6, 2013

:shipit:

Contributor

goshakkk commented Jan 7, 2013

👍

Owner

tenderlove commented Jan 7, 2013

common bro

I don't see any patches in my inbox. ಠ_ಠ

railties/test/app_rails_loader_test.rb
+ test "is in a rails application if parent directory has bin/rails" do
+ File.stubs(:exists?).with("/foo/bar/bin/rails").returns(false)
+ File.stubs(:exists?).with("/foo/bin/rails").returns(true)
+ File.stubs(:read).with('/foo/bin/rails').returns('APP_DIR')
@carlosantoniodasilva

carlosantoniodasilva Jan 7, 2013

Owner

Shouldn't this return APP_PATH?

@@ -85,6 +85,8 @@ Please refer to the [Changelog](https://github.com/rails/rails/blob/master/railt
* New test locations `test/models`, `test/helpers`, `test/controllers`, and `test/mailers`. Corresponding rake tasks added as well. ([Pull Request](https://github.com/rails/rails/pull/7878))
+* Your app's executables now live in the `bin/` dir. Run `rake update:bin` to get `bin/bundle`, `bin/rails`, and `bin/rake`.
@carlosantoniodasilva

carlosantoniodasilva Jan 7, 2013

Owner

Will this go to the changelog as well?

Nice! 👍

Introduce ./bin for your app's executables: bin/bundle, bin/rails, bi…
…n/rake. Executable scripts are versioned code like the rest of your app. To generate a stub for a bundled gem: 'bundle binstubs unicorn' and 'git add bin/unicorn'

jeremy added a commit that referenced this pull request Jan 7, 2013

Merge pull request #8786 from jeremy/executables
Introduce ./bin for your app's executables: bin/bundle, bin/rails, bin/rake

@jeremy jeremy merged commit 41abe92 into rails:master Jan 7, 2013

@jeremy jeremy deleted the jeremy:executables branch Jan 7, 2013

xinuc commented on 009873a Jan 7, 2013

Whoaa..... 👿

How is this supposed to work with bundler's --binstubs turned on? The contents of bin/rails as a result of bundler vs. rails:update:bin are not the same, and the former won't start rails server properly. Heroku is also not able to start the rails server since this change, even pushing the bin folder up to it.

Owner

jeremy replied Jan 11, 2013

@chrismo It isn't. Bundler 1.3.0 will no longer overwrite executables in ./bin. We'll prefer to use bundler binstubs <gem> to explicitly add stubbed executables.

ah - didn't know that, thx.

though browsing their commits just now, saw this one from 2 days ago -> bundler/bundler@6540131 seems to undo that back to current (pre 1.3.0) behavior?

this appears to have been fixed -> carlhuda/bundler#2253 -> bundler/bundler@08138dc ... and with 1.3.0.pre7 it's no longer overwriting my local bin/rails.

... and undone again in pre8 and now 1.3.0. bundler/bundler@f00e085

https://gist.github.com/chrismo/5043420

I still may just be doing something wrong, but otherwise it seems there's some disagreement here on the tooling. Maybe --binstubs is just not a common use case?

EDIT: sorry - should have searched the issues more thoroughly -> "Use the new bundle binstubs command."

Owner

jeremy replied Feb 26, 2013

It's a very common use case. We'd like to see that change. Try not using --binstubs anymore and start checking your ./bin/* in to version control.

Is this needed provided we require 1.9.3?

Owner

jeremy replied Jan 7, 2013

Oh cool. Not required!

@zillou zillou referenced this pull request in cucumber/cucumber-rails Apr 19, 2016

Closed

Copy cucumer executable to bin folder in Rails 4 #314

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment