Installation

In this lesson, let's look at the dependencies we need to run the code in this course locally.

The basics

The code uses Ruby version 2.7.1, although use of 2.7 features should be minimal, and we think anything from 2.6.0 and up should work. We recommend installing a Ruby version manager such as RVM, rbenv, or chruby.

The code uses PostgreSQL, so you’ll need to have that set up on your machine. And you’ll need Node (version 10 or 12 should work) and Yarn (version 1.22; the 2.0 version doesn’t work with Webpacker yet) to help set up the Node packages.

We’re also assuming that you are broadly familiar with setting up Rails and its connection to the PostgreSQL database.

The code

If you’d like to follow along with the application throughout the course, you can download the sample code files from the course page on the Pragmatic Bookshelf website.

The sample code is split into a number of different directories, each corresponding to a different stage of the app in the course. Examples in the course will specify which directory is being used at any time.

If you download the code and run bin/setup within the introduction/01 directory (or any of the individual application directories), it will do the following:

  • Install bundler
  • Run a bundler install
  • Run rails db:setup
  • Run rails restart

With the app set up and the main branch running, you run it using rails s, and hit http://localhost:3000. You’ll see the schedule page, with a bunch of dates at the top, a search field in the middle, and a lot of schedule information at the bottom, with each scheduled day having an ugly button labeled “Hide.”

If you click on any of the concert names, you’ll be taken to a concert page that shows basic data as well as a grid of sets for the show. Neither of these pages has any interactivity at the moment.

If you want to keep following along, each separate step in the application is a different directory in the sample code download, and you can move from one to another to see the entire application at different steps.

Installing and using Redux

We first need to install Redux, the Redux bindings for React, and their associated type definitions:

$ yarn add redux react-redux @types/redux @types/react-redux

Get hands-on with 1400+ tech skills courses.