Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uniq Gemfile#source #85

Merged
merged 1 commit into from
Feb 6, 2015
Merged

uniq Gemfile#source #85

merged 1 commit into from
Feb 6, 2015

Conversation

razum2um
Copy link
Contributor

@razum2um razum2um commented Feb 5, 2015

I'm author of a library https://github.com/razum2um/lurker with multi-rails suport which I migrate to use appraisal.
I want the lib to be tested and used without appraisal as well, that's why I use regular Gemfile for :development gems, and I do eval ::File.read('Gemfile') to import it into appraise section.
I don't want to transfer them to Appraisal file as it seems unintuitive to me and prevents proper using without appraisal prefix at all. Currently I'm getting source line twice (one evaled from Gemfile)

This fixes it.
Anyway it doesn't make sense to have identical sources, is it?

@sikachu
Copy link
Contributor

sikachu commented Feb 5, 2015

I think this patch make sense, yeah. We definitely wouldn't want duplicate source.

@@ -14,7 +14,15 @@
gemfile = Appraisal::Gemfile.new
gemfile.source "one"
gemfile.source "two"
expect(gemfile.to_s.strip).to eq %{source "one"\nsource "two"}
expect(gemfile.to_s.strip).to match %r{source "one"}
expect(gemfile.to_s.strip).to match %r{source "two"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why these two lines has to be changed? Is it the case now that the order are nondeterministic?

If so, I'd rather keep the array then .uniq it, as we can't be sure if user will be getting the same order every time they run appraisal generate or not, and it's annoying when you didn't touch anything, upgrade appraisal, then your source lines get swapped.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense. fixed that way

@razum2um razum2um changed the title use set for Gemfile#source uniq Gemfile#source Feb 5, 2015
@razum2um
Copy link
Contributor Author

razum2um commented Feb 5, 2015

@sikachu also fixed commit's message

sikachu added a commit that referenced this pull request Feb 6, 2015
Do not write duplicate sources in the Gemfile.
@sikachu sikachu merged commit cf2bea3 into thoughtbot:master Feb 6, 2015
@sikachu
Copy link
Contributor

sikachu commented Feb 6, 2015

Thanks!

@sikachu sikachu added this to the v1.1.0 milestone Feb 6, 2015
@sikachu sikachu modified the milestones: v1.1.0, v2.0.0 Mar 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants