Skip to content

mokus80/learners_directory

Repository files navigation

About

The Rails Learners Directory is a crowdsourced directory of resources to learn programming. It enables learners to find resources appropriate for them. The Learners Directory is for learners and coaches of all levels who are looking for user-recommended learning resources. Users can submit resources.

Unlike a Google search, the Rails Learners Directory is a curated, organized set of user-recommended resources. Students and coaches alike can browse by cost, topic, skill-level, and much more. Our goal is that ratings and reviews help students and coaches find resources appropriate for them.

The Learners Directory was created by Laura Wadden and Nicole Felhösi during the 2013 Rails Girls Summer of Code. Many thanks to Duana Stanley, Deepak Jois, Tobias Pfeifer, Oliver Hookins and Daniel Kehoe for their coaching and support.

Features

  • User sign-in with GitHub and profile page

  • Post and tag a resource

  • Rate and Comment on a resource

  • Sort and browse resources by rating and tags

Demo

learnersdirectory.herokuapp.com/

Installation

Install git. Not yet a regular git user? Try this github overview.

Clone the Learners Directory into a directory of your choice:

git clone git@github.com:mokus80/learners_directory.git

Run bundle install:

bundle install

Database Initialization

These are working instructions - please fork or post a GitHub issue if you have improvements or comments.

Mac Users Install Postgres

If you don’t have it already, install homebrew and update homebrew.

install homebrew  
brew update

Install postgres:

brew install postgres

Linux Users Install Postgres

For Ubuntu or Debian

sudo apt-get update

Install postgres

sudo apt-get -y install postgresql postgresql-server-dev-9.1

Note: If you have another version of Postgres other than 9.1, switch the number at the end of this comman to your version.

All Operating systems follow the rest of these steps:

Run PostgresApp to start postgres

Download PostgresApp. Postgres will always run and you won’t need to start it on the command line everytime you start the server. To run PostgresApp, simply open it. Mac users will see a fun, tiny elephant sitting in their top bar.

Create the development, test and production databases

Become the postgres user:

sudo su - postgres

Edit the Host Base Authentification (hba) file:

vim /etc/postgresql/9.1/main/pg_hba.conf

Look for the line that looks like this (it’s close to the end, so look backwards from the end for this part):

local   all             all                         peer

Change ‘peer’ to ‘md5’:

local   all             all                         md5

Important: you must run this command in order to reload the file you just edited:

/etc/init.d/postgresql reload

Enter the postgres console:

psql template1

Type ‘help’ in the console if you need help or would like to see the postgres commands.

Create a user with a password. Remember these because you’ll need them later. I’ll use ‘username’ for the username, ‘password’ for the password and ‘mydatabase’ for the database. Create a postgres user:

CREATE USER username WITH PASSWORD 'password';

Allow this user to create a database:

ALTER USER ‘name’ CREATEDB;

Exit the postgresql console:

\q

Create the environment and production databases. Note: rake will automatically create or recreate the test database when you run the rake command.

rake db:create
rake db:migrate
rake db:seed

Edit the database.yml file

Copy config/database.yml.example to config/database.yml. Customize the contents of database.yml with your personal database name, username and password.

development:
    adapter: postgresql
    hostname: 127.0.0.1
    database: learners_directory
    pool: 5
    timeout: 5000
    username: your_username_here
    password: your_password_here

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.

test:
    adapter: postgresql
    hostname: 127.0.0.1
    database: learners_directory_test
    pool: 5
    timeout: 5000
    username: your_username_here
    password: your_password_here

production:
    adapter: postgresql
    hostname: 127.0.0.1
    database: learners_directory_production
    pool: 5
    timeout: 5000
    username: your_username_here
    password: your_password_here

Starting the App

We don’t want to hardcode the environment variables, so we use the foreman gem to set them. Create a new file called ‘.env’. [Note for Mac Users: It will ask if you’re sure, click yes. By putting the ‘.’ at the front of a filename, the file isn’t visible in the Finder. It’s a private file so no one else is able to see it.]

In the .env file, write your client_id and client_secret:

CLIENT_ID='git_hub client id here'  
CLIENT_SECRET='git_hub client password here'

The CLIENT_ID and CLIENT_SECRET are the credentials for the app to use GitHub. You need to sign up for GitHub API credentials: github.com/settings/applications/new. This process should give you back a CLIENT_ID and a CLIENT_SECRET.

  • DON’T FORGET: Never git commit this file because it’s your client ID and password and therefore it’s specific to you.

Now take a look at the Procfile. You should see:

dev: rails s

When we use the foreman gem on the command line, foreman uses this file to start the server.

In the command line run:

foreman start dev

This will start the server and run the application in development mode.

Now open localhost:3000 in your browser and you should see the app. If everything works, you can do a little dance now.

Database trouble? Don’t forget to run your PostgresApp.

Testing

Run all tests:

rake test

Run specific tests:

rake test path_to_file

Example:

rake test test/controllers/users_controller_test.rb

We’re using TravisCL for continuous integration. You can see the build here: travis-ci.org/mokus80/learners_directory/.

Ruby and Rails Versions

Ruby 1.9.3

Rails 4.0.0

Maintenance

The Rails Learners Directory was built by Nicole Felhösi and Laura Wadden during the 2013 Rails Girls Summer of Code as part of Team Rails Grrls. Felhösi and Wadden were coached by Duana Stanley, Deepak Jois, Oliver Hookins, Tobias Pfeiffer and Daniel Kehoe. To contact the owners, please message through github or tweet to @RailsGrrls.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •