Skip to content

Instantly share code, notes, and snippets.

@gelias
Created September 1, 2012 12:09
Show Gist options
  • Save gelias/3571380 to your computer and use it in GitHub Desktop.
Save gelias/3571380 to your computer and use it in GitHub Desktop.
Cardapiaria Setup
#!/bin/bash
clear
echo -e "Preparing to start ...\n"
cd /Users/gelias/workspace/ruby
echo -e "removing oldest version ... \n"
rm -rf /Users/gelias/workspace/ruby/cardapiaria
echo -e "using ruby version 1.9.3 and Rails 3.2"
rvm 1.9.3@rails32
echo -e "generating cardapiaria app"
rails new cardapiaria --database postgresql
cd cardapiaria
rails generate scaffold Establishment name:string description:string address:string phone:integer url:string
rails generate scaffold User establishment_id:integer login:string passwd:string email:string
#rails generate scaffold User login:string passwd:string email:string
rails generate scaffold Category establishment_id:integer description:string
#rails generate scaffold Category description:string
rails generate scaffold MenuItem category_id:integer name:string description:string price:decimal
#rails generate scaffold MenuItem name:string description:string price:decimal
echo -e "\nEdit menu_item migration file and replace the following line ..."
echo -e " t.decimal :price"
echo -e "to ..."
echo -e " t.decimal :price, :precision => 10, :scale => 2"
read -p "press any key to continue ... "
echo -e "generating migration and relationships"
#rails generate migration AddEstablishmentIdToUser establishment_id:integer
#rails generate migration AddEstablishmentIdToCategory establishment_id:integer
#rails generate migration AddCategoryIdToMenuItem category_id:integer
echo -e "\noverriding models ... "
rm -rf /Users/gelias/workspace/ruby/cardapiaria/config/database.yml
cp -rf /Users/gelias/workspace/ruby/cardapiaria_setup/database.yml /Users/gelias/workspace/ruby/cardapiaria/config/database.yml
cp -rf /Users/gelias/workspace/ruby/cardapiaria_setup/models /Users/gelias/workspace/ruby/cardapiaria/app
read -p "press any key to continue ... "
echo -e "\running migrations"
rake db:migrate
echo -e "\starting weBrick ..."
rails server
# t.decimal :price, :precision => 10, :scale => 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment