I
I
IvanN7772017-08-07 16:09:47
Ruby on Rails
IvanN777, 2017-08-07 16:09:47

What happens if Gem has a different mysql dependency? is it worth the trouble?

I am writing gem.
This gem needs a db.
But I had a reasonable question, what will happen if the versions of the muscle or postgres intersect with the application.
What do they do in this case?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vsuhachev, 2017-08-11
@vsuhachev

In a gemspec, you specify a dependency on other gems, indicating the desired version. When installing your gem along with other gems, bundler finds and installs a dependency version that satisfies all requests from all gems and requests from the Gemfile.
If such a version is not found, then a conflict will arise, about which the bundler will inform you.
For example, in the gem 'your_gem' you have specified the dependency and in the gem file of the application

gem  'your_gem'
gem  'pg', '= 9.2' # Будет конфликт т.к. your_gem требует pg > 9.2
gem  'pg', '>= 9.2' # Конфликта нет, установится последняя версия >= 9.5

Read about dependency syntax here: guides.rubygems.org/patterns
It is also useful to get acquainted with the concept of semantic versioning

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question