Do you know how to show in my application the version of gem? I don't need a rake task, I want to show the version in admin page.
Like e.g. "Gem::Version('bundler')"
To check if a specific version is installed, just add --version , e.g.: gem list -i compass --version 0.12.
Gems are located in the Gemfile inside your project folder.
Use `gem install -v` You may already be familiar with gem install , but if you add the -v flag, you can specify the version of the gem to install. Using -v you can specify an exact version or use version comparators.
The Gem command is included with Ruby 1.9+ now, and is a standard addition to Ruby pre-1.9.
You would use the following:
bundler_version = Gem.loaded_specs['bundler'].version
#=> Gem::Version.new("1.6.2")
The Gem::Version's string representation is just the version number.
puts bundler_version
# 1.6.2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With