How to run Ruby On Rails Project from GitHub

Kobe
2 min readJan 24, 2021

--

Step 1 Find the Ruby version

Look at .ruby-version in the Rails application directory
Find something like ruby '2.5.3' in Gemfile
FindRUBY VERSION in Gemfile.lock
Check README.md if the required Ruby version is written

Note Make sure all dependencies ready to use (rbenv installed)

Step 2 Install the ruby with the version you found

# List Ruby versions available
rbenv install --list
# Install Ruby 2.5.3
rbenv install 2.5.3
# Set a default version.
rbenv global 2.5.3

Step 3 Find the Bundler version

Bundler manages gems, but the mismatch of the bundler version may cause an error to occur. If you already have Bundler ( bundler — version), you could skip this section and see if it works. If an error that relates to Bundler versions occurs, an older or newer version may be required.

Find BUNDLED WITH in Gemfile.lock to find out the bundler version

Step 4 Install the Bundler version (found)

# Make sure you are using the desired Ruby version to install.
ruby --version
# To see if you already have Bundler installed
bundler --version
# Or
bundle --version
# This will install the bundler gem in Ruby 2.5.3
gem install bundler -v 2.0.1

Step 5 Take a look at file bin/setup

bin/setup is a script that installs dependencies and quickly setup. But I think this is sometimes forgotten and not up to date. If don’t have any strange just skip it.

Step 6 Install the required gems

bundle
# Or
bundle install

Note: You can bundle without production dependencies mode

bundle install --without production

Step 7 Install JavaScript packages if needed

In case you don’t have nodejs and yarn just install it.

sudo apt update && sudo apt upgradesudo apt-get install nodejs
node --version
npm --version
sudo apt update && sudo apt install yarn
yarn --version

Execute install package

yarn install

Step 8 Set up the database

If you are using DBMS such as PostgreSQL or MySQL, be sure that the DBMS service is running. The following command will create databases based on database.yml, load schema.rb, and seed the data by running seeds.rb.

bundle e rails db:setup

If there are pending migrations, also run the command

bundle e rails db:migrate

--

--

Kobe
Kobe

Written by Kobe

I’m working at KMS-Technology company. I love code (▀̿Ĺ̯▀̿ ̿) — Full Stack Software Engineer

No responses yet