Skip to content

Latest commit

 

History

History
93 lines (54 loc) · 2.27 KB

README.rdoc

File metadata and controls

93 lines (54 loc) · 2.27 KB

README

This README would normally document whatever steps are necessary to get the application up and running.

Things you may want to cover:

  • Ruby version

  • System dependencies

  • Configuration

  • Database creation

  • Database initialization

  • How to run the test suite

  • Services (job queues, cache servers, search engines, etc.)

  • Deployment instructions

Chase vehicle web site with Ruby 2.0 on Rails 4.0 framework.

Used Ruby Version Manager (rvm) version 1.19

Database

Redis DB is used for short-term database needs.

Main database is MongoDb using MongoMapper.

Create gemset “fh” under ruby 2.0

$ rvm use 2.0 $ rvm gemset create fh $ rvm 2.0@fh

Initial Framework:

Create rails framework without Active Record (will use MongoMapper) $ rails new FarHorizonsApp –skip-active-record

Make gemset switch automatic upon entering the project’s directory: $ cd <project name> $ echo fh > .ruby-gemset $ echo 2.0 > .ruby-version

Edit Gemfile to add mongo_mapper and redis:

# Database support gem ‘mongo_mapper’, :git => “git://github.com/mongomapper/mongomapper.git”, :tag => “v0.13.0.beta2” gem ‘redis’

run bundle install again:

$ bundle install

Initial model creation

Used Rails model generation with mongo_mapper template $ rails generate mongo_mapper:model <model> <key:type …>

Used rails built-in scaffolding for initial framework: $ rails generate scaffold <model> <key:type …>

NOTE: The scaffold-generated code uses the blah.update() method in the “update” controller action method. This is a private method in MongoMapper and it was manually replaced with the blah.set() method.

Serial IO with the ‘serialport’ gem

NOTE: ruby-serialport seems to conflict with serialport, so find and delete ruby-serialport directories in the 2.0@fh gemset directory.

Real-time data collection

Managed by script drivers in /bin directory initiated by:

(pid = fork) ? Process.detach(pid) : exec( "bin/<script name>" )

NOTE: Since the APRS and GPS device drivers need to create points via an API rather than form input, We have to bypass the Rails authenticity token machinery for the POST (create) method in the points_controller.

Please feel free to use a different markup language if you do not plan to run rake doc:app.