Default remote source for Gemfile #2051

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
5 participants
Contributor

ognevsky commented Aug 9, 2012

I don't know if somebody need this, but I really do.

Nowadays 99.9% of every Gemfile contains source 'https://rubygems.org'.

More than that, if you accidentally delete this line, you'll get a message add a line like this: ... in your console. Why can't we add this line automagically?

Where is Convention over configuration? It's the right place for it!

Contributor

ognevsky commented Aug 9, 2012

(but I'm still sure, that I wasn't the first man who made a commit like this; just nobody cares this extra line)

This pull request fails (merged 17ac8bc into 3a1121a).

Owner

indirect commented Aug 10, 2012

So first, I'm a bit hesitant to accept this patch because the build fails (as @travisbot pointed out).

In general, though, there is a specific problem that we are solving by requiring that line: many users don't want to use rubygems.org as a source. They run their own gem servers, and they want to deploy using gems only from that server. So it's not a case of "configuration over convention" it's a case of "what about people who don't want rubygems.org, or who want to only use gems that are already installed"?

Owner

indirect commented Aug 10, 2012

Of course, now that I've written that, it might be possibly to satisfy all those people by setting up two rules:

  1. Only automatically add a rubygems source to files that have no rubygems sources
  2. Ask people who want to install with no remote sources to use bundle install --local

Those rules are full of edge cases as soon as you add :git repos, though.

Contributor

ognevsky commented Aug 10, 2012

@indirect it's only a draft to show the main idea, so failing tests is admissible.

As you can see from the code, we add rubygems.org only if there are no other sources. If somebody have their own, it's OK, — my code doesn't work for them.

It should not run when --local is enabled, too. So, I'll write test soon and you would see — the behavior of evaluating Gemfile is the same, except the only thing: if there is no sources at all, we add the default one automagically.

Owner

indirect commented Aug 10, 2012

What about people who want no rubygems sources, but have git gems? (Git gems create git sources internally, as you've probably noticed.)

Contributor

ognevsky commented Aug 10, 2012

@indirect I'll test this issue, too.

Contributor

ndbroadbent commented Nov 2, 2012

👍 to this, I've never liked the unnecessary repetition in 100% of my Gemfiles.

I would suggest only adding the default rubygems source if there are no sources, but don't add the default source if all the gems are git gems. In other words, if there are any gems that aren't git gems, add the default rubygems source if no sources are defined.

Would that cover all the cases?

jrun commented Feb 1, 2013

Throwing my two cents in, how about using rubygems sources?

$ gem sources

We have already configured rubygems to use our internal gem server on all of our systems. It'd be nice if we didn't have to repeat that configuration for bundler too.

Owner

indirect commented Feb 1, 2013

People use Bundler without remote sources on purpose. What do you guys propose I tell those people? bundle init already provides you with a Gemfile that includes a rubygems.org source at the top without you having to do any typing.

Also, explicit is better than implicit?

On Feb 1, 2013, at 9:28 AM, Jeremy Burks notifications@github.com wrote:

Throwing my two cents in, how about using rubygems sources?

$ gem sources
We have already configured rubygems to use our internal gem server on all of our systems. It'd be nice if we didn't have to repeat that configuration for bundler too.


Reply to this email directly or view it on GitHub.

Contributor

ognevsky commented Feb 1, 2013

@indirect I think you were right all this time, it's just one line and it's better to keep it as is. I think it's time to close this PR, what do you think?

Owner

indirect commented Feb 2, 2013

Sounds good. Thanks for replying!

@indirect indirect closed this Feb 2, 2013

@ognevsky ognevsky deleted the evrone:default-remote-source branch Feb 2, 2013

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