See the live site at: exams.ryehigh.ca
Quick links: Hosting, Development
There is an admin bit on the User model that enables full control of adding/editing/removing content to the site. To make a new admin account first make a normal user account, and then manually flip the admin bit on that user.
Hopefully self-explanatory:
PAPERCLIP_STORAGE = {:filesystem, :s3}
AWS_S3_BUCKET
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
GOOGLE_ANALYTICS_ID
The CSCU Library is currently hosted on Heroku.
Deploying the site is as easy as git push heroku master
.
The files are all hosted on Amazon S3.
These are roughly the steps for setting up a dev environment.
gleaver:cscu $ git clone [email protected]:cscu/cscu-library.git && cd cscu-library
Cloning into 'cscu-library'...
remote: Counting objects: 871, done.
remote: Compressing objects: 100% (473/473), done.
remote: Total 871 (delta 417), reused 805 (delta 352)
Receiving objects: 100% (871/871), 152.93 KiB, done.
Resolving deltas: 100% (417/417), done.
gleaver:cscu-library(master) $ bundle install
...
Your bundle is complete!
gleaver:cscu-library(master) $ npm install
gleaver:cscu-library(master) $ npm install -g grunt-cli
gleaver:cscu-library(master) $ rake db:create
gleaver:cscu-library(master) $ rake db:migrate
Running rails server
will launch a local rails server running the app.
See below for the different linting/testing tools to run to check any changes you make.
When you have something neat, make a pull request to cscu/cscu-library on github!
Running grunt lint
will run both jshint and coffeelint on all of the Javascript and Coffeescript code respectively.
gleaver:library(readme) $ grunt lint
Running "jshint:gruntfile" (jshint) task
>> 1 file lint free.
Running "jshint:app" (jshint) task
>> 1 file lint free.
Running "coffeelint:app" (coffeelint) task
>> 4 files lint free.
Done, without errors.
Running rake rails_best_practices_html
will run rails_best_practices on all of the Ruby code to check it against Rails Best Practices rules. It will generate an HTML report in the root directory of the project.
gleaver:library(readme) $ rake rails_best_practices_html
Source Codes: |==============================================================================================================|
Source Codes: |==============================================================================================================|
Results written to [...]/rails_best_practices_output.html
Running bundle exec rake spec
will run all of the RSpec tests located in the spec/
folder.
gleaver:library(readme) $ bundle exec rake spec
/Users/gleaver/.rvm/rubies/ruby-1.9.2-p320/bin/ruby -S rspec ./spec/controllers/courses_controller_spec.rb ./spec/controllers/documents_controller_spec.rb ./spec/controllers/home_controller_spec.rb ./spec/models/course_spec.rb ./spec/models/document_spec.rb ./spec/models/prerequisite_spec.rb ./spec/models/user_spec.rb ./spec/requests/courses_spec.rb ./spec/requests/documents_spec.rb ./spec/routing/courses_routing_spec.rb ./spec/routing/documents_routing_spec.rb
........................................................................................................
Finished in 1.23 seconds
104 examples, 0 failures
Running bundle exec rake cucumber
will run all of the Cucumber tests located in the features/
folder.
gleaver:library(readme) $ bundle exec rake cucumber
/Users/gleaver/.rvm/rubies/ruby-1.9.2-p320/bin/ruby -S bundle exec cucumber --profile default
Using the default profile...
[...]
Feature: Finding a course
As a student
So that I can find documents for my course
I should be able to find my course
Background: Existing courses # features/find_course.feature:6
Given the following courses exist # features/step_definitions/course_steps.rb:1
| code | name |
| CPS109 | Intro to Computer Science |
| CPS305 | Data Structures |
Scenario: Select course from list # features/find_course.feature:12
Given I am on the courses page # features/step_definitions/web_steps.rb:44
When I follow "CPS109" # features/step_definitions/web_steps.rb:56
Then I should be on the course page for "CPS109" # features/step_definitions/web_steps.rb:230
Scenario: Search for course from homepage # features/find_course.feature:17
Given I am on the home page # features/step_definitions/web_steps.rb:44
When I search for "CPS109" # features/step_definitions/course_steps.rb:11
Then I should be on the course page for "CPS109" # features/step_definitions/web_steps.rb:230
[...]
8 scenarios (8 passed)
34 steps (34 passed)
0m1.964s