burke / zeus

Boot any rails app in under a second.
MIT License
3.33k stars 231 forks source link

Too old ruby and ruby gems #647

Open fedorkk opened 6 years ago

fedorkk commented 6 years ago

I use zeus 0.15.14 and it requires method_source 0.8.2, at the same time many gems (pry for example) requires method_source >0.9.0. And zeus crashes if used with this gems with exception: can't activate method_source-0.8.2, already activated method_source-0.9.0 Also, zeus uses ruby 2.2.3 which is "nearing its end of life".

dzajic commented 6 years ago

I uninstalled method_source 0.9.0, which solved the problem for me.

ylansegal commented 6 years ago

Very similar issue on my side, but with pry:

You have already activated pry 0.11.3, but your Gemfile requires pry 0.11.2. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)

Uninstalling pry 0.11.3 solves the issue, but seems that it's just a band-aid.

speckins commented 6 years ago

I've found that adding the gem to the top of custom_plan.rb works, and you don't have to uninstall the offending version.

gem 'method_source', '0.9.0'

require 'zeus/rails'
# ...

(The version you put in custom_plan.rb should be the same version as in your Gemfile.lock.)

prashant-kajale commented 5 years ago

I tried both workarounds but none is working for me

nmagedman commented 5 years ago

@speckins’ solution of explicitly requiring the correct version of the conflicted gems is a good one, although it isn't DRY. We can improve upon it by letting Bundler do its job right from the start. My custom_plan.rb starts with:

require 'bundler/setup'
require 'zeus/rails'
speckins commented 5 years ago

@nmagedman Doesn't that defeat the purpose of keeping 'zeus' out of the Gemfile?

nmagedman commented 5 years ago

@speckins : Sorry, but I don't understand your question. In what sense is zeus "in" or "out" of the Gemfile?

Zeus reads Gemfile.lock and parses out the version number of certain gems. In that sense, it has its hands very dirty with Bundler internals.

Adding an explicit gem line to your custom_plan.rb creates a coupling between zeus and the current state of the Gemfile.lock. We can uncouple them by telling Bundler to handle the Gemfile processing for us.

speckins commented 5 years ago

The prescribed usage for zeus is not to include it in the Gemfile. From the README:

Q: "I should put it in my Gemfile, right?"

A: No. You can, but running bundle exec zeus instead of zeus adds precious seconds to commands that otherwise would be quite a bit faster. Zeus was built to be run from outside of bundler.

It's worth noting that you would need to include it in the Gemfile if you use the require 'bundler/setup' line.

@nmagedman I see what you mean in rubygem/lib/zeus/m.rb about zeus grepping the Gemfile.lock and trying to load 'method_source'. I wonder why that doesn't seem to be working. It works for me if I run the same code in irb, say.