Skip to content
This repository was archived by the owner on Sep 7, 2024. It is now read-only.

Rawneed/biblesearch-example-rails

Repository files navigation

Bible Search Example for Rails

  • Build Status: Stable Version
  • Build Status: Development Version

This Ruby on Rails application provides a simple way to create a website people can use to read the Bible in various languages. Use it as is or extend it for your own purpose. We'd love to hear about your enhancements!

A live demo is at http://lite.bibles.org.

This application uses the Bible Search API Gem and Scripture data from Bibles.org.

Quick Start

  1. Install Ruby on Rails.
  2. Get the code: git clone [email protected]:americanbible/biblesearch-example-rails.git.
  3. Enter the directory: cd biblesearch-example-rails.
  4. Grab needed libraries: bundle install.
  5. Run the tests: rake.
  6. Get your own Bible Search API Key.
  7. Create config/application.yml to contain your personal API key (follow the example in config/application.example.yml).
  8. Start the local server: bundle exec rails s.

Point your browser to http://0.0.0.0:3000 (you may have to open allow Ruby in your firewall). You should see your very own Bible search page.

About Caching

Most live web sites benefit from some amount of caching. Sites that utilize the Bible Search API benefit more than most because the Scripture data changes very little and is moderately large. Versions are updated from time-to-time, but usually those updates are very rare and very minor, so we've set caching on the Bible text to two weeks. New versions are a bit more common, so we've set the list of Bibles to update daily.

Besides speeding up your site and cutting bandwidth costs, caching also helps steward hosting costs donated by Bibles.org. It can be very useful to turn off caching to solve some kinds of bugs and configuration problems, but please turn it back on once the problem are solved.

In Rails production mode, this application uses Memcached or any drop-in replacement for it such as Amazon ElastiCache. In development mode, it uses file-system caching, but this can be turned off (details in the Configuration section below).

Configuration

This application is configured using Figaro. Your configuration settings go in config/application.yml or environment variables. See config/application.example.yml for an example.

Here are the configurable settings:

  1. BIBLESEARCH_API_KEY: your personal API key from Bibles.org. This key allows your application to fetch and use Scripture versions.
  2. DEFAULT_VERSION: the initial Bible version you want to display, like eng-GNTD for Good News Translation, US Version. You can look up these abbreviations on the full Bibles.org Reading Site.
  3. SITE_VERSIONS: A list of the versions you want people to be able to choose from [eng-GNTD,eng-CEV,spa-RVR60].
  4. RAILS_CACHE_STORE: the caching you want to use when running in local (development) mode. Defaults to file_store. Use null_store to disable caching.
  5. ELASTICACHE_ENDPOINT: if you accelerate your site with Amazon ElastiCache, this points to your cache store.

Taking it Further

If you don't know Ruby on Rails yet, it's a great tool to learn. If you know it already—or when you learn it—we welcome your enhancements as GitHub Pull Requests.

About

Sample Ruby on Rails Application built using the BibleSearch API

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors