Install a specific version of a gem
To install webmock 1.5.0:
sudo gem install webmock --version "=1.5.0"
or
sudo gem install webmock -v "=1.5.0"
Related cards:
How to install a specific version of RubyGems (and how to downgrade)
Sometimes you want one distinct version of RubyGems to be installed to replicate the same behavior across multiple servers.
Usually would do this to update your RubyGems, but this always takes you to the latest version:
gem update --system
...
Github: How to find the Readme for a certain version of a gem
When a gem author releases a new version to Rubygems, usually a tag with the version number (e.g. v1.2.0
) is created an pushed to Github, so everyone can check out or take a look at the source code at this point version release at a later time.
...
How to install a frozen version of Firefox for your Selenium tests
Whenever Firefox updates, all your Cucumber features that use Selenium break. This is annoying.
In order to remedy this, version 0.5.0 of our geordi gem comes with a script that helps you create an unchanging ...
git: find the version of a gem that releases a certain commit
Sometimes I ran across a GitHub merge request of a gem where it was not completely obvious in which version the change was released. This might be the case for a bugfix PR that you want to add to your project.
Git can help you to find the next gi...
Test a gem in multiple versions of Rails
Plugins (and gems) are typically tested using a complete sample rails application that lives in the spec
folder of the plugin. If your gem is supposed to work with multiple versions of Rails, you might want to use to separate apps - one for each...
How to install a current version of git to your Ubuntu machine
As described by the linked Stackoverflow answer, run these commands:
sudo add-apt-repository ppa:git-core/ppa -y
sudo apt-get update
sudo apt-get install git
git --version
This will get you Git 2.6.4 (as of Dec 2015).
Troubleshooting...
Updated: Test a gem in multiple versions of Rails
Updated the card with our current best practice (shared app code and specs via symlinks).
Bundler: How to install version 1 instead of 2 (latest version)
When installing a gem you can use version comparators like >=
or ~>
. That way it is possible to fetch the latest version of Bundler 1 with this command:
gem install bundler -v '~>1'
[How to install bundler for Ruby < 2.3](/makandra/...
Run specific version of bundler
You can specify the version of bundler
to execute a command (most often you need an older version of bundler, but don't want to uninstall newer ones):
bundle _1.0.10_ -v
Bundler version 1.0.10
An example is rails 3.2, which fre...
Use the "paper_trail" gem to track versions of records
paper_trail
is an excellent gem to track record versions and changes.
You almost never want to reimplement something like it yourself. If you need to log some extra information, you can add them on top.
It comes with a really good README file...