Ruby in Gitpod
It’s relatively easy to set up your Ruby project in Gitpod.
As of this writing, Gitpod comes with Ruby 2.6.6 pre-installed.
To use a different Ruby version (for example, 2.5.1) you can create a .gitpod.Dockerfile for your project, and then add something like the second paragraph to it:
FROM gitpod/workspace-full USER gitpod # Install Ruby version 2.5.1 and set it as default RUN echo "rvm_gems_path=/home/gitpod/.rvm" > ~/.rvmrc RUN bash -lc "rvm install ruby-2.5.1 && rvm use ruby-ruby-2.5.1 --default" RUN echo "rvm_gems_path=/workspace/.rvm" > ~/.rvmrc
💡 Explanation: Gitpod initially sets up RVM in
/home/gitpod/.rvm, but then later switches the RVM configuration directory to
/workspace/.rvm, so that any user-made changes (like installing new gems) are persisted within a Gitpod workspace. However, during the Dockerfile build, the
/workspacedirectory doesn’t exist yet, so we temporarily reset RVM’s configuration directory to
Here are a few Ruby example projects that are already automated with Gitpod:
|Ruby on Rails template||Ruby on Rails template with a PostgreSQL database|
|Forem||The platform that powers dev.to|
|GitLab||The open source end-to-end software development platform|
Here are a few useful extensions that you’ll likely want to install in your Ruby project.
With the Ruby test explorer, you can run unit tests from within the Gitpod UI. To add this extension to your repository, simply add these lines to your .gitpod.yml configuration file:
vscode: extensions: - firstname.lastname@example.org:HO9rpcRv7bmRIuo7Mty/zg== - email@example.com:koqDUMWDPJzELp/hdS/lWw==
Ruby On Rails
So, you want to write your cool new Ruby On Rails application in Gitpod? Well, here is an idea of how to do it. Please take a look at our minimal Rails example running in Gitpod: