-
-
Notifications
You must be signed in to change notification settings - Fork 2k
[Init] Check if the current directory is writeable #6266
Conversation
Thanks for opening a pull request and helping make Bundler better! Someone from the Bundler team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality. We use Travis CI to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of Travis CI in the PR status window below. If you have any questions or concerns that you wish to ask, feel free to leave a comment in this PR or join our #bundler channel on Slack. For more information about contributing to the Bundler project feel free to review our CONTRIBUTING guide |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for opening this PR and helping improve Bundler!
spec/commands/init_spec.rb
Outdated
@@ -64,6 +64,22 @@ | |||
end | |||
end | |||
|
|||
context "when the dir is not writable by the current user", :bundler => ">= 2" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be tagged with :bundler => ">= 2"
because this is not testing any specific Bundler 2 functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any other 1.x release planned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, alright. I’ll remove that tag there then and try to make the spec pass with Ruby 1.8
@bundlerbot r+ |
📌 Commit 205844f has been approved by |
[Init] Check if the current directory is writeable ### What was the end-user problem that led to this PR? The problem was that when running `bundle init` inside a directory which is not writable by the current user (e.g. `/` as demonstrated in #6219) Bundler prints out an `EACCES` error with a huge backtrace. In the mentioned PR @segiddins suggested to print out a better error message. This PR addresses that. ### What was your diagnosis of the problem? See [this comment on said PR](#6219 (comment)). ### What is your fix for the problem, implemented in this PR? My fix is simple: adding a check whether the current directory is writeable before trying to create `gems.rb`/`Gemfile`. If that's not the case, print out an error and exit. ### Why did you choose this fix out of the possible options? I chose this fix because... it was really simple to implement.
☀️ Test successful - status-travis |
[Init] Check if the current directory is writeable ### What was the end-user problem that led to this PR? The problem was that when running `bundle init` inside a directory which is not writable by the current user (e.g. `/` as demonstrated in #6219) Bundler prints out an `EACCES` error with a huge backtrace. In the mentioned PR @segiddins suggested to print out a better error message. This PR addresses that. ### What was your diagnosis of the problem? See [this comment on said PR](#6219 (comment)). ### What is your fix for the problem, implemented in this PR? My fix is simple: adding a check whether the current directory is writeable before trying to create `gems.rb`/`Gemfile`. If that's not the case, print out an error and exit. ### Why did you choose this fix out of the possible options? I chose this fix because... it was really simple to implement. (cherry picked from commit c4b022c)
[Init] Check if the current directory is writeable ### What was the end-user problem that led to this PR? The problem was that when running `bundle init` inside a directory which is not writable by the current user (e.g. `/` as demonstrated in #6219) Bundler prints out an `EACCES` error with a huge backtrace. In the mentioned PR @segiddins suggested to print out a better error message. This PR addresses that. ### What was your diagnosis of the problem? See [this comment on said PR](#6219 (comment)). ### What is your fix for the problem, implemented in this PR? My fix is simple: adding a check whether the current directory is writeable before trying to create `gems.rb`/`Gemfile`. If that's not the case, print out an error and exit. ### Why did you choose this fix out of the possible options? I chose this fix because... it was really simple to implement. (cherry picked from commit c4b022c)
What was the end-user problem that led to this PR?
The problem was that when running
bundle init
inside a directory which is not writable by the current user (e.g./
as demonstrated in #6219) Bundler prints out anEACCES
error with a huge backtrace. In the mentioned PR @segiddins suggested to print out a better error message. This PR addresses that.What was your diagnosis of the problem?
See this comment on said PR.
What is your fix for the problem, implemented in this PR?
My fix is simple: adding a check whether the current directory is writeable before trying to create
gems.rb
/Gemfile
. If that's not the case, print out an error and exit.Why did you choose this fix out of the possible options?
I chose this fix because... it was really simple to implement.