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

Remove add_development_dependency from new gems #7222

Merged
4 commits merged into from
Jul 6, 2019

Conversation

deivid-rodriguez
Copy link
Member

@deivid-rodriguez deivid-rodriguez commented Jun 26, 2019

What was the end-user problem that led to this PR?

The problem was that a lot of gems in the wild use add_development_dependency for their development dependencies, but using Gemfile's for that is more useful.

What was your diagnosis of the problem?

My diagnosis was that the current situation is due to the fact that bundler generates a gem skeleton that uses add_development_dependency by default.

What is your fix for the problem, implemented in this PR?

My fix is to stop using add_development_dependency in generated gems, and instead use the Gemfile.

Why did you choose this fix out of the possible options?

I chose this fix because it encourages better practices.

@deivid-rodriguez deivid-rodriguez changed the title Remove `add_development_dependency from new gems Remove add_development_dependency from new gems Jun 26, 2019
Copy link
Member

@hsbt hsbt left a comment

Choose a reason for hiding this comment

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

It helps the real-usecase.

@simi
Copy link
Member

simi commented Jun 27, 2019

Does this mean add_development_dependency is going to be deprecated and removed in the future? Also why not to use common groups (development, test) in Gemfile for rake, ext-compiler and test framework?

@deivid-rodriguez
Copy link
Member Author

Deprecating it is kind of tough at the moment, it's too heavily used so it would be too annoying for the community in my opinion. I think reducing its usage by making it opt-in, not opt-out, on new gems is a good start. We could revisit it in the future, and see if deprecating it makes sense by then.

Regarding using groups, I'm not sure whether the distinction is useful here. Generally speaking, I think only :development and :test are useful on a gem context, and all three gems we include by default would probably make sense in both groups, so I feel it's easier to skip any grouping.

@deivid-rodriguez
Copy link
Member Author

@simi Are you ok with this? Thanks for all your late reviews, by the way, they are really helpful.

@deivid-rodriguez
Copy link
Member Author

@bundlerbot r+

ghost pushed a commit that referenced this pull request Jul 6, 2019
7222: Remove `add_development_dependency` from new gems r=deivid-rodriguez a=deivid-rodriguez

### What was the end-user problem that led to this PR?

The problem was that a lot of gems in the wild use `add_development_dependency` for their development dependencies, but using `Gemfile`'s for that is more useful.

### What was your diagnosis of the problem?

My diagnosis was that the current situation is due to the fact that bundler generates a gem skeleton that uses `add_development_dependency` by default.

### What is your fix for the problem, implemented in this PR?

My fix is to stop using `add_development_dependency` in generated gems, and instead use the Gemfile.

### Why did you choose this fix out of the possible options?

I chose this fix because it encourages better practices.


Co-authored-by: David Rodríguez <[email protected]>
@ghost
Copy link

ghost commented Jul 6, 2019

Build succeeded

@ghost ghost merged commit f8584fb into master Jul 6, 2019
@ghost ghost deleted the remove_add_development_dependency_from_new_gems branch July 6, 2019 15:57
ghost pushed a commit that referenced this pull request Jul 9, 2019
7237: Remove `add_development_dependency` from gemspec r=indirect a=deivid-rodriguez

### What was the end-user problem that led to this PR?

The problem was that our development setup is complicated, and that we are using `add_development_dependency` even though in my opinion its usage should be discouraged.

### What was your diagnosis of the problem?

My diagnosis was that our development dependencies are split between the gemspec and the `spec/support/rubygems_ext` file. We can simplify this and centralize everything in the support file.


### What is your fix for the problem, implemented in this PR?

My fix is to simplify our development setup by moving everything to `spec/support/rubygems_ext`, while also getting rid of `add_development_dependency` in our gemspec.

### Why did you choose this fix out of the possible options?

I chose this fix because it simplifies our setup and it further discourages usage of `add_development_dependency` (after #7222).


Co-authored-by: David Rodríguez <[email protected]>
jonathanhefner added a commit to jonathanhefner/rails that referenced this pull request Jan 9, 2020
The Gemfile offers more flexibility than the gemspec in terms of gem
groups and platforms.  Putting the default development dependencies in
the Gemfile encourages users to add their own development dependencies
to the Gemfile.  This is similar to the current behavior of the
`bundle gem` command (see rubygems/bundler#7222).

This change also fixes a corner case where using the "--skip-gemspec"
and "--skip-active-record" options together would incorrectly generate a
"sqlite3" dependency in the Gemfile.
This pull request was closed.
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