Initial to rails v5 upgrade
This commit is contained in:
parent
69cb2cbc5c
commit
e19ee9c638
17 changed files with 252 additions and 192 deletions
2
Gemfile
2
Gemfile
|
@ -2,7 +2,7 @@ source 'https://rubygems.org'
|
||||||
|
|
||||||
ruby '2.4.5'
|
ruby '2.4.5'
|
||||||
gem 'rake'
|
gem 'rake'
|
||||||
gem 'rails', '= 5.0.0'
|
gem 'rails', '= 5.0.7.1'
|
||||||
gem 'rails_12factor'
|
gem 'rails_12factor'
|
||||||
# https://stripe.com/docs/api
|
# https://stripe.com/docs/api
|
||||||
gem 'stripe'
|
gem 'stripe'
|
||||||
|
|
82
Gemfile.lock
82
Gemfile.lock
|
@ -25,41 +25,41 @@ GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
action_mailer_matchers (1.0.0)
|
action_mailer_matchers (1.0.0)
|
||||||
actioncable (5.0.0)
|
actioncable (5.0.7.1)
|
||||||
actionpack (= 5.0.0)
|
actionpack (= 5.0.7.1)
|
||||||
nio4r (~> 1.2)
|
nio4r (>= 1.2, < 3.0)
|
||||||
websocket-driver (~> 0.6.1)
|
websocket-driver (~> 0.6.1)
|
||||||
actionmailer (5.0.0)
|
actionmailer (5.0.7.1)
|
||||||
actionpack (= 5.0.0)
|
actionpack (= 5.0.7.1)
|
||||||
actionview (= 5.0.0)
|
actionview (= 5.0.7.1)
|
||||||
activejob (= 5.0.0)
|
activejob (= 5.0.7.1)
|
||||||
mail (~> 2.5, >= 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
actionpack (5.0.0)
|
actionpack (5.0.7.1)
|
||||||
actionview (= 5.0.0)
|
actionview (= 5.0.7.1)
|
||||||
activesupport (= 5.0.0)
|
activesupport (= 5.0.7.1)
|
||||||
rack (~> 2.0)
|
rack (~> 2.0)
|
||||||
rack-test (~> 0.6.3)
|
rack-test (~> 0.6.3)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||||
actionview (5.0.0)
|
actionview (5.0.7.1)
|
||||||
activesupport (= 5.0.0)
|
activesupport (= 5.0.7.1)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubis (~> 2.7.0)
|
erubis (~> 2.7.0)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||||
activejob (5.0.0)
|
activejob (5.0.7.1)
|
||||||
activesupport (= 5.0.0)
|
activesupport (= 5.0.7.1)
|
||||||
globalid (>= 0.3.6)
|
globalid (>= 0.3.6)
|
||||||
activemodel (5.0.0)
|
activemodel (5.0.7.1)
|
||||||
activesupport (= 5.0.0)
|
activesupport (= 5.0.7.1)
|
||||||
activerecord (5.0.0)
|
activerecord (5.0.7.1)
|
||||||
activemodel (= 5.0.0)
|
activemodel (= 5.0.7.1)
|
||||||
activesupport (= 5.0.0)
|
activesupport (= 5.0.7.1)
|
||||||
arel (~> 7.0)
|
arel (~> 7.0)
|
||||||
activesupport (5.0.0)
|
activesupport (5.0.7.1)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (~> 0.7)
|
i18n (>= 0.7, < 2)
|
||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
addressable (2.5.2)
|
addressable (2.5.2)
|
||||||
|
@ -251,7 +251,7 @@ GEM
|
||||||
domain_name (~> 0.5)
|
domain_name (~> 0.5)
|
||||||
httparty (0.16.2)
|
httparty (0.16.2)
|
||||||
multi_xml (>= 0.5.2)
|
multi_xml (>= 0.5.2)
|
||||||
i18n (0.9.5)
|
i18n (1.5.3)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
i18n-js (3.1.0)
|
i18n-js (3.1.0)
|
||||||
i18n (>= 0.6.6, < 2)
|
i18n (>= 0.6.6, < 2)
|
||||||
|
@ -275,7 +275,7 @@ GEM
|
||||||
mail_view (2.0.4)
|
mail_view (2.0.4)
|
||||||
tilt
|
tilt
|
||||||
memcachier (0.0.2)
|
memcachier (0.0.2)
|
||||||
method_source (0.9.1)
|
method_source (0.9.2)
|
||||||
mime-types (3.2.2)
|
mime-types (3.2.2)
|
||||||
mime-types-data (~> 3.2015)
|
mime-types-data (~> 3.2015)
|
||||||
mime-types-data (3.2018.0812)
|
mime-types-data (3.2018.0812)
|
||||||
|
@ -285,7 +285,7 @@ GEM
|
||||||
minitest (5.11.3)
|
minitest (5.11.3)
|
||||||
money (6.13.1)
|
money (6.13.1)
|
||||||
i18n (>= 0.6.4, <= 2)
|
i18n (>= 0.6.4, <= 2)
|
||||||
msgpack (1.2.4)
|
msgpack (1.2.6)
|
||||||
multi_json (1.13.1)
|
multi_json (1.13.1)
|
||||||
multi_xml (0.6.0)
|
multi_xml (0.6.0)
|
||||||
multipart-post (2.0.0)
|
multipart-post (2.0.0)
|
||||||
|
@ -297,7 +297,7 @@ GEM
|
||||||
kdtree
|
kdtree
|
||||||
require_all
|
require_all
|
||||||
netrc (0.11.0)
|
netrc (0.11.0)
|
||||||
nio4r (1.2.1)
|
nio4r (2.3.1)
|
||||||
nokogiri (1.10.1)
|
nokogiri (1.10.1)
|
||||||
mini_portile2 (~> 2.4.0)
|
mini_portile2 (~> 2.4.0)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
|
@ -327,17 +327,17 @@ GEM
|
||||||
rack-test (0.6.3)
|
rack-test (0.6.3)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rack-timeout (0.5.1)
|
rack-timeout (0.5.1)
|
||||||
rails (5.0.0)
|
rails (5.0.7.1)
|
||||||
actioncable (= 5.0.0)
|
actioncable (= 5.0.7.1)
|
||||||
actionmailer (= 5.0.0)
|
actionmailer (= 5.0.7.1)
|
||||||
actionpack (= 5.0.0)
|
actionpack (= 5.0.7.1)
|
||||||
actionview (= 5.0.0)
|
actionview (= 5.0.7.1)
|
||||||
activejob (= 5.0.0)
|
activejob (= 5.0.7.1)
|
||||||
activemodel (= 5.0.0)
|
activemodel (= 5.0.7.1)
|
||||||
activerecord (= 5.0.0)
|
activerecord (= 5.0.7.1)
|
||||||
activesupport (= 5.0.0)
|
activesupport (= 5.0.7.1)
|
||||||
bundler (>= 1.3.0, < 2.0)
|
bundler (>= 1.3.0)
|
||||||
railties (= 5.0.0)
|
railties (= 5.0.7.1)
|
||||||
sprockets-rails (>= 2.0.0)
|
sprockets-rails (>= 2.0.0)
|
||||||
rails-dom-testing (2.0.3)
|
rails-dom-testing (2.0.3)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
|
@ -352,9 +352,9 @@ 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 (5.0.0)
|
railties (5.0.7.1)
|
||||||
actionpack (= 5.0.0)
|
actionpack (= 5.0.7.1)
|
||||||
activesupport (= 5.0.0)
|
activesupport (= 5.0.7.1)
|
||||||
method_source
|
method_source
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
|
@ -540,7 +540,7 @@ DEPENDENCIES
|
||||||
rack-attack
|
rack-attack
|
||||||
rack-ssl
|
rack-ssl
|
||||||
rack-timeout
|
rack-timeout
|
||||||
rails (= 5.0.0)
|
rails (= 5.0.7.1)
|
||||||
rails-i18n
|
rails-i18n
|
||||||
rails_12factor
|
rails_12factor
|
||||||
rake
|
rake
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
APP_PATH = File.expand_path('../config/application', __dir__)
|
||||||
require_relative '../config/boot'
|
require_relative '../config/boot'
|
||||||
require 'rails/commands'
|
require 'rails/commands'
|
||||||
|
|
29
bin/setup
29
bin/setup
|
@ -1,29 +1,34 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
|
require 'fileutils'
|
||||||
|
include FileUtils
|
||||||
|
|
||||||
# path to your application root.
|
# path to your application root.
|
||||||
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
||||||
|
|
||||||
Dir.chdir APP_ROOT do
|
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.
|
# This script is a starting point to setup your application.
|
||||||
# Add necessary setup steps to this file:
|
# Add necessary setup steps to this file.
|
||||||
|
|
||||||
puts "== Installing dependencies =="
|
puts '== Installing dependencies =='
|
||||||
system "gem install bundler --conservative"
|
system! 'gem install bundler --conservative'
|
||||||
system "bundle check || bundle install"
|
system('bundle check') || system!('bundle install')
|
||||||
|
|
||||||
# puts "\n== Copying sample files =="
|
# puts "\n== Copying sample files =="
|
||||||
# unless File.exist?("config/database.yml")
|
# unless File.exist?('config/database.yml')
|
||||||
# system "cp config/database.yml.sample config/database.yml"
|
# cp 'config/database.yml.sample', 'config/database.yml'
|
||||||
# end
|
# end
|
||||||
|
|
||||||
puts "\n== Preparing database =="
|
puts "\n== Preparing database =="
|
||||||
system "bin/rake db:setup"
|
system! 'bin/rails db:setup'
|
||||||
|
|
||||||
puts "\n== Removing old logs and tempfiles =="
|
puts "\n== Removing old logs and tempfiles =="
|
||||||
system "rm -f log/*"
|
system! 'bin/rails log:clear tmp:clear'
|
||||||
system "rm -rf tmp/cache"
|
|
||||||
|
|
||||||
puts "\n== Restarting application server =="
|
puts "\n== Restarting application server =="
|
||||||
system "touch tmp/restart.txt"
|
system! 'bin/rails restart'
|
||||||
end
|
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
|
|
@ -1,9 +1,12 @@
|
||||||
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
||||||
require File.expand_path('../boot', __FILE__)
|
require_relative 'boot'
|
||||||
|
|
||||||
require 'rails/all'
|
require 'rails/all'
|
||||||
|
|
||||||
Bundler.require *Rails.groups(:assets) if defined?(Bundler)
|
# Require the gems listed in Gemfile, including any gems
|
||||||
|
# you've limited to :test, :development, or :production.
|
||||||
|
Bundler.require(*Rails.groups)
|
||||||
|
|
||||||
|
|
||||||
#require File.expand_path('lib/htp') # Hamster Table Print
|
#require File.expand_path('lib/htp') # Hamster Table Print
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
||||||
# Load the rails application
|
# Load the Rails application
|
||||||
require File.expand_path('../application', __FILE__)
|
require_relative 'application'
|
||||||
|
|
||||||
Encoding.default_external = Encoding::UTF_8
|
Encoding.default_external = Encoding::UTF_8
|
||||||
Encoding.default_internal = Encoding::UTF_8
|
Encoding.default_internal = Encoding::UTF_8
|
||||||
|
|
|
@ -6,61 +6,81 @@ CarrierWave.configure do |config|
|
||||||
end
|
end
|
||||||
|
|
||||||
Rails.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.
|
||||||
|
|
||||||
# In the development environment your application's code is reloaded on
|
# In the development environment your application's code is reloaded on
|
||||||
# every request. This slows down response time but is perfect for development
|
# every request. This slows down response time but is perfect for development
|
||||||
# since you don't have to restart the web server when you make code changes.
|
# since you don't have to restart the web server when you make code changes.
|
||||||
config.cache_classes = false
|
config.cache_classes = false
|
||||||
config.cache_store = Settings.default.cache_store.to_sym
|
|
||||||
|
|
||||||
# Do not eager load code on boot.
|
# Do not eager load code on boot.
|
||||||
config.eager_load = false
|
config.eager_load = false
|
||||||
# Show full error reports and disable caching
|
|
||||||
config.consider_all_requests_local = true
|
# Show full error reports.
|
||||||
config.action_controller.perform_caching = false
|
config.consider_all_requests_local = true
|
||||||
|
|
||||||
|
# Enable/disable caching. By default caching is disabled.
|
||||||
|
if Rails.root.join('tmp/caching-dev.txt').exist?
|
||||||
|
config.action_controller.perform_caching = true
|
||||||
|
|
||||||
|
config.cache_store = :memory_store
|
||||||
|
config.public_file_server.headers = {
|
||||||
|
'Cache-Control' => 'public, max-age=172800'
|
||||||
|
}
|
||||||
|
else
|
||||||
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
|
config.cache_store = :null_store
|
||||||
|
end
|
||||||
|
|
||||||
# You can uncomment the following to test our real AWS email server on localhost:
|
# You can uncomment the following to test our real AWS email server on localhost:
|
||||||
# config.action_mailer.delivery_method = :aws_ses
|
# config.action_mailer.delivery_method = :aws_ses
|
||||||
# config.action_mailer.default_url_options = { host: 'commitchange.com' }
|
# config.action_mailer.default_url_options = { host: 'commitchange.com' }
|
||||||
config.action_mailer.delivery_method = Settings.mailer.delivery_method.to_sym
|
config.action_mailer.delivery_method = Settings.mailer.delivery_method.to_sym
|
||||||
config.action_mailer.smtp_settings = { address: Settings.mailer.address, port: Settings.mailer.port }
|
config.action_mailer.smtp_settings = { address: Settings.mailer.address, port: Settings.mailer.port }
|
||||||
config.action_mailer.smtp_settings['user_name']= Settings.mailer.username if Settings.mailer.username
|
config.action_mailer.smtp_settings['user_name']= Settings.mailer.username if Settings.mailer.username
|
||||||
config.action_mailer.smtp_settings['password']= Settings.mailer.password if Settings.mailer.password
|
config.action_mailer.smtp_settings['password']= Settings.mailer.password if Settings.mailer.password
|
||||||
|
|
||||||
|
config.action_mailer.default_url_options = { host: Settings.mailer.host }
|
||||||
|
|
||||||
config.action_mailer.default_url_options = { host: Settings.mailer.host }
|
|
||||||
# Don't care if the mailer can't send.
|
# Don't care if the mailer can't send.
|
||||||
config.action_mailer.raise_delivery_errors = false
|
config.action_mailer.raise_delivery_errors = false
|
||||||
# Print deprecation notices to the Rails logger
|
|
||||||
config.active_support.deprecation = :log
|
|
||||||
|
|
||||||
# Only use best-standards-support built into browsers
|
config.action_mailer.perform_caching = false
|
||||||
config.action_dispatch.best_standards_support = :builtin
|
|
||||||
|
|
||||||
# Raise exception on mass assignment protection for Active Record models
|
# Print deprecation notices to the Rails logger.
|
||||||
config.active_record.mass_assignment_sanitizer = :strict
|
config.active_support.deprecation = :log
|
||||||
|
|
||||||
# Raise an error on page load if there are pending migrations
|
# Raise exception on mass assignment protection for Active Record models
|
||||||
|
config.active_record.mass_assignment_sanitizer = :strict
|
||||||
|
|
||||||
|
# Raise an error on page load if there are pending migrations.
|
||||||
config.active_record.migration_error = :page_load
|
config.active_record.migration_error = :page_load
|
||||||
|
|
||||||
# Do not compress assets
|
# Debug mode disables concatenation and preprocessing of assets.
|
||||||
config.assets.compress = false
|
# This option may cause significant delays in view rendering with a large
|
||||||
|
# number of complex assets.
|
||||||
|
config.assets.debug = true
|
||||||
|
|
||||||
# Expands the lines which load the assets
|
# Suppress logger output for asset requests.
|
||||||
config.assets.debug = true
|
config.assets.quiet = true
|
||||||
|
|
||||||
config.assets.digest = true
|
# Adds additional error checking when serving assets at runtime.
|
||||||
# Adds additional error checking when serving assets at runtime.
|
|
||||||
# Checks for improperly declared sprockets dependencies.
|
# Checks for improperly declared sprockets dependencies.
|
||||||
# Raises helpful error messages.
|
# Raises helpful error messages.
|
||||||
config.assets.raise_runtime_errors = true
|
config.assets.raise_runtime_errors = true
|
||||||
|
|
||||||
config.log_level = :debug
|
# Raises error for missing translations
|
||||||
|
# config.action_view.raise_on_missing_translations = true
|
||||||
|
|
||||||
config.dependency_loading = true if $rails_rake_task
|
# Use an evented file watcher to asynchronously detect changes in source code,
|
||||||
# Turn this on if you want to mess with code inside /node_modules
|
# routes, locales, etc. This feature depends on the listen gem.
|
||||||
# config.browserify_rails.evaluate_node_modules = true
|
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
||||||
|
|
||||||
config.middleware.use I18n::JS::Middleware
|
config.log_level = :debug
|
||||||
|
|
||||||
|
config.dependency_loading = true if $rails_rake_task
|
||||||
|
|
||||||
|
config.middleware.use I18n::JS::Middleware
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,9 +19,9 @@ Rails.application.configure do
|
||||||
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
||||||
# config.action_dispatch.rack_cache = true
|
# config.action_dispatch.rack_cache = true
|
||||||
|
|
||||||
# Disable serving static files from the `/public` folder by default since
|
# Disable serving static files from thne `/public` folder by default since
|
||||||
# Apache or NGINX already handles this.
|
# Apache or NGINX already handles this.
|
||||||
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
||||||
|
|
||||||
# Compress JavaScripts and CSS.
|
# Compress JavaScripts and CSS.
|
||||||
config.assets.js_compressor = :uglifier
|
config.assets.js_compressor = :uglifier
|
||||||
|
@ -35,27 +35,31 @@ Rails.application.configure do
|
||||||
|
|
||||||
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
||||||
|
|
||||||
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||||
|
# config.action_controller.asset_host = 'http://assets.example.com'
|
||||||
|
|
||||||
|
|
||||||
# Specifies the header that your server uses for sending files.
|
# 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-Sendfile" # for Apache
|
||||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
# 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.
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||||
# config.force_ssl = true
|
config.force_ssl = true
|
||||||
|
|
||||||
# Set to :debug to see everything in the log.
|
# Set to :debug to see everything in the log.
|
||||||
config.log_level = :info
|
config.log_level = :info
|
||||||
|
|
||||||
# Prepend all log lines with the following tags.
|
# Prepend all log lines with the following tags.
|
||||||
# config.log_tags = [ :subdomain, :uuid ]
|
config.log_tags = [ :request_id ]
|
||||||
|
|
||||||
# Use a different logger for distributed setups.
|
|
||||||
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
|
||||||
|
|
||||||
# Use a different cache store in production.
|
# Use a different cache store in production.
|
||||||
# config.cache_store = :mem_cache_store
|
# config.cache_store = :mem_cache_store
|
||||||
|
|
||||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
# Use a real queuing backend for Active Job (and separate queues per environment)
|
||||||
# config.action_controller.asset_host = "http://assets.example.com"
|
# config.active_job.queue_adapter = :resque
|
||||||
|
# config.active_job.queue_name_prefix = "commitchange_#{Rails.env}"
|
||||||
|
|
||||||
|
config.action_mailer.perform_caching = false
|
||||||
|
|
||||||
# Ignore bad email addresses and do not raise email delivery errors.
|
# Ignore bad email addresses and do not raise email delivery errors.
|
||||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||||
|
@ -71,6 +75,16 @@ Rails.application.configure do
|
||||||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||||
config.log_formatter = ::Logger::Formatter.new
|
config.log_formatter = ::Logger::Formatter.new
|
||||||
|
|
||||||
|
# Use a different logger for distributed setups.
|
||||||
|
# require 'syslog/logger'
|
||||||
|
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
||||||
|
|
||||||
|
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
||||||
|
logger = ActiveSupport::Logger.new(STDOUT)
|
||||||
|
logger.formatter = config.log_formatter
|
||||||
|
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
||||||
|
end
|
||||||
|
|
||||||
# Do not dump schema after migrations.
|
# Do not dump schema after migrations.
|
||||||
config.active_record.dump_schema_after_migration = false
|
config.active_record.dump_schema_after_migration = false
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,9 +12,11 @@ Commitchange::Application.configure do
|
||||||
# preloads Rails for running tests, you may have to set it to true.
|
# preloads Rails for running tests, you may have to set it to true.
|
||||||
config.eager_load = false
|
config.eager_load = false
|
||||||
|
|
||||||
# Configure static file server for tests with Cache-Control for performance.
|
# Configure public file 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.public_file_server.headers = {
|
||||||
|
'Cache-Control' => 'public, max-age=3600'
|
||||||
|
}
|
||||||
|
|
||||||
# Show full error reports and disable caching.
|
# Show full error reports and disable caching.
|
||||||
config.consider_all_requests_local = true
|
config.consider_all_requests_local = true
|
||||||
|
@ -26,19 +28,19 @@ Commitchange::Application.configure do
|
||||||
# Disable request forgery protection in test environment.
|
# Disable request forgery protection in test environment.
|
||||||
config.action_controller.allow_forgery_protection = false
|
config.action_controller.allow_forgery_protection = false
|
||||||
|
|
||||||
|
config.action_mailer.perform_caching = false
|
||||||
|
|
||||||
# Tell Action Mailer not to deliver emails to the real world.
|
# Tell Action Mailer not to deliver emails to the real world.
|
||||||
# The :test delivery method accumulates sent emails in the
|
# The :test delivery method accumulates sent emails in the
|
||||||
# ActionMailer::Base.deliveries array.
|
# ActionMailer::Base.deliveries array.
|
||||||
config.action_mailer.delivery_method = :test
|
config.action_mailer.delivery_method = :test
|
||||||
config.action_mailer.raise_delivery_errors = false
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
# Randomize the order test cases are executed.
|
|
||||||
config.active_support.test_order = :random
|
|
||||||
|
|
||||||
|
|
||||||
# Print deprecation notices to the stderr.
|
# Print deprecation notices to the stderr.
|
||||||
config.active_support.deprecation = :stderr
|
config.active_support.deprecation = :stderr
|
||||||
|
|
||||||
|
# Randomize the order test cases are executed.
|
||||||
|
config.active_support.test_order = :random
|
||||||
|
|
||||||
config.action_mailer.default_url_options = {host: 'houdiniproject.test'}
|
config.action_mailer.default_url_options = {host: 'houdiniproject.test'}
|
||||||
|
|
||||||
|
|
8
config/initializers/application_controller_renderer.rb
Normal file
8
config/initializers/application_controller_renderer.rb
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# ActiveSupport::Reloader.to_prepare do
|
||||||
|
# ApplicationController.renderer.defaults.merge!(
|
||||||
|
# http_host: 'example.org',
|
||||||
|
# https: false
|
||||||
|
# )
|
||||||
|
# end
|
|
@ -1,3 +1,5 @@
|
||||||
# Be sure to restart your server when you modify this file.
|
# 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 = :json
|
Rails.application.config.action_dispatch.cookies_serializer = :json
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
||||||
I18n.available_locales = Settings.available_locales
|
I18n.available_locales = Settings.available_locales
|
||||||
|
Rails.application.config.i18n.fallbacks = [I18n.default_locale]
|
||||||
|
|
25
config/initializers/new_framework_defaults.rb
Normal file
25
config/initializers/new_framework_defaults.rb
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
#
|
||||||
|
# This file contains migration options to ease your Rails 5.0 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.
|
||||||
|
|
||||||
|
Rails.application.config.action_controller.raise_on_unfiltered_parameters = true
|
||||||
|
|
||||||
|
# Enable per-form CSRF tokens. Previous versions had false.
|
||||||
|
Rails.application.config.action_controller.per_form_csrf_tokens = false
|
||||||
|
|
||||||
|
# Enable origin-checking CSRF mitigation. Previous versions had false.
|
||||||
|
Rails.application.config.action_controller.forgery_protection_origin_check = false
|
||||||
|
|
||||||
|
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
|
||||||
|
# Previous versions had false.
|
||||||
|
ActiveSupport.to_time_preserves_timezone = false
|
||||||
|
|
||||||
|
# Require `belongs_to` associations by default. Previous versions had false.
|
||||||
|
Rails.application.config.active_record.belongs_to_required_by_default = false
|
||||||
|
|
||||||
|
# Do not halt callback chains when a callback returns false. Previous versions had true.
|
||||||
|
ActiveSupport.halt_callback_chains_on_return_false = true
|
|
@ -1,4 +1,3 @@
|
||||||
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
|
||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
# This file contains settings for ActionController::ParamsWrapper which
|
# This file contains settings for ActionController::ParamsWrapper which
|
||||||
|
@ -6,10 +5,10 @@
|
||||||
|
|
||||||
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||||
ActiveSupport.on_load(:action_controller) do
|
ActiveSupport.on_load(:action_controller) do
|
||||||
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
wrap_parameters format: [:json]
|
||||||
end
|
end
|
||||||
|
|
||||||
# To enable root element in JSON for ActiveRecord objects.
|
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
|
||||||
|
|
100
config/puma.rb
100
config/puma.rb
|
@ -1,88 +1,34 @@
|
||||||
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
||||||
workers Integer(ENV['WEB_CONCURRENCY'] || 1)
|
|
||||||
threads 1,1 #not threadsafe yet
|
# 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
|
||||||
|
|
||||||
preload_app! if ENV['RAILS_ENV'] != 'development'
|
preload_app! if ENV['RAILS_ENV'] != 'development'
|
||||||
|
|
||||||
rackup DefaultRackup
|
rackup DefaultRackup
|
||||||
port ENV['PORT'] || 5000
|
port ENV.fetch("PORT") { 5000 }
|
||||||
environment ENV['RAILS_ENV'] || 'development'
|
environment ENV.fetch('RAILS_ENV'{ 'development' }
|
||||||
|
|
||||||
|
workers ENV['WEB_CONCURRENCY'].fetch { 1 }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
on_worker_boot do
|
on_worker_boot do
|
||||||
ActiveSupport.on_load(:active_record) do
|
# ActiveSupport.on_load(:active_record) do
|
||||||
config = ActiveRecord::Base.configurations[Rails.env] ||
|
# config = ActiveRecord::Base.configurations[Rails.env] ||
|
||||||
Rails.application.config.database_configuration[Rails.env]
|
# Rails.application.config.database_configuration[Rails.env]
|
||||||
config['pool'] = ENV['RAILS_MAX_THREADS'] || 1
|
# config['pool'] = ENV['RAILS_MAX_THREADS'] || 1
|
||||||
ActiveRecord::Base.establish_connection
|
# ActiveRecord::Base.establish_connection
|
||||||
end
|
# end
|
||||||
|
ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
||||||
end
|
end
|
||||||
|
|
||||||
# rackup DefaultRackup
|
# Allow puma to be restarted by `rails restart` command.
|
||||||
# port ENV['PORT'] || 8080
|
plugin :tmp_restart
|
||||||
# environment ENV['RAILS_ENV'] || 'development'
|
|
||||||
# tag 'commitchange'
|
|
||||||
# # workers 2
|
|
||||||
# daemonize
|
|
||||||
#
|
|
||||||
# # Read environment
|
|
||||||
# require 'dotenv'
|
|
||||||
# Dotenv.load ".env"
|
|
||||||
# @env = ENV['RAILS_ENV']
|
|
||||||
# # || 'development'
|
|
||||||
# Dotenv.load ".env.#{@env}"
|
|
||||||
# puts ENV['PORT']
|
|
||||||
# puts "----------------------- #{@env} -----------------------------------"
|
|
||||||
# @dir = ENV['PUMADIR'] || ENV['PWD']
|
|
||||||
# @port = ENV['PORT'] || 10525
|
|
||||||
#
|
|
||||||
# workers Integer(ENV['WEB_CONCURRENCY'] || 1)
|
|
||||||
# threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 1)
|
|
||||||
# preload_app! if ENV['RAILS_ENV'] != 'development'
|
|
||||||
#
|
|
||||||
# if heroku?
|
|
||||||
# threads threads_count, threads_count
|
|
||||||
# else
|
|
||||||
# threads 1, threads_count
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# environment @env || 'development'
|
|
||||||
# #environment 'production'
|
|
||||||
#
|
|
||||||
# before_fork do
|
|
||||||
# require 'puma_worker_killer'
|
|
||||||
# PumaWorkerKiller.enable_rolling_restart # Default is every 6 hours
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# tmp_dir = File.expand_path("./tmp", @dir)
|
|
||||||
# log_dir = File.expand_path("./log", @dir)
|
|
||||||
#
|
|
||||||
# if @port
|
|
||||||
# port @port
|
|
||||||
# else
|
|
||||||
# bind "unix://#{tmp_dir}/sockets/puma.sock"
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# unless heroku?
|
|
||||||
# # Pid files
|
|
||||||
# pidfile "#{tmp_dir}/pids/puma.pid"
|
|
||||||
# state_path "#{tmp_dir}/pids/puma.state"
|
|
||||||
#
|
|
||||||
# # Logging
|
|
||||||
#
|
|
||||||
# if ENV['LOG_TO_FILES']
|
|
||||||
# puts "log to files #{log_dir}/puma.[stdout|stderr].#{@env}.log"
|
|
||||||
# stdout_redirect "#{log_dir}/puma.stdout.#{@env}.log", "#{log_dir}/puma.stderr.#{@env}.log", true
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# on_worker_boot do
|
|
||||||
# ActiveSupport.on_load(:active_record) do
|
|
||||||
# config = ActiveRecord::Base.configurations[Rails.env] ||
|
|
||||||
# Rails.application.config.database_configuration[Rails.env]
|
|
||||||
# config['pool'] = ENV['RAILS_MAX_THREADS'] || 1
|
|
||||||
# ActiveRecord::Base.establish_connection
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
6
config/spring.rb
Normal file
6
config/spring.rb
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
%w(
|
||||||
|
.ruby-version
|
||||||
|
.rbenv-vars
|
||||||
|
tmp/restart.txt
|
||||||
|
tmp/caching-dev.txt
|
||||||
|
).each { |path| Spring.watch(path) }
|
Loading…
Reference in a new issue