Pregunta

What is the exact difference between using:

1- gem install [gemname]

and

2- add gem name & version to GemFile and run bundle install

?

¿Fue útil?

Solución

RubyGems is akin to a package manager for Ruby. It's a means by which you can install self-contained libraries to use in your applications. When you use gem install gemname you're installing that gem to the current machine that you're developing on.

Bundler is a tool for managing the gems that your application depends on. When you create a Gemfile, you list the various gems and their versions that your application requires. This allows you to easily ensure that your application has the gems it needs when you deploy it to a new location - for example, when you push to Heroku, your Gemfile is used to determine all the dependencies of your application.

Running bundle install will take the list of required gems in your gemfile and install them if they aren't installed already, just like doing gem install for each gem that your application needs.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top