Skip to content

Commit

Permalink
cleanup gems and add airbrake
Browse files Browse the repository at this point in the history
  • Loading branch information
wwahammy committed Jun 16, 2018
1 parent e843180 commit 48ece61
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 163 deletions.
57 changes: 19 additions & 38 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,66 +1,47 @@
# frozen_string_literal: true

source 'https://rubygems.org'
ruby '2.3.7'

gem 'rails', '4.2.10'

gem 'pg', '= 0.20'

gem 'sass-rails', '~> 5.0.0'

gem 'uglifier', '>= 1.3.0'

gem 'autoprefixer-rails'
gem 'coffee-rails', '~> 4.0.0'

gem 'font-awesome-rails'
gem 'jquery-rails'
gem 'sass-rails', '~> 5.0.0'
gem 'uglifier', '>= 1.3.0'

gem 'jbuilder', '~> 1.2'

gem 'responders', '~> 2.0'

gem 'rails_admin'

gem 'rack-attack'

gem 'redis-rails'

gem 'airbrake', '~> 7.3'
gem 'clockwork'
gem 'foundation-rails', '~> 5'
gem 'haml-rails'
gem 'newrelic_rpm'
gem 'oj'
gem 'rabl'

gem 'rack-attack'
gem 'rack-cors', require: 'rack/cors'
gem 'rails_autoscale_agent'

gem 'redis-rails'
gem 'responders', '~> 2.0'
gem 'unicorn'
gem 'watir'

gem 'chromedriver-helper'

gem 'oj'

gem 'clockwork'

gem 'haml-rails'

gem 'foundation-rails', "~> 5"

gem 'autoprefixer-rails'

gem 'font-awesome-rails'

group :production do
gem 'rails_12factor'
end

group :development, :test do
gem 'pry-rails'
gem 'chromedriver-helper'
gem 'better_errors'
gem 'binding_of_caller'
gem 'pry-rails'
gem 'rubocop'
end

group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end

gem 'unicorn'

gem 'newrelic_rpm'

gem 'rack-cors', require: 'rack/cors'
42 changes: 4 additions & 38 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
airbrake (7.3.4)
airbrake-ruby (~> 2.10)
airbrake-ruby (2.10.0)
archive-zip (0.11.0)
io-like (~> 0.3.0)
arel (6.0.4)
Expand Down Expand Up @@ -95,27 +98,10 @@ GEM
concurrent-ruby (~> 1.0)
io-like (0.3.0)
jaro_winkler (1.5.1)
jbuilder (1.5.3)
activesupport (>= 3.0.0)
multi_json (>= 1.2.0)
jquery-rails (4.3.3)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (5.0.5)
railties (>= 3.2.16)
kaminari (1.1.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.1.1)
kaminari-activerecord (= 1.1.1)
kaminari-core (= 1.1.1)
kaminari-actionview (1.1.1)
actionview
kaminari-core (= 1.1.1)
kaminari-activerecord (1.1.1)
activerecord
kaminari-core (= 1.1.1)
kaminari-core (1.1.1)
kgio (2.11.2)
loofah (2.2.2)
crass (~> 1.0.2)
Expand All @@ -126,8 +112,6 @@ GEM
mini_mime (1.0.0)
mini_portile2 (2.3.0)
minitest (5.11.3)
multi_json (1.13.1)
nested_form (0.3.2)
newrelic_rpm (5.2.0.345)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
Expand All @@ -148,9 +132,6 @@ GEM
rack-attack (5.2.0)
rack
rack-cors (1.0.2)
rack-pjax (1.0.0)
nokogiri (~> 1.5)
rack (>= 1.1)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.10)
Expand All @@ -175,19 +156,6 @@ GEM
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
rails_admin (1.3.0)
builder (~> 3.1)
coffee-rails (~> 4.0)
font-awesome-rails (>= 3.0, < 5)
haml (>= 4.0, < 6)
jquery-rails (>= 3.0, < 5)
jquery-ui-rails (~> 5.0)
kaminari (>= 0.14, < 2.0)
nested_form (~> 0.3)
rack-pjax (>= 0.7)
rails (>= 4.0, < 6)
remotipart (~> 1.3)
sass-rails (>= 4.0, < 6)
rails_autoscale_agent (0.3.1)
activesupport (>= 3.2)
rails_serve_static_assets (0.0.5)
Expand Down Expand Up @@ -218,7 +186,6 @@ GEM
redis-store (>= 1.2, < 2)
redis-store (1.5.0)
redis (>= 2.2, < 5)
remotipart (1.4.2)
responders (2.4.0)
actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
Expand Down Expand Up @@ -273,6 +240,7 @@ PLATFORMS
ruby

DEPENDENCIES
airbrake (~> 7.3)
autoprefixer-rails
better_errors
binding_of_caller
Expand All @@ -282,7 +250,6 @@ DEPENDENCIES
font-awesome-rails
foundation-rails (~> 5)
haml-rails
jbuilder (~> 1.2)
jquery-rails
newrelic_rpm
oj
Expand All @@ -293,7 +260,6 @@ DEPENDENCIES
rack-cors
rails (= 4.2.10)
rails_12factor
rails_admin
rails_autoscale_agent
redis-rails
responders (~> 2.0)
Expand Down
70 changes: 70 additions & 0 deletions config/initializers/airbrake.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Airbrake is an online tool that provides robust exception tracking in your Rails
# applications. In doing so, it allows you to easily review errors, tie an error
# to an individual piece of code, and trace the cause back to recent
# changes. Airbrake enables for easy categorization, searching, and prioritization
# of exceptions so that when errors occur, your team can quickly determine the
# root cause.
#
# Configuration details:
# https://github.com/airbrake/airbrake-ruby#configuration
Airbrake.configure do |c|
# You must set both project_id & project_key. To find your project_id and
# project_key navigate to your project's General Settings and copy the values
# from the right sidebar.
# https://github.com/airbrake/airbrake-ruby#project_id--project_key
c.project_id = 187866
c.project_key = '9d82fdce33a5edc3118ae68384b0fd8c'

# Configures the root directory of your project. Expects a String or a
# Pathname, which represents the path to your project. Providing this option
# helps us to filter out repetitive data from backtrace frames and link to
# GitHub files from our dashboard.
# https://github.com/airbrake/airbrake-ruby#root_directory
c.root_directory = Rails.root

# By default, Airbrake Ruby outputs to STDOUT. In Rails apps it makes sense to
# use the Rails' logger.
# https://github.com/airbrake/airbrake-ruby#logger
c.logger = Rails.logger

# Configures the environment the application is running in. Helps the Airbrake
# dashboard to distinguish between exceptions occurring in different
# environments.
# NOTE: This option must be set in order to make the 'ignore_environments'
# option work.
# https://github.com/airbrake/airbrake-ruby#environment
c.environment = Rails.env

# Setting this option allows Airbrake to filter exceptions occurring in
# unwanted environments such as :test.
# NOTE: This option *does not* work if you don't set the 'environment' option.
# https://github.com/airbrake/airbrake-ruby#ignore_environments
c.ignore_environments = %w(test)

# A list of parameters that should be filtered out of what is sent to
# Airbrake. By default, all "password" attributes will have their contents
# replaced.
# https://github.com/airbrake/airbrake-ruby#blacklist_keys
c.blacklist_keys = [/password/i, /authorization/i]

# Alternatively, you can integrate with Rails' filter_parameters.
# Read more: https://goo.gl/gqQ1xS
# c.blacklist_keys = Rails.application.config.filter_parameters
end

# A filter that collects request body information. Enable it if you are sure you
# don't send sensitive information to Airbrake in your body (such as passwords).
# https://github.com/airbrake/airbrake#requestbodyfilter
# Airbrake.add_filter(Airbrake::Rack::RequestBodyFilter.new)

# Attaches thread & fiber local variables along with general thread information.
# Airbrake.add_filter(Airbrake::Filters::ThreadFilter.new)

# Attaches loaded dependencies to the notice object
# (under context/versions/dependencies).
# Airbrake.add_filter(Airbrake::Filters::DependencyFilter.new)

# If you want to convert your log messages to Airbrake errors, we offer an
# integration with the Logger class from stdlib.
# https://github.com/airbrake/airbrake#logger
# Rails.logger = Airbrake::AirbrakeLogger.new(Rails.logger)
3 changes: 2 additions & 1 deletion config/initializers/rack_attack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
now = Time.now
match_data = env['rack.attack.match_data']

reset = (now + (match_data[:period] - now.to_i % match_data[:period])).to_s
headers = {
'X-RateLimit-Limit' => match_data[:limit].to_s,
'X-RateLimit-Remaining' => '0',
'X-RateLimit-Reset' => (now + (match_data[:period] - now.to_i % match_data[:period])).to_s
'X-RateLimit-Reset' => reset
}

[429, headers, ["Throttled\n"]]
Expand Down
36 changes: 0 additions & 36 deletions config/initializers/rails_admin.rb

This file was deleted.

50 changes: 0 additions & 50 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
WorldCupJson::Application.routes.draw do
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
get '/teams', to: 'teams#index', defaults: { format: 'json' }
Expand All @@ -16,53 +15,4 @@

# You can have the root of your site routed with "root"
root 'static#index'

# Example of regular route:
# get 'products/:id' => 'catalog#view'

# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase

# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products

# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end

# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end

# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end

# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable

# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end

0 comments on commit 48ece61

Please sign in to comment.