Picture

Hiring Assessment Application

  • A hiring assessment application to determine whether an applicant is suitable for working remotely and fulfilling a strategy consultant role.

Table of Contents

  1. Getting Started

    1. Installing Atom text editor

  2. Viewing this Application

    1. Clone down this application locally

    2. Take the application live

  3. Editing this Application

  4. Uploading your project with Heroku

Prerequisites

  • Rails
  • PostgreSQL

Technologies Used

  • HTML/CSS
  • Ruby
  • Rails
  • PostgreSQL

Getting Started

Installing Atom

Atom

Atom was designed with the developer in mind by adding features and customization that help developers write their code more productively.

Windows / Linux Installation Instructions

  • Accessing the Terminal

Windows Setup

Windows uses a Terminal program as well, but a Terminal with all the capabilities we'll require is not installed by default.

There are many options available, but we recommend using a terminal program called git bash. You can download this free program at https://git-for-windows.github.io/.

Installing Ruby on Rails

On Windows, the easiest way to install Ruby is with the RailsInstaller, which includes Ruby and a few other tools. Go to this page: http://railsinstaller.org/en and install ruby 2.3 for windows.

Installing PostgresSQL

Windows Setup

  1. Download and install postgres here: https://www.enterprisedb.com/downloads/postgres-postgresql-downloads#windows.

  2. Keep all of the default options and use a password that you will remember, you're going to need this soon.

  3. Change environment variables such that Path (for system, not user) is: C:\Program Files\PostgreSQL\9.0\bin

Picture

Picture

Don't forget to change access rights to folder PostgreSQL\9.0 and remove any default readonly rights on the folder or content. (You may also need to restart your computer for these to take effect)

Picture

  1. Test Postgres installation by trying to create a new database: From command line: createdb -U postgres mydb_as_postgres. You should be prompted to enter the password now, if you're not it may be that you need to start the server first. The easiest way is through pgAdmin IV, which should be 'pgAdmin4.exe' in a folder somewhere like C:\Program Files\PostgreSQL\9.0\bin. Once you've started pgAdmin IV there should be a panel on the left called 'Object Browser'.

Picture

In this there should be a tree with:

Server Groups > Servers > PostgreSQL 9.0 (localhost:5432)

Right click on 'PostgreSQL 9.0 (localhost:5432)' and select 'Connect'.

The createdb -U postgres mydb_as_postgres command should create a new databse called 'mydb_as_postgres' which you can check by firing up pgAdmin III and double clicking on 'PostgreSQL 9.0 (localhost:5432)'. Under this there should be:

Databases (2) which should list 2 databases called mydb_as_postgres and postgres

I called it _as_postgres because the -U postgres part of the command tells Postgres to create the database with the postgres user as it's owner, which you need to specify when you're not signed in as the postgres user. I have all of my files stored as 'Aaron' user though so if you're the same and want to keep developing your app when signed in as a different user you need to create a Postgres 'role' for that user now (see step 5).

  1. Through pgAdmin III. Right-click on Login Roles (which for me is in):

Object Browser > Server Groups > Servers > PostgreSQL 9.0 (localhost:5432) > Login Roles

Right-click on Login Roles and select 'New Login Role...' in Role name, put in your operating system user name, which for me is Aaron, and fill in your password under the 'Role Privileges' tab. Then check all the boxes including 'Superuser' and 'Can create roles'.

Picture

Picture

Picture

  1. You should now be able to create a new database without being signed in as the postgres user. Try typing:

created database mydb_as_user;

Picture


Viewing the application

Setup Requirements

  1. Clone the directory to your local machine.

Picture

Picture

  1. Navigate to project root directory.

cd Artemis

Picture

  1. Run $ bundle to install necessary gems.
  2. Run $ rails db:create and $ rails db:migrate to initialize the database. Run $ rails db:migrate RAILS_ENV=test to enable rspec tests.
  3. Run $ rails db:seed to populate the database with data.
  4. Run $ rails server to start the app. Navigate to 'localhost:3000' in your browser.

Editing the Application

  • Make sure you're in the project folder in your terminal

  • Open the application in your Atom text editor with the following command:

$ atom .

Note that there is a period following the atom command. This is telling the terminal to open all of the files in your current directory under atom.

  • Navigate to the db folder in the project directory, then select the file seeds.rb

Picture

  • You'll see a method called make_questions

Picture

  • This contains the questions and their related section number

  • Further down you'll see the text for quiz answers and their value

Picture

  • Make the necessary changes, CTRL+S to save and rails s in your terminal. To see the changes locally on your browser at 'localhost:3000'

Uploading your project with Heroku

  • Create an account at https://www.heroku.com/
  • Open a terminal or command prompt.
  • When you start working on a new computer, generate a new pair of SSH keys by typing $ ssh-keygen -t rsa -C your_email@address.com. Press enter without typing anything when it prompts you for the file and for the passphrase. If it prompts you to overwrite the existing keys, say yes.
  • Run $ heroku login and enter your Heroku credentials when prompted.
  • Run $ heroku keys:add to add the SSH keys for this machine to your Heroku account.
  • Navigate to the project directory in your terminal.
  • Set up your Heroku app.
  • If you haven't created a Heroku app yet, run $ heroku create your_app_name.
  • If you have already created a Heroku app for this project, run $ heroku git:remote -a your_app_name to add a Git remote called heroku that points to your Heroku app. In this case it will artemisproject191117
  • Push your code to Heroku with $ git push heroku master and if necessary, migrate your database using heroku run rake db:migrate and heroku run rake db:seed if you need to seed the database.
  • When you're done with the machine, remove your SSH keys from Heroku with $ heroku keys:remove your_email@address.com, delete them from the computer with $ rm ~/.ssh/*, and log out of Heroku with $ heroku logout. If you get the error Permission denied (publickey), run $ rm ~/.ssh/* to clear the SSH settings off the machine, and then try again starting with step 1.