This commit is contained in:
Devin Howard 2016-07-26 00:11:54 +00:00 committed by GitHub
commit e8cd320e59
31 changed files with 297 additions and 255 deletions

View file

@ -1 +1 @@
ruby-2.1.3 2.3.1

View file

@ -5,13 +5,14 @@ cache:
directories: directories:
- app/assets/javascripts/node_modules - app/assets/javascripts/node_modules
rvm: rvm:
- 2.1.3 - 2.3.0
before_script: before_script:
- echo "Rspec setup" - echo "Rspec setup"
- export RAILS_ENV=test - export RAILS_ENV=test
- cp .example-env .env - cp .example-env .env
- bundle exec rake db:create - bundle exec rake db:create
- bundle exec rake db:schema:load - bundle exec rake db:schema:load
- bundle exec rake db:migrate
- echo "node setup" - echo "node setup"
- . $HOME/.nvm/nvm.sh - . $HOME/.nvm/nvm.sh
- nvm install stable - nvm install stable

21
Gemfile
View file

@ -1,28 +1,27 @@
source 'https://rubygems.org' source 'https://rubygems.org'
ruby '2.1.3' ruby '2.3.1'
gem 'rails' gem 'rails', '~> 5.0.0'
gem 'active_model_serializers', '~> 0.8.1' gem 'active_model_serializers'
gem 'aws-sdk', '< 2.0' gem 'aws-sdk', '< 2.0'
gem 'best_in_place' #in-place editing gem 'best_in_place'
gem 'delayed_job', '~> 4.0.2' gem 'delayed_job'
gem 'delayed_job_active_record', '~> 4.0.1' gem 'delayed_job_active_record'
gem 'devise' gem 'devise'
gem 'doorkeeper' gem 'doorkeeper', '~> 4.0.0.rc4'
gem 'dotenv-rails' gem 'dotenv-rails'
gem 'exception_notification' gem 'exception_notification'
gem 'formtastic' gem 'formtastic'
gem 'formula' gem 'formula'
gem 'httparty' gem 'httparty'
gem 'json' gem 'json'
gem 'kaminari' # pagination gem 'kaminari'
gem 'paperclip' gem 'paperclip'
gem 'pg' gem 'pg'
gem 'pundit' gem 'pundit'
gem 'pundit_extra' gem 'pundit_extra'
gem 'rack-cors' gem 'rack-cors'
gem 'rails3-jquery-autocomplete'
gem 'redis' gem 'redis'
gem 'slack-notifier' gem 'slack-notifier'
gem 'snorlax' gem 'snorlax'
@ -31,12 +30,13 @@ gem 'uservoice-ruby'
gem 'jquery-rails' gem 'jquery-rails'
gem 'jquery-ui-rails' gem 'jquery-ui-rails'
gem 'jbuilder' gem 'jbuilder'
gem 'rails3-jquery-autocomplete'
gem 'babel-transpiler'
group :assets do group :assets do
gem 'coffee-rails' gem 'coffee-rails'
gem 'sass-rails' gem 'sass-rails'
gem 'uglifier' gem 'uglifier'
# gem 'therubyracer'
end end
group :production do group :production do
@ -57,6 +57,5 @@ group :development, :test do
gem 'binding_of_caller' gem 'binding_of_caller'
gem 'pry-byebug' gem 'pry-byebug'
gem 'pry-rails' gem 'pry-rails'
gem 'quiet_assets'
gem 'tunemygc' gem 'tunemygc'
end end

View file

@ -1,50 +1,59 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actionmailer (4.2.6) actioncable (5.0.0)
actionpack (= 4.2.6) actionpack (= 5.0.0)
actionview (= 4.2.6) nio4r (~> 1.2)
activejob (= 4.2.6) websocket-driver (~> 0.6.1)
actionmailer (5.0.0)
actionpack (= 5.0.0)
actionview (= 5.0.0)
activejob (= 5.0.0)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 2.0)
actionpack (4.2.6) actionpack (5.0.0)
actionview (= 4.2.6) actionview (= 5.0.0)
activesupport (= 4.2.6) activesupport (= 5.0.0)
rack (~> 1.6) rack (~> 2.0)
rack-test (~> 0.6.2) rack-test (~> 0.6.3)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.6) actionview (5.0.0)
activesupport (= 4.2.6) activesupport (= 5.0.0)
builder (~> 3.1) builder (~> 3.1)
erubis (~> 2.7.0) erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
active_model_serializers (0.8.3) active_model_serializers (0.10.1)
activemodel (>= 3.0) actionpack (>= 4.1, < 6)
activejob (4.2.6) activemodel (>= 4.1, < 6)
activesupport (= 4.2.6) jsonapi (~> 0.1.1.beta2)
globalid (>= 0.3.0) railties (>= 4.1, < 6)
activemodel (4.2.6) activejob (5.0.0)
activesupport (= 4.2.6) activesupport (= 5.0.0)
builder (~> 3.1) globalid (>= 0.3.6)
activerecord (4.2.6) activemodel (5.0.0)
activemodel (= 4.2.6) activesupport (= 5.0.0)
activesupport (= 4.2.6) activerecord (5.0.0)
arel (~> 6.0) activemodel (= 5.0.0)
activesupport (4.2.6) activesupport (= 5.0.0)
arel (~> 7.0)
activesupport (5.0.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7) i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1) minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1) tzinfo (~> 1.1)
addressable (2.3.8) addressable (2.3.8)
arel (6.0.3) arel (7.0.0)
aws-sdk (1.66.0) aws-sdk (1.66.0)
aws-sdk-v1 (= 1.66.0) aws-sdk-v1 (= 1.66.0)
aws-sdk-v1 (1.66.0) aws-sdk-v1 (1.66.0)
json (~> 1.4) json (~> 1.4)
nokogiri (>= 1.4.4) nokogiri (>= 1.4.4)
babel-source (5.8.35)
babel-transpiler (0.7.0)
babel-source (>= 4.0, < 6)
execjs (~> 2.0)
bcrypt (3.1.11) bcrypt (3.1.11)
best_in_place (3.1.0) best_in_place (3.1.0)
actionpack (>= 3.2) actionpack (>= 3.2)
@ -63,20 +72,20 @@ GEM
cocaine (0.5.8) cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0) climate_control (>= 0.0.3, < 1.0)
coderay (1.1.1) coderay (1.1.1)
coffee-rails (4.1.1) coffee-rails (4.2.1)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x) railties (>= 4.0.0, < 5.2.x)
coffee-script (2.4.1) coffee-script (2.4.1)
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.10.0) coffee-script-source (1.10.0)
concurrent-ruby (1.0.2) concurrent-ruby (1.0.2)
debug_inspector (0.0.2) debug_inspector (0.0.2)
delayed_job (4.0.6) delayed_job (4.1.2)
activesupport (>= 3.0, < 5.0) activesupport (>= 3.0, < 5.1)
delayed_job_active_record (4.0.3) delayed_job_active_record (4.1.1)
activerecord (>= 3.0, < 5.0) activerecord (>= 3.0, < 5.1)
delayed_job (>= 3.0, < 4.1) delayed_job (>= 3.0, < 5)
devise (4.1.1) devise (4.1.1)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
@ -85,16 +94,16 @@ GEM
warden (~> 1.2.3) warden (~> 1.2.3)
diff-lcs (1.2.5) diff-lcs (1.2.5)
docile (1.1.5) docile (1.1.5)
doorkeeper (3.1.0) doorkeeper (4.0.0.rc4)
railties (>= 3.2) railties (>= 4.2)
dotenv (2.1.1) dotenv (2.1.1)
dotenv-rails (2.1.1) dotenv-rails (2.1.1)
dotenv (= 2.1.1) dotenv (= 2.1.1)
railties (>= 4.0, < 5.1) railties (>= 4.0, < 5.1)
erubis (2.7.0) erubis (2.7.0)
exception_notification (4.1.4) exception_notification (4.1.1)
actionmailer (~> 4.0) actionmailer (>= 3.0.4)
activesupport (~> 4.0) activesupport (>= 3.0.4)
execjs (2.7.0) execjs (2.7.0)
ezcrypto (0.7.2) ezcrypto (0.7.2)
factory_girl (4.7.0) factory_girl (4.7.0)
@ -124,6 +133,8 @@ GEM
json (1.8.3) json (1.8.3)
json-schema (2.6.2) json-schema (2.6.2)
addressable (~> 2.3.8) addressable (~> 2.3.8)
jsonapi (0.1.1.beta2)
json (~> 1.8)
kaminari (0.17.0) kaminari (0.17.0)
actionpack (>= 3.0.0) actionpack (>= 3.0.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
@ -140,6 +151,7 @@ GEM
minitest (5.9.0) minitest (5.9.0)
multi_json (1.12.1) multi_json (1.12.1)
multi_xml (0.5.5) multi_xml (0.5.5)
nio4r (1.2.1)
nokogiri (1.6.8) nokogiri (1.6.8)
mini_portile2 (~> 2.1.0) mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7) pkg-config (~> 1.1.7)
@ -165,29 +177,25 @@ GEM
pundit (1.1.0) pundit (1.1.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
pundit_extra (0.2.0) pundit_extra (0.2.0)
quiet_assets (1.1.0) rack (2.0.1)
railties (>= 3.1, < 5.0)
rack (1.6.4)
rack-cors (0.4.0) rack-cors (0.4.0)
rack-test (0.6.3) rack-test (0.6.3)
rack (>= 1.0) rack (>= 1.0)
rails (4.2.6) rails (5.0.0)
actionmailer (= 4.2.6) actioncable (= 5.0.0)
actionpack (= 4.2.6) actionmailer (= 5.0.0)
actionview (= 4.2.6) actionpack (= 5.0.0)
activejob (= 4.2.6) actionview (= 5.0.0)
activemodel (= 4.2.6) activejob (= 5.0.0)
activerecord (= 4.2.6) activemodel (= 5.0.0)
activesupport (= 4.2.6) activerecord (= 5.0.0)
activesupport (= 5.0.0)
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0, < 2.0)
railties (= 4.2.6) railties (= 5.0.0)
sprockets-rails sprockets-rails (>= 2.0.0)
rails-deprecated_sanitizer (1.0.3) rails-dom-testing (2.0.1)
activesupport (>= 4.2.0.alpha) activesupport (>= 4.2.0, < 6.0)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0) nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3) rails-html-sanitizer (1.0.3)
loofah (~> 2.0) loofah (~> 2.0)
rails3-jquery-autocomplete (1.0.15) rails3-jquery-autocomplete (1.0.15)
@ -197,35 +205,35 @@ GEM
rails_stdout_logging rails_stdout_logging
rails_serve_static_assets (0.0.5) rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5) rails_stdout_logging (0.0.5)
railties (4.2.6) railties (5.0.0)
actionpack (= 4.2.6) actionpack (= 5.0.0)
activesupport (= 4.2.6) activesupport (= 5.0.0)
method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rake (11.2.2) rake (11.2.2)
redis (3.3.0) redis (3.3.0)
responders (2.2.0) responders (2.2.0)
railties (>= 4.2.0, < 5.1) railties (>= 4.2.0, < 5.1)
rspec-core (3.4.4) rspec-core (3.1.7)
rspec-support (~> 3.4.0) rspec-support (~> 3.1.0)
rspec-expectations (3.4.0) rspec-expectations (3.1.2)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0) rspec-support (~> 3.1.0)
rspec-mocks (3.4.1) rspec-mocks (3.1.3)
diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.1.0)
rspec-support (~> 3.4.0) rspec-rails (3.1.0)
rspec-rails (3.4.2) actionpack (>= 3.0)
actionpack (>= 3.0, < 4.3) activesupport (>= 3.0)
activesupport (>= 3.0, < 4.3) railties (>= 3.0)
railties (>= 3.0, < 4.3) rspec-core (~> 3.1.0)
rspec-core (~> 3.4.0) rspec-expectations (~> 3.1.0)
rspec-expectations (~> 3.4.0) rspec-mocks (~> 3.1.0)
rspec-mocks (~> 3.4.0) rspec-support (~> 3.1.0)
rspec-support (~> 3.4.0) rspec-support (3.1.2)
rspec-support (3.4.1)
sass (3.4.22) sass (3.4.22)
sass-rails (5.0.4) sass-rails (5.0.5)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 6)
sass (~> 3.1) sass (~> 3.1)
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0) sprockets-rails (>= 2.0, < 4.0)
@ -241,10 +249,10 @@ GEM
slop (3.6.0) slop (3.6.0)
snorlax (0.1.6) snorlax (0.1.6)
rails (> 4.1) rails (> 4.1)
sprockets (3.6.0) sprockets (3.6.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-rails (3.0.4) sprockets-rails (3.1.1)
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
@ -262,22 +270,26 @@ GEM
oauth (>= 0.4.7) oauth (>= 0.4.7)
warden (1.2.6) warden (1.2.6)
rack (>= 1.0) rack (>= 1.0)
websocket-driver (0.6.4)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
PLATFORMS PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
active_model_serializers (~> 0.8.1) active_model_serializers
aws-sdk (< 2.0) aws-sdk (< 2.0)
babel-transpiler
best_in_place best_in_place
better_errors better_errors
binding_of_caller binding_of_caller
brakeman brakeman
coffee-rails coffee-rails
delayed_job (~> 4.0.2) delayed_job
delayed_job_active_record (~> 4.0.1) delayed_job_active_record
devise devise
doorkeeper doorkeeper (~> 4.0.0.rc4)
dotenv-rails dotenv-rails
exception_notification exception_notification
factory_girl_rails factory_girl_rails
@ -296,9 +308,8 @@ DEPENDENCIES
pry-rails pry-rails
pundit pundit
pundit_extra pundit_extra
quiet_assets
rack-cors rack-cors
rails rails (~> 5.0.0)
rails3-jquery-autocomplete rails3-jquery-autocomplete
rails_12factor rails_12factor
redis redis

View file

@ -0,0 +1,6 @@
// JS and CSS bundles
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
// Other
//= link_tree ../images

View file

@ -16,6 +16,9 @@
//= require ./orderedLibraries/underscore //= require ./orderedLibraries/underscore
//= require ./orderedLibraries/backbone //= require ./orderedLibraries/backbone
//= require_directory ./lib //= require_directory ./lib
//= require_directory ./shims
//= require_directory ./require
//= require_directory ./famous
//= require ./src/Metamaps.GlobalUI //= require ./src/Metamaps.GlobalUI
//= require ./src/Metamaps.Router //= require ./src/Metamaps.Router
//= require ./src/Metamaps.Backbone //= require ./src/Metamaps.Backbone
@ -44,6 +47,3 @@
//= require ./src/Metamaps.Admin //= require ./src/Metamaps.Admin
//= require ./src/Metamaps.Import //= require ./src/Metamaps.Import
//= require ./src/Metamaps.JIT //= require ./src/Metamaps.JIT
//= require_directory ./shims
//= require_directory ./require
//= require_directory ./famous

View file

@ -175,7 +175,7 @@ class MainController < ApplicationController
end end
#limit to 5 results #limit to 5 results
@synapses = @synapses.slice(0,5) @synapses = @synapses.to_a.slice(0,5)
render json: autocomplete_synapse_array_json(@synapses) render json: autocomplete_synapse_array_json(@synapses)
end end

View file

@ -1,5 +1,4 @@
class EventSerializer < ActiveModel::Serializer class EventSerializer < ActiveModel::Serializer
embed :ids, include: true
attributes :id, :sequence_id, :kind, :map_id, :created_at attributes :id, :sequence_id, :kind, :map_id, :created_at
has_one :actor, serializer: NewUserSerializer, root: 'users' has_one :actor, serializer: NewUserSerializer, root: 'users'

View file

@ -1,5 +1,4 @@
class NewMapSerializer < ActiveModel::Serializer class NewMapSerializer < ActiveModel::Serializer
embed :ids, include: true
attributes :id, attributes :id,
:name, :name,
:desc, :desc,

View file

@ -1,5 +1,4 @@
class NewMappingSerializer < ActiveModel::Serializer class NewMappingSerializer < ActiveModel::Serializer
embed :ids, include: true
attributes :id, attributes :id,
:xloc, :xloc,
:yloc, :yloc,

View file

@ -1,5 +1,4 @@
class NewSynapseSerializer < ActiveModel::Serializer class NewSynapseSerializer < ActiveModel::Serializer
embed :ids, include: true
attributes :id, attributes :id,
:desc, :desc,
:category, :category,

View file

@ -1,5 +1,4 @@
class NewTopicSerializer < ActiveModel::Serializer class NewTopicSerializer < ActiveModel::Serializer
embed :ids, include: true
attributes :id, attributes :id,
:name, :name,
:desc, :desc,

View file

@ -1,4 +1,4 @@
require File.expand_path('../boot', __FILE__) require_relative 'boot'
require 'csv' require 'csv'
require 'rails/all' require 'rails/all'
@ -15,21 +15,6 @@ module Metamaps
# Custom directories with classes and modules you want to be autoloadable. # Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths << Rails.root.join('app', 'services') config.autoload_paths << Rails.root.join('app', 'services')
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Configure the default encoding used in templates for Ruby 1.9. # Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8" config.encoding = "utf-8"
@ -43,17 +28,9 @@ module Metamaps
# Configure sensitive parameters which will be filtered from the log file. # Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password] config.filter_parameters += [:password]
# Use SQL instead of Active Record's schema dumper when creating the database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
# Enable the asset pipeline # Enable the asset pipeline
config.assets.initialize_on_precompile = false config.assets.initialize_on_precompile = false
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '2.0'
config.generators do |g| config.generators do |g|
g.test_framework :rspec g.test_framework :rspec
end end

View file

@ -1,5 +1,6 @@
require 'rubygems' require 'rubygems'
require 'rails/commands/server' require 'rails/commands/server'
module Rails module Rails
class Server class Server
def default_options def default_options
@ -9,6 +10,6 @@ module Rails
end end
# Set up gems listed in the Gemfile. # Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) require 'bundler/setup'

9
config/cable.yml Normal file
View file

@ -0,0 +1,9 @@
development:
adapter: async
test:
adapter: async
production:
adapter: redis
url: redis://localhost:6379/1

View file

@ -1,5 +1,5 @@
# Load the rails application # Load the Rails application.
require File.expand_path('../application', __FILE__) require_relative 'application'
# Initialize the rails application # Initialize the Rails application.
Metamaps::Application.initialize! Rails.application.initialize!

View file

@ -1,9 +1,8 @@
Metamaps::Application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb # Settings specified here will take precedence over those in config/application.rb
config.log_level = :warn config.log_level = :warn
config.eager_load = true config.eager_load = true
config.assets.js_compressor = :uglifier
# Code is not reloaded between requests # Code is not reloaded between requests
config.cache_classes = true config.cache_classes = true
@ -13,13 +12,12 @@ Metamaps::Application.configure do
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this) # Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_files = true config.public_file_server.enabled = false
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false config.assets.compile = false
# Compress JavaScripts and CSS config.assets.js_compressor = :uglifier
config.assets.compress = true
# S3 file storage # S3 file storage
config.paperclip_defaults = { config.paperclip_defaults = {
@ -38,7 +36,6 @@ Metamaps::Application.configure do
port: ENV['SMTP_PORT'], port: ENV['SMTP_PORT'],
user_name: ENV['SMTP_USERNAME'], user_name: ENV['SMTP_USERNAME'],
password: ENV['SMTP_PASSWORD'], password: ENV['SMTP_PASSWORD'],
#domain: ENV['SMTP_DOMAIN']
authentication: 'plain', authentication: 'plain',
enable_starttls_auto: true, enable_starttls_auto: true,
openssl_verify_mode: 'none' } openssl_verify_mode: 'none' }
@ -46,54 +43,13 @@ Metamaps::Application.configure do
# Don't care if the mailer can't send # Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = true config.action_mailer.raise_delivery_errors = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs # Generate digests for assets URLs
config.assets.digest = true config.assets.digest = true
# Defaults to Rails.root.join("public/assets")
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# See everything in the log (default is :info)
# config.log_level = :debug
# Prepend all log lines with the following tags
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
#config.assets.precompile += %w( )
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found) # the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true config.i18n.fallbacks = true
# Send deprecation notices to registered listeners # Send deprecation notices to registered listeners
config.active_support.deprecation = :notify config.active_support.deprecation = :notify
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
end end

View file

@ -10,7 +10,7 @@ Metamaps::Application.configure do
config.cache_classes = true config.cache_classes = true
# Configure static asset server for tests with Cache-Control for performance # Configure static asset server for tests with Cache-Control for performance
config.serve_static_files = true config.public_file_server.enabled = true
config.static_cache_control = "public, max-age=3600" config.static_cache_control = "public, max-age=3600"
# Show full error reports and disable caching # Show full error reports and disable caching

View file

@ -0,0 +1,6 @@
# Be sure to restart your server when you modify this file.
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )

View file

@ -0,0 +1,12 @@
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '2.0'
Rails.application.config.assets.quiet = true
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )

View file

@ -0,0 +1,5 @@
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :hybrid

View file

@ -0,0 +1,4 @@
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]

View file

@ -1,15 +1,16 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format # Add new inflection rules using the following format. Inflections
# (all these examples are active by default): # are locale specific, and you may define rules for as many different
# ActiveSupport::Inflector.inflections do |inflect| # locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en' # inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1' # inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people' # inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep ) # inflect.uncountable %w( fish sheep )
# end # end
#
# These inflection rules are supported but not enabled by default: # These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections do |inflect| # ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful' # inflect.acronym 'RESTful'
# end # end

View file

@ -2,6 +2,5 @@
# Add new mime types for use in respond_to blocks: # Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf # Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
Mime::Type.register "application/xls", :xls Mime::Type.register "application/xls", :xls

View file

@ -0,0 +1,24 @@
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 5.0 upgrade.
#
# Read the Rails 5.0 release notes for more info on each option.
# Enable per-form CSRF tokens. Previous versions had false.
Rails.application.config.action_controller.per_form_csrf_tokens = true
# Enable origin-checking CSRF mitigation. Previous versions had false.
Rails.application.config.action_controller.forgery_protection_origin_check = true
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
# Previous versions had false.
ActiveSupport.to_time_preserves_timezone = true
# Require `belongs_to` associations by default. Previous versions had false.
Rails.application.config.active_record.belongs_to_required_by_default = true
# Do not halt callback chains when a callback returns false. Previous versions had true.
ActiveSupport.halt_callback_chains_on_return_false = false
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
Rails.application.config.ssl_options = { hsts: { subdomains: true } }

View file

@ -4,4 +4,4 @@
# If you change this key, all old signed cookies will become invalid! # If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random, # Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks. # no regular words or you'll be exposed to dictionary attacks.
Metamaps::Application.config.secret_key_base = ENV['SECRET_KEY_BASE'] Rails.application.config.secret_key_base = ENV['SECRET_KEY_BASE']

View file

@ -1,8 +1,8 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
Metamaps::Application.config.session_store :cookie_store, key: '_Metamaps_session' Rails.application.config.session_store :cookie_store, key: '_Metamaps_session'
# Use the database for sessions instead of the cookie-based default, # Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information # which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration") # (create the session table with "rails generate session_migration")
# Metamaps::Application.config.session_store :active_record_store # Rails.application.config.session_store :active_record_store

View file

@ -8,7 +8,7 @@ ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json] wrap_parameters format: [:json]
end end
# Disable root element in JSON by default. # To enable root element in JSON for ActiveRecord objects.
ActiveSupport.on_load(:active_record) do # ActiveSupport.on_load(:active_record) do
self.include_root_in_json = false # self.include_root_in_json = true
end # end

47
config/puma.rb Normal file
View file

@ -0,0 +1,47 @@
# 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 }.to_i
threads threads_count, threads_count
# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
#
port ENV.fetch("PORT") { 3000 }
# Specifies the `environment` that Puma will run in.
#
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
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory. If you use this option
# you need to make sure to reconnect any threads in the `on_worker_boot`
# block.
#
# preload_app!
# 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
# 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

6
config/spring.rb Normal file
View file

@ -0,0 +1,6 @@
%w(
.ruby-version
.rbenv-vars
tmp/restart.txt
tmp/caching-dev.txt
).each { |path| Spring.watch(path) }

View file

@ -1,4 +1,3 @@
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to # of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition. # incrementally modify your database, and then regenerate this schema definition.
@ -28,10 +27,9 @@ ActiveRecord::Schema.define(version: 20160401133937) do
t.string "queue" t.string "queue"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.index ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree
end end
add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree
create_table "events", force: :cascade do |t| create_table "events", force: :cascade do |t|
t.string "kind", limit: 255 t.string "kind", limit: 255
t.integer "eventable_id" t.integer "eventable_id"
@ -41,24 +39,22 @@ ActiveRecord::Schema.define(version: 20160401133937) do
t.integer "sequence_id" t.integer "sequence_id"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.index ["eventable_type", "eventable_id"], name: "index_events_on_eventable_type_and_eventable_id", using: :btree
t.index ["map_id", "sequence_id"], name: "index_events_on_map_id_and_sequence_id", unique: true, using: :btree
t.index ["map_id"], name: "index_events_on_map_id", using: :btree
t.index ["sequence_id"], name: "index_events_on_sequence_id", using: :btree
t.index ["user_id"], name: "index_events_on_user_id", using: :btree
end end
add_index "events", ["eventable_type", "eventable_id"], name: "index_events_on_eventable_type_and_eventable_id", using: :btree
add_index "events", ["map_id", "sequence_id"], name: "index_events_on_map_id_and_sequence_id", unique: true, using: :btree
add_index "events", ["map_id"], name: "index_events_on_map_id", using: :btree
add_index "events", ["sequence_id"], name: "index_events_on_sequence_id", using: :btree
add_index "events", ["user_id"], name: "index_events_on_user_id", using: :btree
create_table "in_metacode_sets", force: :cascade do |t| create_table "in_metacode_sets", force: :cascade do |t|
t.integer "metacode_id" t.integer "metacode_id"
t.integer "metacode_set_id" t.integer "metacode_set_id"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["metacode_id"], name: "index_in_metacode_sets_on_metacode_id", using: :btree
t.index ["metacode_set_id"], name: "index_in_metacode_sets_on_metacode_set_id", using: :btree
end end
add_index "in_metacode_sets", ["metacode_id"], name: "index_in_metacode_sets_on_metacode_id", using: :btree
add_index "in_metacode_sets", ["metacode_set_id"], name: "index_in_metacode_sets_on_metacode_set_id", using: :btree
create_table "mappings", force: :cascade do |t| create_table "mappings", force: :cascade do |t|
t.text "category" t.text "category"
t.integer "xloc" t.integer "xloc"
@ -71,14 +67,13 @@ ActiveRecord::Schema.define(version: 20160401133937) do
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.integer "mappable_id" t.integer "mappable_id"
t.string "mappable_type" t.string "mappable_type"
t.index ["map_id", "synapse_id"], name: "index_mappings_on_map_id_and_synapse_id", using: :btree
t.index ["map_id", "topic_id"], name: "index_mappings_on_map_id_and_topic_id", using: :btree
t.index ["map_id"], name: "index_mappings_on_map_id", using: :btree
t.index ["mappable_id", "mappable_type"], name: "index_mappings_on_mappable_id_and_mappable_type", using: :btree
t.index ["user_id"], name: "index_mappings_on_user_id", using: :btree
end end
add_index "mappings", ["map_id", "synapse_id"], name: "index_mappings_on_map_id_and_synapse_id", using: :btree
add_index "mappings", ["map_id", "topic_id"], name: "index_mappings_on_map_id_and_topic_id", using: :btree
add_index "mappings", ["map_id"], name: "index_mappings_on_map_id", using: :btree
add_index "mappings", ["mappable_id", "mappable_type"], name: "index_mappings_on_mappable_id_and_mappable_type", using: :btree
add_index "mappings", ["user_id"], name: "index_mappings_on_user_id", using: :btree
create_table "maps", force: :cascade do |t| create_table "maps", force: :cascade do |t|
t.text "name" t.text "name"
t.boolean "arranged" t.boolean "arranged"
@ -92,10 +87,9 @@ ActiveRecord::Schema.define(version: 20160401133937) do
t.string "screenshot_content_type" t.string "screenshot_content_type"
t.integer "screenshot_file_size" t.integer "screenshot_file_size"
t.datetime "screenshot_updated_at" t.datetime "screenshot_updated_at"
t.index ["user_id"], name: "index_maps_on_user_id", using: :btree
end end
add_index "maps", ["user_id"], name: "index_maps_on_user_id", using: :btree
create_table "messages", force: :cascade do |t| create_table "messages", force: :cascade do |t|
t.text "message" t.text "message"
t.integer "user_id" t.integer "user_id"
@ -103,12 +97,11 @@ ActiveRecord::Schema.define(version: 20160401133937) do
t.string "resource_type" t.string "resource_type"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.index ["resource_id"], name: "index_messages_on_resource_id", using: :btree
t.index ["resource_type"], name: "index_messages_on_resource_type", using: :btree
t.index ["user_id"], name: "index_messages_on_user_id", using: :btree
end end
add_index "messages", ["resource_id"], name: "index_messages_on_resource_id", using: :btree
add_index "messages", ["resource_type"], name: "index_messages_on_resource_type", using: :btree
add_index "messages", ["user_id"], name: "index_messages_on_user_id", using: :btree
create_table "metacode_sets", force: :cascade do |t| create_table "metacode_sets", force: :cascade do |t|
t.string "name" t.string "name"
t.text "desc" t.text "desc"
@ -116,10 +109,9 @@ ActiveRecord::Schema.define(version: 20160401133937) do
t.boolean "mapperContributed" t.boolean "mapperContributed"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["user_id"], name: "index_metacode_sets_on_user_id", using: :btree
end end
add_index "metacode_sets", ["user_id"], name: "index_metacode_sets_on_user_id", using: :btree
create_table "metacodes", force: :cascade do |t| create_table "metacodes", force: :cascade do |t|
t.text "name" t.text "name"
t.string "manual_icon" t.string "manual_icon"
@ -141,10 +133,9 @@ ActiveRecord::Schema.define(version: 20160401133937) do
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "revoked_at" t.datetime "revoked_at"
t.string "scopes" t.string "scopes"
t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true, using: :btree
end end
add_index "oauth_access_grants", ["token"], name: "index_oauth_access_grants_on_token", unique: true, using: :btree
create_table "oauth_access_tokens", force: :cascade do |t| create_table "oauth_access_tokens", force: :cascade do |t|
t.integer "resource_owner_id" t.integer "resource_owner_id"
t.integer "application_id" t.integer "application_id"
@ -154,12 +145,11 @@ ActiveRecord::Schema.define(version: 20160401133937) do
t.datetime "revoked_at" t.datetime "revoked_at"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.string "scopes" t.string "scopes"
t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true, using: :btree
t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id", using: :btree
t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true, using: :btree
end end
add_index "oauth_access_tokens", ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true, using: :btree
add_index "oauth_access_tokens", ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id", using: :btree
add_index "oauth_access_tokens", ["token"], name: "index_oauth_access_tokens_on_token", unique: true, using: :btree
create_table "oauth_applications", force: :cascade do |t| create_table "oauth_applications", force: :cascade do |t|
t.string "name", null: false t.string "name", null: false
t.string "uid", null: false t.string "uid", null: false
@ -168,10 +158,9 @@ ActiveRecord::Schema.define(version: 20160401133937) do
t.string "scopes", default: "", null: false t.string "scopes", default: "", null: false
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree
end end
add_index "oauth_applications", ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree
create_table "synapses", force: :cascade do |t| create_table "synapses", force: :cascade do |t|
t.text "desc" t.text "desc"
t.text "category" t.text "category"
@ -183,24 +172,22 @@ ActiveRecord::Schema.define(version: 20160401133937) do
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.integer "defer_to_map_id" t.integer "defer_to_map_id"
t.index ["node1_id", "node1_id"], name: "index_synapses_on_node1_id_and_node1_id", using: :btree
t.index ["node1_id"], name: "index_synapses_on_node1_id", using: :btree
t.index ["node2_id", "node2_id"], name: "index_synapses_on_node2_id_and_node2_id", using: :btree
t.index ["node2_id"], name: "index_synapses_on_node2_id", using: :btree
t.index ["user_id"], name: "index_synapses_on_user_id", using: :btree
end end
add_index "synapses", ["node1_id", "node1_id"], name: "index_synapses_on_node1_id_and_node1_id", using: :btree
add_index "synapses", ["node1_id"], name: "index_synapses_on_node1_id", using: :btree
add_index "synapses", ["node2_id", "node2_id"], name: "index_synapses_on_node2_id_and_node2_id", using: :btree
add_index "synapses", ["node2_id"], name: "index_synapses_on_node2_id", using: :btree
add_index "synapses", ["user_id"], name: "index_synapses_on_user_id", using: :btree
create_table "tokens", force: :cascade do |t| create_table "tokens", force: :cascade do |t|
t.string "token" t.string "token"
t.string "description" t.string "description"
t.integer "user_id" t.integer "user_id"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["user_id"], name: "index_tokens_on_user_id", using: :btree
end end
add_index "tokens", ["user_id"], name: "index_tokens_on_user_id", using: :btree
create_table "topics", force: :cascade do |t| create_table "topics", force: :cascade do |t|
t.text "name" t.text "name"
t.text "desc" t.text "desc"
@ -219,21 +206,19 @@ ActiveRecord::Schema.define(version: 20160401133937) do
t.integer "audio_file_size" t.integer "audio_file_size"
t.datetime "audio_updated_at" t.datetime "audio_updated_at"
t.integer "defer_to_map_id" t.integer "defer_to_map_id"
t.index ["metacode_id"], name: "index_topics_on_metacode_id", using: :btree
t.index ["user_id"], name: "index_topics_on_user_id", using: :btree
end end
add_index "topics", ["metacode_id"], name: "index_topics_on_metacode_id", using: :btree
add_index "topics", ["user_id"], name: "index_topics_on_user_id", using: :btree
create_table "user_maps", force: :cascade do |t| create_table "user_maps", force: :cascade do |t|
t.integer "user_id" t.integer "user_id"
t.integer "map_id" t.integer "map_id"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.index ["map_id"], name: "index_user_maps_on_map_id", using: :btree
t.index ["user_id"], name: "index_user_maps_on_user_id", using: :btree
end end
add_index "user_maps", ["map_id"], name: "index_user_maps_on_map_id", using: :btree
add_index "user_maps", ["user_id"], name: "index_user_maps_on_user_id", using: :btree
create_table "users", force: :cascade do |t| create_table "users", force: :cascade do |t|
t.string "name" t.string "name"
t.string "email" t.string "email"
@ -262,19 +247,17 @@ ActiveRecord::Schema.define(version: 20160401133937) do
t.integer "image_file_size" t.integer "image_file_size"
t.datetime "image_updated_at" t.datetime "image_updated_at"
t.integer "generation" t.integer "generation"
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
end end
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
create_table "webhooks", force: :cascade do |t| create_table "webhooks", force: :cascade do |t|
t.integer "hookable_id" t.integer "hookable_id"
t.string "hookable_type" t.string "hookable_type"
t.string "kind", null: false t.string "kind", null: false
t.string "uri", null: false t.string "uri", null: false
t.text "event_types", default: [], array: true t.text "event_types", default: [], array: true
t.index ["hookable_type", "hookable_id"], name: "index_webhooks_on_hookable_type_and_hookable_id", using: :btree
end end
add_index "webhooks", ["hookable_type", "hookable_id"], name: "index_webhooks_on_hookable_type_and_hookable_id", using: :btree
add_foreign_key "tokens", "users" add_foreign_key "tokens", "users"
end end