diff --git a/.gitignore b/.gitignore index 279c889..4e92772 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ tmp/ .DS_Store public/extjs public/images/icons +config/database.yml diff --git a/Gemfile b/Gemfile index 94ea712..2de9c1f 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ gem 'decent_exposure', '~> 1.0.1' gem 'devise', '~> 2.0.4' gem 'haml-rails', '~> 0.3.4' gem 'jquery-rails', '~> 2.0' -gem 'sqlite3', '~> 1.3.5' +gem 'pg' gem 'will_paginate', '~> 3.0.3' # Gems used only for assets and not required diff --git a/Gemfile.lock b/Gemfile.lock index 9224536..b747243 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -133,6 +133,7 @@ GEM uglifier nokogiri (1.5.9) orm_adapter (0.0.7) + pg (0.15.1) polyglot (0.3.3) pry (0.9.12) coderay (~> 1.0.5) @@ -191,7 +192,6 @@ GEM multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.7) therubyracer (0.10.2) libv8 (~> 3.3.10) thor (0.18.1) @@ -239,13 +239,13 @@ DEPENDENCIES netzke-basepack (~> 0.8.0) netzke-cancan netzke-core (~> 0.8.0) + pg pry (~> 0.9.8) rails (= 3.2.13) rb-fsevent rspec-rails (~> 2.8.1) shoulda-matchers (~> 1.0.0) spork - sqlite3 (~> 1.3.5) turnip (~> 0.3.0) twitter-bootstrap-rails (~> 2.0.3) uglifier (>= 1.0.3) diff --git a/README.md b/README.md index d09e587..57c05f9 100644 --- a/README.md +++ b/README.md @@ -4,18 +4,29 @@ 1. allow the .rvmrc file 1. `gem install bundler` 1. `bundle` +1. Install Postgres (Mac OSX instructions below) 1. `rake db:create db:migrate` 1. `rake db:seed` 1. Download extJS 4.1 (A version of 4.1 is hosted here: http://my.jasondenney.com/extjs-4.1.1.zip) Latest versions at http://www.sencha.com/products/extjs. Unzip and place where ever you like. 1. Link to your extJS folder path under `public/extjs`: (From app root) `ln -s /MY/PATH/extjs/ public/extjs` 1. `rails s` + +# Postgres 9.2 Mac OSX Install +1. Install homebrew `ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"` +1. `brew install postgres` +1. First time db initialization `initdb /usr/local/var/postgres -E utf8` +1. Start Postgres `pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start` +1. Create your PG user `createuser -d -P velocipede` +1. Create your database `createdb -U velocipede --owner=velocipede velocipede` +1. Copy over DB config: `cp config/database.yml.example config/database.yml` +1. Update config with your database (velocipede), user (velocipede), and password. + # Optional Add icons - -1. Download icons from http://www.famfamfam.com/lab/icons/silk/ -1. Link to the icons under `public/images/icons`: (From app root) `ln -s /MY/PATH/famfamfam_silk_icons/icons public/images/icons` +1. Download icons from http://www.famfamfam.com/lab/icons/silk/ +1. Link to the icons under `public/images/icons`: (From app root) `ln -s /MY/PATH/famfamfam_silk_icons/icons public/images/icons` ## Mailcatcher diff --git a/config/database.yml b/config/database.yml deleted file mode 100644 index 51a4dd4..0000000 --- a/config/database.yml +++ /dev/null @@ -1,25 +0,0 @@ -# SQLite version 3.x -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' -development: - adapter: sqlite3 - database: db/development.sqlite3 - pool: 5 - timeout: 5000 - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: - adapter: sqlite3 - database: db/test.sqlite3 - pool: 5 - timeout: 5000 - -production: - adapter: sqlite3 - database: db/production.sqlite3 - pool: 5 - timeout: 5000 diff --git a/config/database.yml.example b/config/database.yml.example new file mode 100644 index 0000000..ab246bd --- /dev/null +++ b/config/database.yml.example @@ -0,0 +1,23 @@ +development: + adapter: postgresql + database: velocipede + username: velocipede + password: + host: 127.0.0.1 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + adapter: postgresql + database: velocipede + username: velocipede + password: + host: 127.0.0.1 + +production: + adapter: postgresql + database: velocipede + username: velocipede + password: + host: 127.0.0.1 diff --git a/db/migrate/20130419010051_add_ends_to_user_roles.rb b/db/migrate/20130419010051_add_ends_to_user_roles.rb index fe5352a..f86d61e 100644 --- a/db/migrate/20130419010051_add_ends_to_user_roles.rb +++ b/db/migrate/20130419010051_add_ends_to_user_roles.rb @@ -2,6 +2,5 @@ class AddEndsToUserRoles < ActiveRecord::Migration def change add_column(:user_roles, :ends, :timestamp) add_column(:user_roles, :user_id, :integer) - remove_column(:users, :role_id) end end diff --git a/db/migrate/20130423231937_alter_user_roles.rb b/db/migrate/20130423231937_alter_user_roles.rb index 329d470..9077687 100644 --- a/db/migrate/20130423231937_alter_user_roles.rb +++ b/db/migrate/20130423231937_alter_user_roles.rb @@ -1,9 +1,23 @@ class AlterUserRoles < ActiveRecord::Migration - def change + def up rename_table :user_roles, :user_role_joins change_table :user_role_joins do |t| t.rename :role, :role_id - t.change :role_id, :integer + #t.change :role_id, :integer + end + #for Postgres + connection.execute(%q{ + alter table user_role_joins + alter column role_id + type integer using cast(role_id as integer) + }) + end + + def down + rename_table :user_role_joins, :user_roles + change_table :user_role_joins do |t| + t.rename :role_id, :role + t.change :role_id, :string end end end diff --git a/db/migrate/20130614003934_remove_nickname.rb b/db/migrate/20130614003934_remove_nickname.rb index efa5b52..2962805 100644 --- a/db/migrate/20130614003934_remove_nickname.rb +++ b/db/migrate/20130614003934_remove_nickname.rb @@ -1,5 +1,5 @@ class RemoveNickname < ActiveRecord::Migration def change - remove_column :users, :nickname, :string + remove_column :users, :nickname end end