I'm investigating a rails app - the prod server has two version of a specific gem installed, how can I tell which version the prod app is using?
相关问题
- Question marks after images and js/css files in ra
- Using :remote => true with hover event
- Eager-loading association count with Arel (Rails 3
- Is there a way to remove IDV Tags from an AIFF fil
- Rails how to handle error and exceptions in model
相关文章
- Right way to deploy Rails + Puma + Postgres app to
- AWS S3 in rails - how to set the s3_signature_vers
- how to call a active record named scope with a str
- How to add a JSON column in MySQL with Rails 5 Mig
- “No explicit conversion of Symbol into String” for
- form_for wrong number of arguments in rails 4
- Rspec controller error expecting <“index”> but
- Factory_girl has_one relation with validates_prese
In Rails 3 and Rails 4, use
bundle show
In Rails 2,
rake gems
will print out what gems, dependencies, and versions are installed, frozen, etc.There's also a list in
Gemfile.lock
, located in the root directory of your app.For this reason I leave
Gemfile.lock
out of my.gitignore
. This has saved me more than once when I forgot to specify the gem version inGemFile
, and a gem got updated with breaking changes.If you use bundler, then you can get the version from
In the terminal
or
[gem-name] should be replaced as gem name you are going to look for.
script/about
will tell you what versions of the core Rails and Rack gems you're using, but not anything else. Ideally, if you look inconfig/environment.rb
, there should be a section that looks like this:With any luck, the author of the app will have included any required gems and versions there. However, the versions are optional in this file, and ultimately nothing stops an inexperienced developer from just slapping a
require 'rubygems'; require 'some_random_thing'
at the top of any given file.If you see that a gem is being required, but no version is specified, you can type
gem list
to see all the versions of all the gems on the system. By default, it will be using the latest one available.It took me longer than expected to find and sort through this information so I wanted to post it here in one place for others to view. I also wanted to clarify this a bit for Rails 3:
script/about has been replaced with
rake about
The details are here. If you are interested a list of all the command line changes for Rails 3 they can be found here.rake gems
does not work in Rails 3. Instead you should usebundle show
As an example, you can save all versions of your gems to a file for viewing with:
gem list > all_gems.txt
and you can see what versions your Rails app is using with:
bundle show > project_gems.txt
Using an editor like Vim you can easily use vimdiff to see the changes