rubocop
This commit is contained in:
parent
2dc6a948c6
commit
fc701cf485
33 changed files with 82 additions and 29 deletions
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative 'boot'
|
||||
|
||||
require 'csv'
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
||||
|
||||
require 'bundler/setup' # Set up gems listed in the Gemfile.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Load the Rails application.
|
||||
require_relative 'application'
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb
|
||||
|
||||
|
@ -24,7 +25,7 @@ Rails.application.configure do
|
|||
# Print deprecation notices to the Rails logger
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
config.action_mailer.preview_path = "#{Rails.root}/spec/mailers/previews"
|
||||
config.action_mailer.preview_path = Rails.root.join('spec', 'mailers', 'previews')
|
||||
|
||||
# Expands the lines which load the assets
|
||||
config.assets.debug = false
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
|
||||
# frozen_string_literal: true
|
||||
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb
|
||||
|
||||
config.action_cable.allowed_request_origins = ['https://metamaps.herokuapp.com', 'http://metamaps.herokuapp.com', 'https://metamaps.cc']
|
||||
config.action_cable.allowed_request_origins = [
|
||||
'https://metamaps.herokuapp.com', 'http://metamaps.herokuapp.com', 'https://metamaps.cc'
|
||||
]
|
||||
|
||||
# log to stdout
|
||||
logger = Logger.new(STDOUT)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
Metamaps::Application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
$codes = []
|
||||
if ActiveRecord::Base.connection.data_source_exists? 'users'
|
||||
$codes = ActiveRecord::Base.connection
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
ActiveModelSerializers.config.adapter = :json
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# ActiveSupport::Reloader.to_prepare do
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
Rails.application.configure do
|
||||
# Version of your assets, change this if you want to expire all your assets.
|
||||
config.assets.version = '2.0'
|
||||
|
@ -9,5 +10,7 @@ Rails.application.configure do
|
|||
|
||||
# Precompile additional assets.
|
||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||
config.assets.precompile += %w( application-secret.css application-secret.js webpacked/metamaps.bundle.js )
|
||||
config.assets.precompile += %w[
|
||||
application-secret.css application-secret.js webpacked/metamaps.bundle.js
|
||||
]
|
||||
end
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
||||
# You can add backtrace silencers for libraries that you're using but don't wish
|
||||
# to see in your backtraces.
|
||||
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
||||
|
||||
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
||||
# You can also remove all the silencers if you're trying to debug a problem that
|
||||
# might stem from framework code.
|
||||
# Rails.backtrace_cleaner.remove_silencers!
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Specify a serializer for the signed and encrypted cookie jars.
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
||||
allow do
|
||||
origins '*'
|
||||
resource '/api/*',
|
||||
headers: :any,
|
||||
methods: [:get, :post, :put, :delete, :options, :head]
|
||||
methods: %i[get post put delete options head]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ExceptionNotifierInDelayedJob
|
||||
def handle_failed_job(job, error)
|
||||
super
|
||||
ExceptionNotfier.notify_exception(error)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Use this hook to configure devise mailer, warden hooks and so forth.
|
||||
# Many of these configuration options can be set straight in your model.
|
||||
Devise.setup do |config|
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
Doorkeeper.configure do
|
||||
# Change the ORM that doorkeeper will use (needs plugins)
|
||||
orm :active_record
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'exception_notification/rails'
|
||||
|
||||
module ExceptionNotifier
|
||||
|
@ -50,11 +51,11 @@ ExceptionNotification.configure do |config|
|
|||
# Ignore additional exception types.
|
||||
# ActiveRecord::RecordNotFound, AbstractController::ActionNotFound and
|
||||
# ActionController::RoutingError are already added.
|
||||
config.ignored_exceptions += %w(
|
||||
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.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Configure sensitive parameters which will be filtered from the log file.
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
TESTER_EMAILS = %w[
|
||||
connorturland@gmail.com devin@callysto.com chessscholar@gmail.com solaureum@gmail.com
|
||||
ishanshapiro@gmail.com
|
||||
].freeze
|
||||
|
||||
# rubocop:disable Style/PredicateName
|
||||
def is_tester(user)
|
||||
user && %w(connorturland@gmail.com devin@callysto.com chessscholar@gmail.com solaureum@gmail.com ishanshapiro@gmail.com).include?(user.email)
|
||||
user && TESTER_EMAILS.include?(user.email)
|
||||
end
|
||||
# rubocop:enable Style/PredicateName
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
Kaminari.configure do |config|
|
||||
# config.default_per_page = 25
|
||||
# config.max_per_page = nil
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new mime types for use in respond_to blocks:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
#
|
||||
# This file contains migration options to ease your Rails 5.0 upgrade.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
#
|
||||
# This file contains migration options to ease your Rails 5.1 upgrade.
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
Paperclip::Attachment.default_options[:url] = ':s3_domain_url'
|
||||
Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Rack
|
||||
class Attack
|
||||
Rack::Attack.cache.store = ActiveSupport::Cache::MemoryStore.new
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Your secret key for verifying the integrity of signed cookies.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
Rails.application.config.session_store :cookie_store, key: '_Metamaps_session'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
METAMAPS_VERSION = '3.5'
|
||||
METAMAPS_BUILD = `git log -1 --pretty=%H`.chomp[0..11].freeze
|
||||
METAMAPS_LAST_UPDATED = `git log -1 --pretty='%ad'`.split(' ').values_at(1, 2, 4).join(' ').freeze
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
Warden::Manager.after_set_user do |user, auth, opts|
|
||||
scope = opts[:scope]
|
||||
auth.cookies.signed["#{scope}.id"] = user.id
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
#
|
||||
# This file contains settings for ActionController::ParamsWrapper which
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Puma can serve each request in a thread from an internal thread pool.
|
||||
# The `threads` method setting takes two numbers: a minimum and maximum.
|
||||
# Any libraries that use thread pools should be configured to match
|
||||
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
||||
# and maximum; this matches the default thread size of Active Record.
|
||||
#
|
||||
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
|
||||
threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }
|
||||
threads threads_count, threads_count
|
||||
|
||||
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
||||
#
|
||||
port ENV.fetch("PORT") { 3000 }
|
||||
port ENV.fetch('PORT') { 3000 }
|
||||
|
||||
# Specifies the `environment` that Puma will run in.
|
||||
#
|
||||
environment ENV.fetch("RAILS_ENV") { "development" }
|
||||
environment ENV.fetch('RAILS_ENV') { 'development' }
|
||||
|
||||
# Specifies the number of `workers` to boot in clustered mode.
|
||||
# Workers are forked webserver processes. If using threads and workers together
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# rubocop:disable Metrics/BlockLength
|
||||
Metamaps::Application.routes.draw do
|
||||
use_doorkeeper
|
||||
mount ActionCable.server => '/cable'
|
||||
|
@ -16,7 +18,7 @@ Metamaps::Application.routes.draw do
|
|||
end
|
||||
get :explore, to: redirect('/')
|
||||
|
||||
resources :maps, except: [:index, :edit] do
|
||||
resources :maps, except: %i[index edit] do
|
||||
member do
|
||||
get :conversation
|
||||
get :export
|
||||
|
@ -54,10 +56,10 @@ Metamaps::Application.routes.draw do
|
|||
end
|
||||
end
|
||||
|
||||
resources :mappings, except: [:index, :new, :edit]
|
||||
resources :mappings, except: %i[index new edit]
|
||||
|
||||
resources :messages, only: [:show, :create, :update, :destroy]
|
||||
resources :notifications, only: [:index, :show] do
|
||||
resources :messages, only: %i[show create update destroy]
|
||||
resources :notifications, only: %i[index show] do
|
||||
collection do
|
||||
get :unsubscribe
|
||||
end
|
||||
|
@ -79,9 +81,9 @@ Metamaps::Application.routes.draw do
|
|||
get :synapses
|
||||
end
|
||||
|
||||
resources :synapses, except: [:index, :new, :edit]
|
||||
resources :synapses, except: %i[index new edit]
|
||||
|
||||
resources :topics, except: [:index, :new, :edit] do
|
||||
resources :topics, except: %i[index new edit] do
|
||||
member do
|
||||
get :network
|
||||
get :relative_numbers
|
||||
|
@ -110,7 +112,7 @@ Metamaps::Application.routes.draw do
|
|||
get 'join' => 'users/registrations#new', :as => :sign_up
|
||||
end
|
||||
|
||||
resources :users, except: [:index, :destroy] do
|
||||
resources :users, except: %i[index destroy] do
|
||||
member do
|
||||
get :details
|
||||
end
|
||||
|
@ -120,16 +122,16 @@ Metamaps::Application.routes.draw do
|
|||
|
||||
namespace :api, path: '/api', default: { format: :json } do
|
||||
namespace :v2, path: '/v2' do
|
||||
resources :metacodes, only: [:index, :show]
|
||||
resources :mappings, only: [:index, :create, :show, :update, :destroy]
|
||||
resources :maps, only: [:index, :create, :show, :update, :destroy] do
|
||||
resources :metacodes, only: %i[index show]
|
||||
resources :mappings, only: %i[index create show update destroy]
|
||||
resources :maps, only: %i[index create show update destroy] do
|
||||
post :stars, to: 'stars#create', on: :member
|
||||
delete :stars, to: 'stars#destroy', on: :member
|
||||
end
|
||||
resources :synapses, only: [:index, :create, :show, :update, :destroy]
|
||||
resources :tokens, only: [:index, :create, :destroy]
|
||||
resources :topics, only: [:index, :create, :show, :update, :destroy]
|
||||
resources :users, only: [:index, :show] do
|
||||
resources :synapses, only: %i[index create show update destroy]
|
||||
resources :tokens, only: %i[index create destroy]
|
||||
resources :topics, only: %i[index create show update destroy]
|
||||
resources :users, only: %i[index show] do
|
||||
get :current, on: :collection
|
||||
end
|
||||
match '*path', to: 'restful#catch_404', via: :all
|
||||
|
@ -145,4 +147,4 @@ Metamaps::Application.routes.draw do
|
|||
get 'load_url_title'
|
||||
end
|
||||
end
|
||||
# rubocop:enable Rubocop/Metrics/BlockLength
|
||||
# rubocop:enable Metrics/BlockLength
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
%w(
|
||||
|
||||
%w[
|
||||
.ruby-version
|
||||
.ruby-gemset
|
||||
.rbenv-vars
|
||||
tmp/restart.txt
|
||||
tmp/caching-dev.txt
|
||||
).each { |path| Spring.watch(path) }
|
||||
].each { |path| Spring.watch(path) }
|
||||
|
|
Loading…
Reference in a new issue