Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

[Fix #5358] Handle files conflicts when using bundle gem #5415

Merged
merged 1 commit into from
Feb 10, 2017

Conversation

nodo
Copy link
Contributor

@nodo nodo commented Feb 9, 2017

bundle gem command fails with an exception when creating a gem having
the same name of a file in the specified path.

For instance:

touch hello
bundle gem hello

This bug is due to Thor gem. At the moment, Thor does not handle
conflicts between files and directories. This commit mitigates the
problem by rescuing the exception from Thor and gracefully exit with an
error message.

Fixes #5358

@nodo nodo force-pushed the issue-5358-conflicts-in-bundle-gem branch 2 times, most recently from 726ba22 to 4334b97 Compare February 9, 2017 10:10
@@ -139,6 +139,10 @@ def run

# Open gemspec in editor
open_editor(options["edit"], target.join("#{name}.gemspec")) if options[:edit]
rescue SystemCallError => e
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use SharedHelpers.filesystem_access instead of this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@segiddins the error is thrown by thor.template. Should I monkey-patch it? Or how would you use SharedHelpers.filesystem_access?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind the comment above 👍 Will do it, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@segiddins I have just noticed that here https://github.com/bundler/bundler/blob/master/lib/bundler/shared_helpers.rb#L120 when Errno::EEXIST happen a generic RuntimeError is thrown. Are you OK if I create a custom exception for that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah in that case, please use both filesystem_access and separately rescue EEXIST and raise a GenericSystemCallError for it?

@nodo nodo force-pushed the issue-5358-conflicts-in-bundle-gem branch from 4334b97 to cc842f4 Compare February 9, 2017 14:36
`bundle gem` command fails with an exception when creating a gem having
the same name of a file in the specified path.

For instance:
> touch hello
> bundle gem hello

This bug is due to Thor gem. At the moment, Thor does not handle
conflicts between files and directories. This commit mitigates the
problem by rescuing the exception from Thor and gracefully exit with an
error message.
@nodo nodo force-pushed the issue-5358-conflicts-in-bundle-gem branch from cc842f4 to 9a15da1 Compare February 9, 2017 15:51
@nodo
Copy link
Contributor Author

nodo commented Feb 9, 2017

@segiddins I have updated the PR. What do you think?

@segiddins segiddins added this to the 1.14.4 milestone Feb 10, 2017
@segiddins
Copy link
Member

Thanks!
@bundlerbot r+

@bundlerbot
Copy link
Collaborator

📌 Commit 9a15da1 has been approved by segiddins

@bundlerbot
Copy link
Collaborator

⌛ Testing commit 9a15da1 with merge f93accc...

bundlerbot added a commit that referenced this pull request Feb 10, 2017
…ddins

[Fix #5358] Handle files conflicts when using `bundle gem`

`bundle gem` command fails with an exception when creating a gem having
the same name of a file in the specified path.

For instance:
> touch hello
> bundle gem hello

This bug is due to Thor gem. At the moment, Thor does not handle
conflicts between files and directories. This commit mitigates the
problem by rescuing the exception from Thor and gracefully exit with an
error message.

Fixes #5358
@bundlerbot
Copy link
Collaborator

☀️ Test successful - status-travis
Approved by: segiddins
Pushing f93accc to master...

@bundlerbot bundlerbot merged commit 9a15da1 into rubygems:master Feb 10, 2017
segiddins pushed a commit that referenced this pull request Feb 12, 2017
…ddins

[Fix #5358] Handle files conflicts when using `bundle gem`

`bundle gem` command fails with an exception when creating a gem having
the same name of a file in the specified path.

For instance:
> touch hello
> bundle gem hello

This bug is due to Thor gem. At the moment, Thor does not handle
conflicts between files and directories. This commit mitigates the
problem by rescuing the exception from Thor and gracefully exit with an
error message.

Fixes #5358

(cherry picked from commit f93accc)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants