Merge develop

This commit is contained in:
Devin Howard 2016-04-20 11:25:59 +08:00
commit 437c73b0fe
5 changed files with 105 additions and 68 deletions

View file

@ -16,14 +16,17 @@ export DEVISE_SECRET_KEY='f71c467e526f23d614b3b08866cad4788c502bed869c282f06e73e
# export AWS_ACCESS_KEY_ID
# export AWS_SECRET_ACCESS_KEY
# export SSO_KEY
#
#
# export SMTP_DOMAIN
# export SMTP_PASSWORD
# export SMTP_PORT
# export SMTP_SERVER
# export SMTP_USERNAME
# # send exception notifications to a slack incoming webhook
# export SLACK_EN_WEBHOOK_URL
#ruby garbage collection stuff
# ruby garbage collection stuff
export RUBY_GC_TUNE=0 #set to 1 to enable GC test
export RUBY_GC_TOKEN=4f4380fc9a2857d1f008005a3eb86928

72
Gemfile
View file

@ -3,67 +3,59 @@ ruby '2.1.3'
gem 'rails', '4.2.4'
gem 'active_model_serializers', '~> 0.8.1'
gem 'aws-sdk', '< 2.0'
gem 'best_in_place' #in-place editing
gem 'delayed_job', '~> 4.0.2'
gem 'delayed_job_active_record', '~> 4.0.1'
gem 'devise'
gem 'redis'
gem 'doorkeeper'
gem 'dotenv'
gem 'exception_notification'
gem 'formtastic'
gem 'formula'
gem 'httparty'
gem 'json'
gem 'kaminari' # pagination
gem 'paperclip'
gem 'pg'
gem 'pundit'
gem 'pundit_extra'
gem 'doorkeeper'
gem 'formula'
gem 'formtastic'
gem 'json'
gem 'rails3-jquery-autocomplete'
gem 'best_in_place' #in-place editing
gem 'kaminari' # pagination
gem 'uservoice-ruby'
gem 'dotenv'
gem 'snorlax'
gem 'rack-cors'
gem 'httparty'
gem 'active_model_serializers', '~> 0.8.1'
gem 'delayed_job', '~> 4.0.2'
gem 'delayed_job_active_record', '~> 4.0.1'
gem 'paperclip'
gem 'aws-sdk', '< 2.0'
gem 'rails3-jquery-autocomplete'
gem 'redis'
gem 'slack-notifier'
gem 'snorlax'
gem 'uservoice-ruby'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'jbuilder'
#gem 'therubyracer' #optional
#gem 'rb-readline'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'sass-rails'
gem 'uglifier'
# gem 'therubyracer'
end
group :test do
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'shoulda-matchers'
gem 'simplecov', require: false
gem 'json-schema'
end
group :production do #this is used on heroku
#gem 'rmagick'
group :production do
gem 'rails_12factor'
end
group :test do
gem 'factory_girl_rails'
gem 'json-schema'
gem 'rspec-rails'
gem 'shoulda-matchers'
gem 'simplecov', require: false
end
group :development, :test do
gem 'pry-rails'
gem 'pry-byebug'
gem 'better_errors'
gem 'binding_of_caller'
gem 'pry-byebug'
gem 'pry-rails'
gem 'quiet_assets'
gem 'tunemygc'
end

View file

@ -89,6 +89,9 @@ GEM
railties (>= 3.2)
dotenv (2.1.0)
erubis (2.7.0)
exception_notification (4.1.4)
actionmailer (~> 4.0)
activesupport (~> 4.0)
execjs (2.6.0)
ezcrypto (0.7.2)
factory_girl (4.5.0)
@ -229,6 +232,7 @@ GEM
json (~> 1.8)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
slack-notifier (1.5.1)
slop (3.6.0)
snorlax (0.1.5)
rails (> 4.1)
@ -270,6 +274,7 @@ DEPENDENCIES
devise
doorkeeper
dotenv
exception_notification
factory_girl_rails
formtastic
formula
@ -296,6 +301,7 @@ DEPENDENCIES
sass-rails
shoulda-matchers
simplecov
slack-notifier
snorlax
tunemygc
uglifier

View file

@ -158,35 +158,34 @@ class MapsController < ApplicationController
@map.arranged = false
if params[:topicsToMap]
@all = params[:topicsToMap]
@all = @all.split(',')
@all.each do |topic|
topic = topic.split('/')
mapping = Mapping.new()
mapping.user = @user
mapping.mappable = Topic.find(topic[0])
mapping.xloc = topic[1]
mapping.yloc = topic[2]
@map.topicmappings << mapping
authorize mapping, :create
mapping.save
end
@all = params[:topicsToMap]
@all = @all.split(',')
@all.each do |topic|
topic = topic.split('/')
mapping = Mapping.new
mapping.map = @map
mapping.user = @user
mapping.mappable = Topic.find(topic[0])
mapping.xloc = topic[1]
mapping.yloc = topic[2]
authorize mapping, :create?
mapping.save
end
if params[:synapsesToMap]
@synAll = params[:synapsesToMap]
@synAll = @synAll.split(',')
@synAll.each do |synapse_id|
mapping = Mapping.new()
mapping.user = @user
mapping.map = @map
mapping.mappable = Synapse.find(synapse_id)
@map.synapsemappings << mapping
authorize mapping, :create
mapping.save
end
if params[:synapsesToMap]
@synAll = params[:synapsesToMap]
@synAll = @synAll.split(',')
@synAll.each do |synapse_id|
mapping = Mapping.new
mapping.map = @map
mapping.user = @user
mapping.mappable = Synapse.find(synapse_id)
authorize mapping, :create?
mapping.save
end
end
@map.arranged = true
@map.arranged = true
end
authorize @map

View file

@ -0,0 +1,37 @@
require 'exception_notification/rails'
ExceptionNotification.configure do |config|
# Ignore additional exception types.
# ActiveRecord::RecordNotFound, AbstractController::ActionNotFound and
# ActionController::RoutingError are already added.
config.ignored_exceptions += %w(
ActionView::TemplateError CustomError UnauthorizedException
InvalidArgumentException InvalidEntityException InvalidRequestException
NotFoundException ValidationException
)
# Adds a condition to decide when an exception must be ignored or not.
# The ignore_if method can be invoked multiple times to add extra conditions.
config.ignore_if do |_exception, _options|
!Rails.env.production?
end
# Notifiers ######
if ENV['SLACK_EN_WEBHOOK_URL']
config.add_notifier :slack, webhook_url: ENV['SLACK_EN_WEBHOOK_URL']
end
# Email notifier sends notifications by email.
# config.add_notifier :email, {
# :email_prefix => "[ERROR] ",
# :sender_address => %{"Notifier" <notifier@example.com>},
# :exception_recipients => %w{exceptions@example.com}
# }
# Webhook notifier sends notifications over HTTP protocol. Requires 'httparty' gem.
# config.add_notifier :webhook, {
# :url => 'http://example.com:5555/hubot/path',
# :http_method => :post
# }
end