Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
|
fc701cf485 | ||
|
2dc6a948c6 |
38 changed files with 246 additions and 106 deletions
2
Gemfile
2
Gemfile
|
@ -2,7 +2,7 @@
|
|||
source 'https://rubygems.org'
|
||||
ruby '2.3.0'
|
||||
|
||||
gem 'rails', '~> 5.0.0'
|
||||
gem 'rails', '~> 5.1.0'
|
||||
|
||||
gem 'active_model_serializers'
|
||||
gem 'aws-sdk', '~> 2.7.0'
|
||||
|
|
96
Gemfile.lock
96
Gemfile.lock
|
@ -1,27 +1,27 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (5.0.5)
|
||||
actionpack (= 5.0.5)
|
||||
nio4r (>= 1.2, < 3.0)
|
||||
actioncable (5.1.4)
|
||||
actionpack (= 5.1.4)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (~> 0.6.1)
|
||||
actionmailer (5.0.5)
|
||||
actionpack (= 5.0.5)
|
||||
actionview (= 5.0.5)
|
||||
activejob (= 5.0.5)
|
||||
actionmailer (5.1.4)
|
||||
actionpack (= 5.1.4)
|
||||
actionview (= 5.1.4)
|
||||
activejob (= 5.1.4)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (5.0.5)
|
||||
actionview (= 5.0.5)
|
||||
activesupport (= 5.0.5)
|
||||
actionpack (5.1.4)
|
||||
actionview (= 5.1.4)
|
||||
activesupport (= 5.1.4)
|
||||
rack (~> 2.0)
|
||||
rack-test (~> 0.6.3)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (5.0.5)
|
||||
activesupport (= 5.0.5)
|
||||
actionview (5.1.4)
|
||||
activesupport (= 5.1.4)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||
active_model_serializers (0.10.6)
|
||||
|
@ -29,23 +29,23 @@ GEM
|
|||
activemodel (>= 4.1, < 6)
|
||||
case_transform (>= 0.2)
|
||||
jsonapi-renderer (>= 0.1.1.beta1, < 0.2)
|
||||
activejob (5.0.5)
|
||||
activesupport (= 5.0.5)
|
||||
activejob (5.1.4)
|
||||
activesupport (= 5.1.4)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (5.0.5)
|
||||
activesupport (= 5.0.5)
|
||||
activerecord (5.0.5)
|
||||
activemodel (= 5.0.5)
|
||||
activesupport (= 5.0.5)
|
||||
arel (~> 7.0)
|
||||
activesupport (5.0.5)
|
||||
activemodel (5.1.4)
|
||||
activesupport (= 5.1.4)
|
||||
activerecord (5.1.4)
|
||||
activemodel (= 5.1.4)
|
||||
activesupport (= 5.1.4)
|
||||
arel (~> 8.0)
|
||||
activesupport (5.1.4)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (~> 0.7)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
addressable (2.5.2)
|
||||
public_suffix (>= 2.0.2, < 4.0)
|
||||
arel (7.1.4)
|
||||
arel (8.0.0)
|
||||
ast (2.3.0)
|
||||
aws-sdk (2.7.0)
|
||||
aws-sdk-resources (= 2.7.0)
|
||||
|
@ -79,6 +79,7 @@ GEM
|
|||
climate_control (>= 0.0.3, < 1.0)
|
||||
coderay (1.1.2)
|
||||
concurrent-ruby (1.0.5)
|
||||
crass (1.0.2)
|
||||
debug_inspector (0.0.3)
|
||||
delayed_job (4.1.3)
|
||||
activesupport (>= 3.0, < 5.2)
|
||||
|
@ -100,7 +101,6 @@ GEM
|
|||
dotenv (= 2.2.1)
|
||||
railties (>= 3.2, < 5.2)
|
||||
erubi (1.6.1)
|
||||
erubis (2.7.0)
|
||||
exception_notification (4.2.2)
|
||||
actionmailer (>= 4.0, < 6)
|
||||
activesupport (>= 4.0, < 6)
|
||||
|
@ -117,7 +117,8 @@ GEM
|
|||
activesupport (>= 4.2.0)
|
||||
httparty (0.15.6)
|
||||
multi_xml (>= 0.5.2)
|
||||
i18n (0.8.6)
|
||||
i18n (0.9.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jmespath (1.3.1)
|
||||
jquery-rails (4.3.1)
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
|
@ -141,7 +142,8 @@ GEM
|
|||
activerecord
|
||||
kaminari-core (= 1.0.1)
|
||||
kaminari-core (1.0.1)
|
||||
loofah (2.0.3)
|
||||
loofah (2.1.1)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.6.6)
|
||||
mime-types (>= 1.16, < 4)
|
||||
|
@ -153,12 +155,12 @@ GEM
|
|||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2016.0521)
|
||||
mimemagic (0.3.2)
|
||||
mini_portile2 (2.2.0)
|
||||
mini_portile2 (2.3.0)
|
||||
minitest (5.10.3)
|
||||
multi_xml (0.6.0)
|
||||
nio4r (2.1.0)
|
||||
nokogiri (1.8.0)
|
||||
mini_portile2 (~> 2.2.0)
|
||||
nokogiri (1.8.1)
|
||||
mini_portile2 (~> 2.3.0)
|
||||
orm_adapter (0.5.0)
|
||||
paperclip (5.1.0)
|
||||
activemodel (>= 4.2.0)
|
||||
|
@ -189,34 +191,34 @@ GEM
|
|||
rack-attack (5.0.1)
|
||||
rack
|
||||
rack-cors (1.0.1)
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
rails (5.0.5)
|
||||
actioncable (= 5.0.5)
|
||||
actionmailer (= 5.0.5)
|
||||
actionpack (= 5.0.5)
|
||||
actionview (= 5.0.5)
|
||||
activejob (= 5.0.5)
|
||||
activemodel (= 5.0.5)
|
||||
activerecord (= 5.0.5)
|
||||
activesupport (= 5.0.5)
|
||||
rack-test (0.7.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (5.1.4)
|
||||
actioncable (= 5.1.4)
|
||||
actionmailer (= 5.1.4)
|
||||
actionpack (= 5.1.4)
|
||||
actionview (= 5.1.4)
|
||||
activejob (= 5.1.4)
|
||||
activemodel (= 5.1.4)
|
||||
activerecord (= 5.1.4)
|
||||
activesupport (= 5.1.4)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 5.0.5)
|
||||
railties (= 5.1.4)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.0.3)
|
||||
loofah (~> 2.0)
|
||||
railties (5.0.5)
|
||||
actionpack (= 5.0.5)
|
||||
activesupport (= 5.0.5)
|
||||
railties (5.1.4)
|
||||
actionpack (= 5.1.4)
|
||||
activesupport (= 5.1.4)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rainbow (2.2.2)
|
||||
rake
|
||||
rake (12.0.0)
|
||||
rake (12.1.0)
|
||||
rb-fsevent (0.10.2)
|
||||
rb-inotify (0.9.10)
|
||||
ffi (>= 0.5.0, < 2)
|
||||
|
@ -330,7 +332,7 @@ DEPENDENCIES
|
|||
pundit_extra
|
||||
rack-attack
|
||||
rack-cors
|
||||
rails (~> 5.0.0)
|
||||
rails (~> 5.1.0)
|
||||
redis (~> 3.3.3)
|
||||
rspec-rails
|
||||
rubocop
|
||||
|
|
38
bin/setup
Executable file
38
bin/setup
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'pathname'
|
||||
require 'fileutils'
|
||||
include FileUtils
|
||||
|
||||
# path to your application root.
|
||||
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
||||
|
||||
def system!(*args)
|
||||
system(*args) || abort("\n== Command #{args} failed ==")
|
||||
end
|
||||
|
||||
chdir APP_ROOT do
|
||||
# This script is a starting point to setup your application.
|
||||
# Add necessary setup steps to this file.
|
||||
|
||||
puts '== Installing dependencies =='
|
||||
system! 'gem install bundler --conservative'
|
||||
system('bundle check') || system!('bundle install')
|
||||
|
||||
# Install JavaScript dependencies if using Yarn
|
||||
# system('bin/yarn')
|
||||
|
||||
|
||||
# puts "\n== Copying sample files =="
|
||||
# unless File.exist?('config/database.yml')
|
||||
# cp 'config/database.yml.sample', 'config/database.yml'
|
||||
# end
|
||||
|
||||
puts "\n== Preparing database =="
|
||||
system! 'bin/rails db:setup'
|
||||
|
||||
puts "\n== Removing old logs and tempfiles =="
|
||||
system! 'bin/rails log:clear tmp:clear'
|
||||
|
||||
puts "\n== Restarting application server =="
|
||||
system! 'bin/rails restart'
|
||||
end
|
29
bin/update
Executable file
29
bin/update
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'pathname'
|
||||
require 'fileutils'
|
||||
include FileUtils
|
||||
|
||||
# path to your application root.
|
||||
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
||||
|
||||
def system!(*args)
|
||||
system(*args) || abort("\n== Command #{args} failed ==")
|
||||
end
|
||||
|
||||
chdir APP_ROOT do
|
||||
# This script is a way to update your development environment automatically.
|
||||
# Add necessary update steps to this file.
|
||||
|
||||
puts '== Installing dependencies =='
|
||||
system! 'gem install bundler --conservative'
|
||||
system('bundle check') || system!('bundle install')
|
||||
|
||||
puts "\n== Updating database =="
|
||||
system! 'bin/rails db:migrate'
|
||||
|
||||
puts "\n== Removing old logs and tempfiles =="
|
||||
system! 'bin/rails log:clear tmp:clear'
|
||||
|
||||
puts "\n== Restarting application server =="
|
||||
system! 'bin/rails restart'
|
||||
end
|
11
bin/yarn
Executable file
11
bin/yarn
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env ruby
|
||||
VENDOR_PATH = File.expand_path('..', __dir__)
|
||||
Dir.chdir(VENDOR_PATH) do
|
||||
begin
|
||||
exec "yarnpkg #{ARGV.join(" ")}"
|
||||
rescue Errno::ENOENT
|
||||
$stderr.puts "Yarn executable was not detected in the system."
|
||||
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
||||
exit 1
|
||||
end
|
||||
end
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative 'boot'
|
||||
|
||||
require 'csv'
|
||||
|
|
|
@ -1,16 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
require 'rubygems'
|
||||
require 'rails/commands/server'
|
||||
|
||||
module Rails
|
||||
class Server
|
||||
def default_options
|
||||
super.merge(Host: '0.0.0.0', Port: 3000)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Set up gems listed in the Gemfile.
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
||||
|
||||
require 'bundler/setup'
|
||||
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,7 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# ApplicationController.renderer.defaults.merge!(
|
||||
# http_host: 'example.org',
|
||||
# https: false
|
||||
# )
|
||||
# ActiveSupport::Reloader.to_prepare do
|
||||
# ApplicationController.renderer.defaults.merge!(
|
||||
# http_host: 'example.org',
|
||||
# https: false
|
||||
# )
|
||||
# end
|
||||
|
|
|
@ -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,10 +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,9 +1,12 @@
|
|||
Delayed::Worker.class_eval do
|
||||
|
||||
def handle_failed_job_with_notification(job, error)
|
||||
handle_failed_job_without_notification(job, error)
|
||||
ExceptionNotifier.notify_exception(error)
|
||||
end
|
||||
alias_method_chain :handle_failed_job, :notification
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ExceptionNotifierInDelayedJob
|
||||
def handle_failed_job(job, error)
|
||||
super
|
||||
ExceptionNotfier.notify_exception(error)
|
||||
end
|
||||
end
|
||||
|
||||
Delayed::Worker.class_eval do
|
||||
prepend ExceptionNotifierInDelayedJob
|
||||
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.
|
||||
|
|
16
config/initializers/new_framework_defaults_5_1.rb
Normal file
16
config/initializers/new_framework_defaults_5_1.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
# 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.
|
||||
#
|
||||
# Once upgraded flip defaults one by one to migrate to the new default.
|
||||
#
|
||||
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
||||
|
||||
# Make `form_with` generate non-remote forms.
|
||||
Rails.application.config.action_view.form_with_generates_remote_forms = false
|
||||
|
||||
# Unknown asset fallback will return the path passed in when the given
|
||||
# asset is not present in the asset pipeline.
|
||||
# Rails.application.config.assets.unknown_asset_fallback = false
|
|
@ -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,14 +1,15 @@
|
|||
# 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.
|
||||
# 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.
|
||||
# and maximum; this matches the default thread size of Active Record.
|
||||
#
|
||||
threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }.to_i
|
||||
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.
|
||||
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
||||
#
|
||||
port ENV.fetch('PORT') { 3000 }
|
||||
|
||||
|
@ -33,16 +34,25 @@ environment ENV.fetch('RAILS_ENV') { 'development' }
|
|||
#
|
||||
# preload_app!
|
||||
|
||||
# If you are preloading your application and using Active Record, it's
|
||||
# recommended that you close any connections to the database before workers
|
||||
# are forked to prevent connection leakage.
|
||||
#
|
||||
# before_fork do
|
||||
# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
|
||||
# end
|
||||
|
||||
# The code in the `on_worker_boot` will be called if you are using
|
||||
# clustered mode by specifying a number of `workers`. After each worker
|
||||
# process is booted this block will be run, if you are using `preload_app!`
|
||||
# option you will want to use this block to reconnect to any threads
|
||||
# or connections that may have been created at application boot, Ruby
|
||||
# process is booted, this block will be run. If you are using the `preload_app!`
|
||||
# option, you will want to use this block to reconnect to any threads
|
||||
# or connections that may have been created at application boot, as Ruby
|
||||
# cannot share connections between processes.
|
||||
#
|
||||
# on_worker_boot do
|
||||
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
||||
# end
|
||||
#
|
||||
|
||||
# Allow puma to be restarted by `rails restart` command.
|
||||
plugin :tmp_restart
|
||||
|
|
|
@ -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