plusjade / makeist

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to Run Locally

The app is a standard Rails 4.x app.

Install Gems

$ bundle

Add API Keys

Dropbox and AWS S3 integration are not required locally. However you need to make sure you create the file config/sesames.json which holds the API keys:

{
    "dropbox" : {
        "key" : "KEY",
        "secret" : "SECRET"
    },
    "sentry-raven" : {
        "dsn" : "ENDPOINT"
    },
    "s3" : {
        "access_key_id" : "KEY",
        "secret_access_key" : "SECRET"
    }
}

Bad values should work as long as you aren't actually calling/using the service. More on that shortly.

Create a teacher

$ rails c
> t = Teacher.new(uid: 1, name: "Your Name", email: "email@test.com")
> t.valid?
> t.save

Note uid:1 is the uid from the Dropbox oAuth2 handshake. Setting it manually might cause problems, but let's get the app running first. Also, there is no password because makeist uses third-party authentication. We can get around that shortly.

Add Sample Data

Create a sample course with lessons and 12 students:

$ rails c
> require 'forgery' ; require 'factory_girl' ; FactoryGirl.reload
> c = FactoryGirl.create(:course, :with_lessons, name: "Sample")
> FactoryGirl.create_list(:student, 12, :full_sample, courses: [c])
> c.teachers << Teacher.first
> c.save

Avoid Dropbox Authentication Locally

Rewrite #current_user to return the user you want to be:

app/controllers/application_controller.rb

Teacher

def current_user
  return Teacher.first # <--- return a teacher and you are a teacher!
  return nil unless session[:user_id]
  @current_user ||= User.where(id: session[:user_id]).first
end

Student

def current_user
  return Student.first # <--- return a student and you are a student!
  return nil unless session[:user_id]
  @current_user ||= User.where(id: session[:user_id]).first
end

Start the App

$ rails s

and you're all set on http://localhost:3000/

About


Languages

Language:JavaScript 89.3%Language:Ruby 6.3%Language:CSS 4.3%