Cheesy-Quote is an app that inspires you with deliciously cheesy quotes!
- Displays random quotes or a list of all quotes in the database
- Admin functionality to add quotes or edit/destroy existing ones
- Search function powered by ElasticSearch
- Quotes are scored on a CheesyScale™ that indicate how cheesy they are
- Tested with RSpec
- Continuous Integration through Codeship
- All branches pushed to this repository are automatically tested.
- This app deploys on heroku. The master branch is automatically tested and deploys upon passing the test suite.
- Automatically generated documentation using YARD
- Ruby version
- 2.4.2
- Rails version
- 5.1.4
-
Clone the repository
-
Run bundle install ->
bundle install
-
Create, load schema and seed the database ->
rake db:setup
-
Install and start elasticsearch -> ```
brew install elasticsearch
elasticsearch
--config=/usr/local/opt/elasticsearch/config/elasticsearch.yml
```
-
Import data from your models into elastic search ->
bundle exec rake environment elasticsearch:import:model CLASS='Quote'
-
Add the google api and cse keys ->
The cheesy_scale uses a google api key and custom search engine (CSE) key.
They need to be added to a file called environment_variables.yml - Make the filetouch config/environments/environment_variables.yml
- Add the keys to the file. You can get your keys heredevelopment: GOOGLE_API_KEY: "YourApiKeyHere" GOOGLE_CUSTOM_SEARCH_ENGINE_KEY: "YourCustomSearchEngineKeyHere" test: GOOGLE_API_KEY: "YourApiKeyHere" GOOGLE_CUSTOM_SEARCH_ENGINE_KEY: "YourCustomSearchEngineKeyHere"
- Configure your custom search engine to search the entire web. -
Start server and run the first update cheesy score
rails s
- Log in as an admin at localhost:3000/admins/sign_in
- Use the email and password from db/seeds.rb
- Use "Update Cheesy Score" in the navbar at the bottom of the screen to get the initial cheesiness scores -
Enjoy the deliciously cheesy quotes!
This app is tested with Rspec to run the tests use ->
bundle exec rspec
The documentation for this app is automatically generated using yard. To generate the documentation on your local machine use ->
yard doc
-
The search functionality is powered by elasticsearch-rails. For more information visit their github repository
-
The CheesyScale™ makes use of Google Custom Search to assign each quote a cheesy score. For more information visit google's CSE portal
- If you want to deploy your own version start with this guide provided here by heroku:
- During deployment the app uses bonsai as a hosted elasticsearch provider.
Provision your app with bonsai (using heroku command line interface) and import the models into elasticsearch
heroku addons:create bonsai:sandbox-10
heroku run bundle exec rake environment elasticsearch:import:model CLASS='Quote' FORCE=y
- Set your Google api and google CSE keys as env variables in heroku
heroku config:set GOOGLE_API_KEY="YourApiKeyHere"
heroku config:set GOOGLE_CUSTOM_SEARCH_ENGINE_KEY="YourCustomSearchEngineKeyHere"