This is a link to the project:Floating Sensors Network.
Installing the application means you must have rails set up, so lets install the packages.
Please do not try to use Rails with Windows. Performance will be greatly hindered,and gems will constantly fail to build. Linux is a free alternative that you can use with VirtualBox(also free).
Please instaill Xcode from the apps store, and then install Xcode Command Line Tools from Xcode → Preferences → Downloads, or install the standalone Xcode Command Line Tools package from here.
Next install homebrew
Since we use Postgres for our PostSQL database, the following is recommended:
Plan A(if using mac):
use this nifty guide:
Plan B(if using homebrew)
brew install postgres
Plan C(otherwise)
Download POSTSQL stable version at http://www.postgresql.org/download/
This tutorial will have you deploying a Ruby app in minutes.
Hang on for a few more minutes to learn how it all works, so you can make the most out of Heroku.
- a free Heroku account
Ruby installed – see the installation guides for Ruby and Rails on - OSX
- Linux
- Bundler installed – run gem install bundler
To get a new repository on your local computer:
- Fire up your terminal and type in the following:
- cd Desktop
- Starting from Desktop, mkdir “visualization” on your terminal
- cd “visualization”
- git clone git@github.com:luckyx1/visualization_for_drifter.git
- now you have everything!
- 1. run the following: rake db:migrate
- 2. "": rake db:seed
- 3. "": rails s(assuming your postsql is running in the background, consult the POSTSQL doc to see how to do that for your computer)
- 4. go to 0.0.0.0:3000 to see it locally!
To check if new updates has happened (while you have created no new content)
- git pull
To check if new updates has happpened(while you have created content)
- git add -A //Only do this if you are working on a branch
- git commit -m “what you were working on”
- git pull
- -fix any merge conflicts
How to push your changes
- git add “file_name”
- git commit -m “what you were working on”
- git pull
- -fix any merge conflicts
- git push
To create a branch
- git checkout -b branch_name
To push this branch to github
- git push origin branch_name
To switch to branch
- git checkout branch_name
To switch to master
- git checkout master
To update branch
- git pull master branch
To update master with branch
- git merge branch master
Currently the tool is being hosted on Heroku, so as follows, here is a guide to make heroku your friend and work with the app accordily.
To push to heroku do
- git add -A
- git commit -m “what you were working on”
- git pull
- fix merge
- git push
- git push heroku master
To update the database using POSTSQL, a backup must be initiated to keep data consistent.
The following is how we suggest the use of the DB
1. To prepare db for new data:
bash pull_db_from_heroku.sh
bash dump_heroku.sh
bash heroku_reset.sh
2. If you want to clear data locally do
bash clean_up.sh
3. If you want to put data currently on local to heroku do:
bash mirror_local.sh
OR do all this in one go with the following:
bash heroku_update.sh
* A note: you might have to configure the bash files to your own settings, so do this so I can git ignore these files afterwards.
To use SQL with rails
- rails console
- ActiveRecord::Base.connection.execute(‘SELECT * FROM users’)
To use POSTSQL
- psql
- \c “InternLeauge_development” lets you connect to that specific db
- \list shows all the db available
- \d list all the tables
On Heroku, in order to modify and work with data
*heroku pg:psql
To update the pgsl db:migrate(a hack)
*heroku run rake db:schema:load
How to find empty params in old data, then just update it manually when you find it:
- SELECT locaton, id
- FROM mytable
- WHERE COALESCE = ’’
- ;
How to reindex the numbers
ALTER SEQUENCE opportunities_id_seq RESTART WITH 1;
UPDATE opportunities SET id=nextval(‘opportunities_id_seq’);
UPDATE opportunities
SET id = nextval(‘opportunities_id_seq’);
Run with puma:
bundle exec puma -p 3001
This is a list of the team as of 06/05/2014. If you have committed to this project, please add your name and contact to the list.
Robert Erick Hernandez Jr. <r.hernandez@berkeley.edu>
Deepak <r.hernandez@berkeley.edu>
Nicolas Plain <r.hernandez@berkeley.edu>
Enjoy,
The WaterDrifter Team~