How do I know the gem is compatible with the rails version?

I am just starting with rubies on rails, and following the training course, there is no explanation of how certain gems were collected and placed in the gemfile. I just copied and pasted them and put them into my Gemfile and started installing the package.

How can I download certain versions of gems and their dependencies, and also make sure that they are compatible with the version of rails that I use?

+4
source share
3 answers

For rails 4 and 5 you can check here . If the stone is ready or not.

Rails gem , gem 'gemname'. gem .

. gemspec gem Gemfile .

gemspec Gemfile gem, - .

0

Bundler , Rails, Gem. Bundler , .

gem 'gemname'

, Rails.

gem 'gemname', '1.5'

1.5 , Rails.

gem 'gemname',  '>=1.0'

1.0 , .

(2.2), , 3.0 ( Gmail Mailchimp) :

gem 'gemname', '>= 2.2.0', '< 3.0'

, :

gem 'gemname', '~> 2.2'

"~ > " , 3,0. 2.X, 3.0.

, , , Rails. . , :

https://rubygems.org/gems/bootstrap/versions/4.0.0.alpha3.1

, . Rails, :

RUNTIME DEPENDENCIES (2):
autoprefixer-rails >= 6.0.3
sass >= 3.4.19
DEVELOPMENT DEPENDENCIES (13):
actionpack >= 4.1.5
activesupport >= 4.1.5
capybara >= 2.6.0
compass ~> 1.0.3
jquery-rails >= 3.1.0
json >= 1.8.1
minitest ~> 5.8.0
minitest-reporters ~> 1.0.5
poltergeist >= 0
slim-rails >= 0
sprockets-rails >= 2.3.2
term-ansicolor >= 0
uglifier >= 0

Rails :

rails >= 4

, Rails 4.0.

+2

gemfile :

,

gem 'gemname'

,

gem 'gemname', '1.0.0' # or whatever version you want to specify

,

gem 'gemname', '~> 1.0.0' # this will load version 1.0.x with x being the highest sub-version.
gem 'gemname', '~> 1.0' # will load version 1.x
gem 'gemname', '~> 1.3' # will load version 1.3 or higher but less than 2.0

gem gemfile , ( ), .

, Rails, rubygems.org Rails. , 2013 2016 , , Rails 4. Rails 5 ( 2016 ). , , Rails 4, Rails 5, Rails 5 , . 2013 ( Rails 3 ) .

0

Source: https://habr.com/ru/post/1675387/


All Articles