Skip to content

Conversation

@sonalkr132
Copy link
Contributor

bundle exec was added to acceptance test cause otherwise it was giving Gem::LoadError for conflicting bundler versions.

An alternate solution would have been to add it here:

 Bundler.with_clean_env do
   Process.spawn(
     env,
     command.to_s,   # may be change this line to "bundle exec #{command}"
     out:   stdout.last,
     err:   stderr.last,
     in:    :close,
     chdir: root.to_s,
   )
 end

I felt it was non-intuitive. Additionally, above code block doesn't get called only from Spring::Test::AcceptanceTest, so it would need changes on many different files.

EDIT:
Resolves: #275

@rails-bot
Copy link

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @rafaelfranca (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

Copy link
Collaborator

Choose a reason for hiding this comment

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

we always advertise to not use bundle exec ... so with_clean_env would be better :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think error on travis (check this) can be on user side as well (?). Looking at the test won't help him a lot cause it won't be apparent that command passing in test is not actually:

bin/spring

but

bundle exec bin/spring

Also, some of the commands being passed to with_clean_env are:

# gives syntax error near unexpected token `('
# can be solved by just removing '('
(gem list bundler | grep bundler) || gem install bundler
# not sure from where does this gets passed but some jugglery will be needed    
bundle check || bundle update --retry=2 

## some gem install command

## more commands from other files calling the same app.run

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@grosser Do you really want me to change it to with_clean_env?
Actually, it needs just 2 lines of change.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm confused now :D
Do you think this is better or with_clean_env is better ?
I think either would work, I was just sad to see bundle exec being added all over the place + that it uses a pattern we try to discourage ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

with_clean_env feels like we are secretly adding bundle exec to every command.
However, with_clean_env is lot cleaner and gets the job done. Also, issue of conflicting bundler version seems to be only specific for travis runs. Locally, I have bundler 1.10.6 and I don't get any error.

@sonalkr132 sonalkr132 force-pushed the bundler-dep branch 3 times, most recently from 4461ecb to 666abfa Compare December 16, 2015 03:50
@sonalkr132
Copy link
Contributor Author

@grosser I changed it to with_clean_env version. Can you please have a look?
Order of application.bundle and build_and_install_gems is changed cause to bundle and install gems we will need bundler first. Bundler is install by application.bundle.

@grosser
Copy link
Collaborator

grosser commented Dec 16, 2015

looks good to me ... but could break all kinds of stuff ... @jonleighton want to have a look ?

@sonalkr132
Copy link
Contributor Author

but could break all kinds of stuff

Are you referring to change of order of application.bundle and build_and_install_gems? Those things are only used for tests and has nothing to do with working of gem.

@grosser
Copy link
Collaborator

grosser commented Dec 16, 2015

ahhh you are right! :D
so you don't need a new release after this ,right ?

@sonalkr132
Copy link
Contributor Author

so you don't need a new release after this ,right?

TBH, I am not sure. It does add bundler as hard dependency.

@sonalkr132
Copy link
Contributor Author

Shit! I just noticed it. I did reset hard and forgot to add the most important line -_-

@grosser
Copy link
Collaborator

grosser commented Dec 16, 2015

:D

@sonalkr132
Copy link
Contributor Author

Fixed it!

so you don't need a new release after this ,right?

I think it will need changelog that now spring has bundler as hard dependency.

@grosser
Copy link
Collaborator

grosser commented Dec 16, 2015

👍

@jonleighton / @rafaelfranca looks good ?

Copy link
Member

Choose a reason for hiding this comment

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

Why change this? It makes it less readable IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

bundle exec (gem list bundler | grep bundler) || gem install bundler gives following error:

bash: syntax error near unexpected token `('

bundle exec was added to commands cause otherwise it was giving
Gem::LoadError for conflicting bundler versions on travis
@sonalkr132
Copy link
Contributor Author

Can someone please suggest tests so that #456 doesn't happen again? I can't think of anything reasonable.

@sonalkr132 sonalkr132 closed this Dec 19, 2015
@sonalkr132
Copy link
Contributor Author

closed in favor of #458

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.

Dependency on Bundler not stated

5 participants