/charcutio-web

Meat on the web

Primary LanguageRuby

Charcutio Web

Installation

  1. git clone https://github.com/9mmedia/charcutio-web.git

  2. Use latest Ruby using ruby-build and rbenv. If you just did a fresh Ruby install run the following commands:

     gem update --system
     gem update
     gem install bundler rake foreman rails mailcatcher --no-rdoc --no-ri
    
  3. Create Heroku account, install Toolbelt and login using heroku CLI

  4. Set a Heroku git remote. You can name it something else but examples in other sections will use heroku as the remote name.

     git remote add heroku git@heroku.com:charcutio-web.git
    
  5. Install Homebrew

  6. brew update

  7. brew install postgresql

  8. Follow any post installation instructions given by Homebrew

  9. Move /usr/local/bin so our PostgreSQL install is used over the system install (OSX) and reload the current bash session since we updated the PATH variable.

     echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
     source ~/.bash_profile
    
  10. gem uninstall pg since if previously installed, gem might continue to use the wrong PostgreSQL installation

  11. bundle install

  12. createuser -d -r -S charcutio

  13. createdb -O charcutio charcutio_development

  14. createdb -O charcutio charcutio_test

  15. bundle exec rake db:migrate

  16. bundle exec rake db:test:prepare

  17. foreman start to start the server

Run Tests

  1. (Optional) Run migrations and prepare test environment database

     bundle exec rake db:migrate && bundle exec rake db:test:prepare
    
  2. Start the server using foreman start

  3. bundle exec rspec

  4. Client side tests use QUnit through qunit-rails gem. Go to http://localhost:5000/qunit to see and run the QUnit Test Runner.

Data API

Simple implementation to get started with data pushing.

Create a new box, returns box id.

POST /boxes {"api_key": "API_KEY", "name": "Box Name"}

Report data point

POST /boxes/:id/report {"api_key": "API_KEY", "type": "temp", "value": 55.6}

Get temperature/humidity set points

GET /boxes/:id/set_points {"api_key": "API_KEY"}

Tweet a photo.

POST /boxes/:id/photo {"api_key": "API_KEY", "image_file": multipart_file}