Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
code comments and readme tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
cycomachead committed Apr 27, 2015
1 parent 0fad9a9 commit 702e718
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 14 deletions.
32 changes: 23 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,38 @@
# [snap-cloud][hk-app]
A CS169 Project to create a new cloud sharing system for [Snap<i>!</i>][sbe].

* [![Code Climate](https://codeclimate.com/github/snap-cloud/snap-cloud/badges/gpa.svg)](https://codeclimate.com/github/snap-cloud/snap-cloud)
[![Code Climate](https://codeclimate.com/github/snap-cloud/snap-cloud/badges/gpa.svg)](https://codeclimate.com/github/snap-cloud/snap-cloud) [![Build Status](https://travis-ci.org/snap-cloud/snap-cloud.svg?branch=master)](https://travis-ci.org/snap-cloud/snap-cloud) [![Coverage Status](https://coveralls.io/repos/snap-cloud/snap-cloud/badge.svg?branch=master)](https://coveralls.io/r/snap-cloud/snap-cloud?branch=master) [![Test Coverage](https://codeclimate.com/github/snap-cloud/snap-cloud/badges/coverage.svg)](https://codeclimate.com/github/snap-cloud/snap-cloud) [![Inline docs](http://inch-ci.org/github/snap-cloud/snap-cloud.svg?branch=master)](http://inch-ci.org/github/snap-cloud/snap-cloud) [![Dependency Status](https://gemnasium.com/snap-cloud/snap-cloud.svg)](https://gemnasium.com/snap-cloud/snap-cloud)

* [![Build Status](https://travis-ci.org/snap-cloud/snap-cloud.svg?branch=master)](https://travis-ci.org/snap-cloud/snap-cloud)
For CS169: Please see the [wiki][wiki] for documentation about each iteration.

* [![Coverage Status](https://coveralls.io/repos/snap-cloud/snap-cloud/badge.svg?branch=master)](https://coveralls.io/r/snap-cloud/snap-cloud?branch=master)

Please see the [wiki][wiki] for documentation about each iteration.
# What is Snap<i>!</i>?
This section is `TODO`
- Snap<i>!</i> GH Repo
- Snap<i>!</i> homepage
- scratch site

## Setting Up
This project uses Rails 4.2 and Ruby 2.2.0.
This (currently) project uses Rails 4.2.1 and Ruby 2.2.1, and aims to be always
up to date!

The Heroku destination for the app is `http://ucbsnap.herokuapp.com`
The Heroku destination for the app is `https://ucbsnap.herokuapp.com`

1. **CLONE WITH `-r`** `git clone -r [email protected]:snap-cloud/snap-cloud.git`
1. You should have `rvm` or similar installed.
2. `bundle install --without production`
3. `git remote add heroku [email protected]:ucbsnap.git`

[hk-app]: http://ucbsnap.herokuapp.com
[hk-app]: https://ucbsnap.herokuapp.com
[sbe]: http://snap.berkeley.edu
[wiki]: https://github.com/snap-cloud/snap-cloud/wiki/Iteration-0-Deliverables
[wiki]: https://github.com/snap-cloud/snap-cloud/wiki/Iteration-0-Deliverables

## Development Notes

* GitHub Flow [link needed...]

* The awesome print gem
```
$ rails console
> require 'awesome_print'
ap SomeObject
```
20 changes: 15 additions & 5 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,26 @@ class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?


# Custom Error Methos
# Custom Error Methods
# These are app level errors that we can use to configure how to handle them
# They should be created when there is not an already applicable Rails error
# TODO: We need to determine for the best split up 401 and 404 errors.
module SnapException
class AccessDenied < StandardError; end
end

# Clean Error Handler Methods
# Use these in place of handling errors individually.
def access_denied # Equivalent 401
raise SnapException::AccessDenied.new('You don\'t have permission to view this.')
def access_denied(msg = nil) # Equivalent 401
default = 'You don\'t have permission to view this.'
msg ||= default
raise SnapException::AccessDenied.new(msg)
end

def item_not_found # Equivalent 404
raise ActiveRecord::RecordNotFound.new('Not Found')
def item_not_found(msg = nil) # Equivalent 404
default = "This item couldn't be found."
msg ||= default
raise ActiveRecord::RecordNotFound.new(msg)
end

rescue_from ActiveRecord::RecordNotFound, :with => :record_not_found
Expand All @@ -39,6 +46,9 @@ def configure_permitted_parameters
devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :password, :password_confirmation, :current_password) }
end

# This method allows stubbing in rspec testing.
# FIXME -- name should be migrated to get_current_user
# TODO: can't we just stub current_user method?
def getCurrentUser
current_user
end
Expand Down

0 comments on commit 702e718

Please sign in to comment.