Skip to content

Latest commit

 

History

History
93 lines (70 loc) · 3.63 KB

README.md

File metadata and controls

93 lines (70 loc) · 3.63 KB

Welcome to CommonPlace

CommonPlace is a Social Networking Site that includes everything needed to create database-backed civic infrastructure according to the Model-View-Control pattern.

This pattern splits the view (also called the presentation) into "dumb" templates that are primarily responsible for inserting pre-built data in between HTML tags. The model contains the "smart" domain objects (such as Account, Product, Person, Post) that holds all the business logic and knows how to persist themselves to a database. The controller handles the incoming requests (such as Save New Account, Update Product, Show Post) by manipulating the model and directing data to the view.

In Rails, the model is handled by what's called an object-relational mapping layer entitled Active Record. This layer allows you to present the data from database rows as objects and embellish these data objects with business logic methods. You can read more about Active Record in link:files/vendor/rails/activerecord/README.html.

The controller and view are handled by the Action Pack, which handles both layers by its two parts: Action View and Action Controller. These two layers are bundled in a single package due to their heavy interdependence. This is unlike the relationship between the Active Record and Action Pack that is much more separate. Each of these packages can be used independently outside of Rails. You can read more about Action Pack in link:files/vendor/rails/actionpack/README.html.

Getting Started

  1. Install and setup Git
  2. Install RVM, and setup an installation of Ruby (1.9.2, or 1.9.3 if you want the tests to pass)
  3. Follow the steps in rvm notes
  4. Install Gem
  5. git clone [email protected]:commonplaceusa/commonplace.git
  6. cd commonplace
  7. gem install bundler
  8. If on OSX, install Homebrew
  9. Install Redis
  • sudo apt-get install redis-server
  • brew install redis
  1. Install ImageMagick
  • sudo apt-get install imagemagick libmagick9-dev
  1. Install Postgres
  • sudo apt-get install postgresql libpq-dev
  • brew install postgres
  1. Initialize the db: for OS X, see http://www.rubyinside.com/how-to-install-and-use-postgres-on-os-x-for-ruby-and-rails-development-4999.html

  2. Install MongoDB

  • sudo apt-get install mongodb
  • brew install mongodb
  1. bundle install
  2. cp config/database.yml.example config/database.yml
  3. Authenticate for the database
  • sudo su postgres
  • createuser username
  1. Run mongodb:
  • sudo start mongodb
  • mongod
  1. Run redis:
  • redis-server
  1. Run sunspot:
  • bundle exec sunspot-solr run
  1. Add the initial test community with bundle exec rake db:setup

Run the server with bundle exec foreman start or bundle exec rails s thin

And reindex solr with bundle exec rake sunspot:solr:reindex

Go to http://localhost:5000/test and login with [email protected]:password

Staging

commonplace-staging.herokuapp.com is the URL for staging hosted on Heroku (there are also personal stagings - they do not have Sunspot available).

Set the remote with git remote add staging [email protected]:commonplace-staging.git

Push to staging with git push -f staging

Push a branch to staging with git push -f staging branch-name:master

TDD

It's nice to have reasonable assurrance that you didn't bork something by making a simple change or git merge. That's why we <3 tests. Write them to conform to the spec before you start writing the feature, and write the feature to conform to the tests. Anything going into master should pass all test cases, and all new code should be tested to the hilt.