This is the Turing MentorSHIP project. It is written in Rails 5.
##Contributers Add yourself to this list if you helped.
- Mark Miranda (1602)
- Josh Washke (1602)
- Christopher Soden (1603)
- Parker Phillips (1603)
- Megan Talbot (1608)
- John Kimble (1608)
- Vido Seaver (1608)
- Ben Pepper (1608)
- Ryan Spink (1611)
- Daniel Olson (1611)
- Valerie Trundell (1611)
- Ediline Cruz (1611)
- Ashley Schauer (1611)
git clone git@github.com:turingschool-projects/MentorSHIP.git
cd MentorSHIP
bundle exec rake db:create db:migrate db:seed
So because of the Oauth Census had to use there are special instructions for running a local server. This walkthrough will get you set up to run a local HTTPS server so you can run dev server and test locally.
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
$ openssl rsa -in server.orig.key -out server.key
$ openssl req -new -key server.key -out server.csr
Fill out the Common Name field as follows and skip the rest:
Common Name: localhost.ssl
- MUST have localhost.ssl as the common name to keep browsers happy
$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
$ echo "127.0.0.1 localhost.ssl" | sudo tee -a /private/etc/hosts
$ bundle exec figaro install
This will add an application.yml file to your config folder.
On Slack, open the public channel called 'mentorship-project'. There are a series of snippets on that channel. One has all the application keys. Copy and paste that entire snippet into your application.yml file.
Add your census keys to the application.yml file. Use fuzzy finder(cmd + t) if you can't see the file in your file tree. Keys should be formatted as such.
- CENSUS_ID: eba503f490a06e4065366baa96 (CHANGE )
- CENSUS_SECRET: 78a08c6eafac10bd1adb2c05fd107 (CHANGE TO YOUR PRODUCTION SECRET)
- CENSUS_ACCESS_TOKEN: 3d8f68e0aa477176133655427eff29e7b77de72 (CHANGE TO YOUR PRODUCTION TOKEN)
- CENSUS_URL: "https://turing-census.herokuapp.com" (USE THIS URL FOR PRODUCTION ON HEROKU)
- GEONAMES_USERNAME: 'turing.mentorship' (USE THIS)
thin start -p 3001 --ssl --ssl-key-file ~/.ssh/server.key --ssl-cert-file ~/.ssh/server.crt
Travis CI is a continuous integration tool that receives a webhook everytime you update a branch to a repo you've told it to follow. It deploys your application for each branch you pull request and runs your tests. If either of those things fail (deploying or tests) you will see a red X next to your pull request.
In order for it to work you must have a travis.yml file. The following is in our .travis.yml which essentially acts as a travis config and lives in your root directory.
For more info go here
language: ruby
rvm:
- 2.3.0
script:
- bundle exec rake db:setup
- bundle exec rspec
cache: bundler
services:
- postgresql
addons:
postgresql: "9.4"
When pushing to Heroku are making sure to complete the following rake tasks:
$ rake assets:clobber
$ rake asssets:precompile
# then recommit and push
Also, ensure your config variables for Heroku, Travis, and in the application.yml file all match. If they don't, Travis will fail and Heroku requests to Census will break.
-
Production environment:
-
Staging environment:
- (DEPRECATED) https://turing-mentorship-staging.herokuapp.com/
To get access to both of the above reach out to your Project Manager / Project Owner and they will add you to the app.
To run the tests:
bundle exec rspec
To populate the seed file with mentors, we hit the Census API with a unique access token. This token expires every 90 days. The current token was generated on 05/30/2017. If you are trying to run rake db:seed after the last token was expired, you will need to OAuth in first and get a new access token.
To create a new token do the following:
- Place a
pryat the top of Session#create method. - Boot your
thinserver (See Running / Development for details) and log in with Census. - After logging in, you will hit the
pry, and in params find your unique access token. - Update the
CENSUS_ACCESS_TOKENin the application.yml with this token.
On Slack, open the public channel called 'mentorship-project'. There are a series of snippets on that channel. One has all the application keys. Copy and paste that entire snippet into your application.yml file.
Example Request:
/api/v1/mentors
Example Response:
{
"mentors": [
{
"id": 1,
"avatar": "https://avatars2.githubusercontent.com/u/14855129?v=3&s=460",
"name": "mentor 0",
"email": "mentor0@turing.io",
"phone_number": "555-555-5555",
"slack_username": "mentor0",
"location": "Denver",
"timezone": "MT",
"bio": "Former Student, current mentor!",
"expertise": "Rails, Javascript, Postgres",
"company": "Turing",
"position": "Senior Developer",
"last_active": "2 days ago"
},
{
"id": 2,
"github_avatar": "https://avatars2.githubusercontent.com/u/14855129?v=3&s=460",
"name": "mentor 1",
"email": "mentor1@turing.io",
"phone_number": "555-555-5555",
"slack_username": "mentor1",
"location": "Denver",
"timezone": "MT",
"bio": "Former Student, current mentor!"
"expertise": "Rails, Javascript, Postgres",
"company": "Turing",
"position": "Senior Developer",
"last_active": "2 days ago"
}
]
}
Example Request:
/api/v1/mentors/1
Example Response:
{
"mentor": {
"id": 1,
"github_avatar": "https://avatars2.githubusercontent.com/u/14855129?v=3&s=460",
"name": "mentor 0",
"email": "mentor0@turing.io",
"phone_number": "555-555-5555",
"slack_username": "mentor0",
"location": "Denver",
"timezone": "MT",
"bio": "Former Student, current mentor!",
"expertise": "Rails, Javascript, Postgres",
"Company": "Turing",
"Position": "Senior Developer",
"last_active": "2 days ago"
}
}

