mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-22 05:50:47 +02:00
Initial upgrade to Rails 5.1
This commit is contained in:
parent
d24b9d9aa1
commit
1ccf96ae83
13 changed files with 118 additions and 60 deletions
2
Gemfile
2
Gemfile
|
@ -1,6 +1,6 @@
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
gem 'rails', '~> 5.0.0'
|
gem 'rails', '~> 5.1.0'
|
||||||
gem 'sass-rails', '~> 5.0'
|
gem 'sass-rails', '~> 5.0'
|
||||||
gem 'coffee-rails', '~> 4.2.0'
|
gem 'coffee-rails', '~> 4.2.0'
|
||||||
|
|
||||||
|
|
90
Gemfile.lock
90
Gemfile.lock
|
@ -3,53 +3,53 @@ GEM
|
||||||
specs:
|
specs:
|
||||||
RedCloth (4.3.2)
|
RedCloth (4.3.2)
|
||||||
aasm (3.4.0)
|
aasm (3.4.0)
|
||||||
actioncable (5.0.7)
|
actioncable (5.1.6)
|
||||||
actionpack (= 5.0.7)
|
actionpack (= 5.1.6)
|
||||||
nio4r (>= 1.2, < 3.0)
|
nio4r (~> 2.0)
|
||||||
websocket-driver (~> 0.6.1)
|
websocket-driver (~> 0.6.1)
|
||||||
actionmailer (5.0.7)
|
actionmailer (5.1.6)
|
||||||
actionpack (= 5.0.7)
|
actionpack (= 5.1.6)
|
||||||
actionview (= 5.0.7)
|
actionview (= 5.1.6)
|
||||||
activejob (= 5.0.7)
|
activejob (= 5.1.6)
|
||||||
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.7)
|
actionpack (5.1.6)
|
||||||
actionview (= 5.0.7)
|
actionview (= 5.1.6)
|
||||||
activesupport (= 5.0.7)
|
activesupport (= 5.1.6)
|
||||||
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)
|
||||||
actionpack-xml_parser (2.0.1)
|
actionpack-xml_parser (2.0.1)
|
||||||
actionpack (>= 5.0)
|
actionpack (>= 5.0)
|
||||||
railties (>= 5.0)
|
railties (>= 5.0)
|
||||||
actionview (5.0.7)
|
actionview (5.1.6)
|
||||||
activesupport (= 5.0.7)
|
activesupport (= 5.1.6)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubis (~> 2.7.0)
|
erubi (~> 1.4)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||||
activejob (5.0.7)
|
activejob (5.1.6)
|
||||||
activesupport (= 5.0.7)
|
activesupport (= 5.1.6)
|
||||||
globalid (>= 0.3.6)
|
globalid (>= 0.3.6)
|
||||||
activemodel (5.0.7)
|
activemodel (5.1.6)
|
||||||
activesupport (= 5.0.7)
|
activesupport (= 5.1.6)
|
||||||
activemodel-serializers-xml (1.0.2)
|
activemodel-serializers-xml (1.0.2)
|
||||||
activemodel (> 5.x)
|
activemodel (> 5.x)
|
||||||
activesupport (> 5.x)
|
activesupport (> 5.x)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
activerecord (5.0.7)
|
activerecord (5.1.6)
|
||||||
activemodel (= 5.0.7)
|
activemodel (= 5.1.6)
|
||||||
activesupport (= 5.0.7)
|
activesupport (= 5.1.6)
|
||||||
arel (~> 7.0)
|
arel (~> 8.0)
|
||||||
activesupport (5.0.7)
|
activesupport (5.1.6)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (>= 0.7, < 2)
|
i18n (>= 0.7, < 2)
|
||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
acts_as_list (0.9.15)
|
acts_as_list (0.9.15)
|
||||||
activerecord (>= 3.0)
|
activerecord (>= 3.0)
|
||||||
arel (7.1.4)
|
arel (8.0.0)
|
||||||
ast (2.4.0)
|
ast (2.4.0)
|
||||||
autoprefixer-rails (8.6.5)
|
autoprefixer-rails (8.6.5)
|
||||||
execjs
|
execjs
|
||||||
|
@ -79,7 +79,7 @@ GEM
|
||||||
database_cleaner (1.7.0)
|
database_cleaner (1.7.0)
|
||||||
diff-lcs (1.3)
|
diff-lcs (1.3)
|
||||||
docile (1.3.1)
|
docile (1.3.1)
|
||||||
erubis (2.7.0)
|
erubi (1.7.1)
|
||||||
execjs (2.7.0)
|
execjs (2.7.0)
|
||||||
factory_bot (4.10.0)
|
factory_bot (4.10.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
|
@ -92,7 +92,7 @@ GEM
|
||||||
globalid (0.4.1)
|
globalid (0.4.1)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
htmlentities (4.3.4)
|
htmlentities (4.3.4)
|
||||||
i18n (1.1.0)
|
i18n (1.1.1)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
jaro_winkler (1.5.1)
|
jaro_winkler (1.5.1)
|
||||||
jquery-rails (4.3.3)
|
jquery-rails (4.3.3)
|
||||||
|
@ -106,10 +106,10 @@ GEM
|
||||||
loofah (2.2.3)
|
loofah (2.2.3)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
mail (2.7.0)
|
mail (2.7.1)
|
||||||
mini_mime (>= 0.1.1)
|
mini_mime (>= 0.1.1)
|
||||||
metaclass (0.0.4)
|
metaclass (0.0.4)
|
||||||
method_source (0.9.0)
|
method_source (0.9.1)
|
||||||
mime-types (3.1)
|
mime-types (3.1)
|
||||||
mime-types-data (~> 3.2015)
|
mime-types-data (~> 3.2015)
|
||||||
mime-types-data (3.2016.0521)
|
mime-types-data (3.2016.0521)
|
||||||
|
@ -122,7 +122,7 @@ GEM
|
||||||
metaclass (~> 0.0.1)
|
metaclass (~> 0.0.1)
|
||||||
mysql2 (0.3.21)
|
mysql2 (0.3.21)
|
||||||
nio4r (2.3.1)
|
nio4r (2.3.1)
|
||||||
nokogiri (1.8.4)
|
nokogiri (1.8.5)
|
||||||
mini_portile2 (~> 2.3.0)
|
mini_portile2 (~> 2.3.0)
|
||||||
nokogumbo (1.5.0)
|
nokogumbo (1.5.0)
|
||||||
nokogiri
|
nokogiri
|
||||||
|
@ -142,19 +142,19 @@ GEM
|
||||||
rack (>= 1.1, < 2.1)
|
rack (>= 1.1, < 2.1)
|
||||||
rack-mini-profiler (1.0.0)
|
rack-mini-profiler (1.0.0)
|
||||||
rack (>= 1.2.0)
|
rack (>= 1.2.0)
|
||||||
rack-test (0.6.3)
|
rack-test (1.1.0)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0, < 3)
|
||||||
rails (5.0.7)
|
rails (5.1.6)
|
||||||
actioncable (= 5.0.7)
|
actioncable (= 5.1.6)
|
||||||
actionmailer (= 5.0.7)
|
actionmailer (= 5.1.6)
|
||||||
actionpack (= 5.0.7)
|
actionpack (= 5.1.6)
|
||||||
actionview (= 5.0.7)
|
actionview (= 5.1.6)
|
||||||
activejob (= 5.0.7)
|
activejob (= 5.1.6)
|
||||||
activemodel (= 5.0.7)
|
activemodel (= 5.1.6)
|
||||||
activerecord (= 5.0.7)
|
activerecord (= 5.1.6)
|
||||||
activesupport (= 5.0.7)
|
activesupport (= 5.1.6)
|
||||||
bundler (>= 1.3.0)
|
bundler (>= 1.3.0)
|
||||||
railties (= 5.0.7)
|
railties (= 5.1.6)
|
||||||
sprockets-rails (>= 2.0.0)
|
sprockets-rails (>= 2.0.0)
|
||||||
rails-controller-testing (1.0.2)
|
rails-controller-testing (1.0.2)
|
||||||
actionpack (~> 5.x, >= 5.0.1)
|
actionpack (~> 5.x, >= 5.0.1)
|
||||||
|
@ -167,9 +167,9 @@ GEM
|
||||||
loofah (~> 2.2, >= 2.2.2)
|
loofah (~> 2.2, >= 2.2.2)
|
||||||
rails_autolink (1.1.6)
|
rails_autolink (1.1.6)
|
||||||
rails (> 3.1)
|
rails (> 3.1)
|
||||||
railties (5.0.7)
|
railties (5.1.6)
|
||||||
actionpack (= 5.0.7)
|
actionpack (= 5.1.6)
|
||||||
activesupport (= 5.0.7)
|
activesupport (= 5.1.6)
|
||||||
method_source
|
method_source
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
|
@ -283,7 +283,7 @@ DEPENDENCIES
|
||||||
puma (~> 3.0)
|
puma (~> 3.0)
|
||||||
rack-dev-mark
|
rack-dev-mark
|
||||||
rack-mini-profiler
|
rack-mini-profiler
|
||||||
rails (~> 5.0.0)
|
rails (~> 5.1.0)
|
||||||
rails-controller-testing
|
rails-controller-testing
|
||||||
rails-dom-testing (~> 2.0.0)
|
rails-dom-testing (~> 2.0.0)
|
||||||
rails_autolink
|
rails_autolink
|
||||||
|
|
|
@ -18,6 +18,9 @@ chdir APP_ROOT do
|
||||||
system! 'gem install bundler --conservative'
|
system! 'gem install bundler --conservative'
|
||||||
system('bundle check') || system!('bundle install')
|
system('bundle check') || system!('bundle install')
|
||||||
|
|
||||||
|
# Install JavaScript dependencies if using Yarn
|
||||||
|
# system('bin/yarn')
|
||||||
|
|
||||||
# puts "\n== Copying sample files =="
|
# puts "\n== Copying sample files =="
|
||||||
# unless File.exist?('config/database.yml')
|
# unless File.exist?('config/database.yml')
|
||||||
# cp 'config/database.yml.sample', 'config/database.yml'
|
# cp 'config/database.yml.sample', 'config/database.yml'
|
||||||
|
|
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
|
|
@ -11,6 +11,9 @@ SITE_CONFIG = YAML.load_file(File.join(File.dirname(__FILE__), 'site.yml'))
|
||||||
|
|
||||||
module Tracksapp
|
module Tracksapp
|
||||||
class Application < Rails::Application
|
class Application < Rails::Application
|
||||||
|
# Initialize configuration defaults for originally generated Rails version.
|
||||||
|
config.load_defaults 5.1
|
||||||
|
|
||||||
# Settings in config/environments/* take precedence over those specified here.
|
# Settings in config/environments/* take precedence over those specified here.
|
||||||
# Application configuration should go into files in config/initializers
|
# Application configuration should go into files in config/initializers
|
||||||
# -- all .rb files in that directory are automatically loaded.
|
# -- all .rb files in that directory are automatically loaded.
|
||||||
|
|
|
@ -7,3 +7,4 @@ test:
|
||||||
production:
|
production:
|
||||||
adapter: redis
|
adapter: redis
|
||||||
url: redis://localhost:6379/1
|
url: redis://localhost:6379/1
|
||||||
|
channel_prefix: tracksapp_production
|
||||||
|
|
|
@ -18,7 +18,7 @@ Rails.application.configure do
|
||||||
|
|
||||||
config.cache_store = :memory_store
|
config.cache_store = :memory_store
|
||||||
config.public_file_server.headers = {
|
config.public_file_server.headers = {
|
||||||
'Cache-Control' => 'public, max-age=172800'
|
'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
config.action_controller.perform_caching = false
|
config.action_controller.perform_caching = false
|
||||||
|
@ -49,4 +49,8 @@ Rails.application.configure do
|
||||||
|
|
||||||
# Raises error for missing translations
|
# Raises error for missing translations
|
||||||
# config.action_view.raise_on_missing_translations = true
|
# config.action_view.raise_on_missing_translations = true
|
||||||
|
|
||||||
|
# Use an evented file watcher to asynchronously detect changes in source code,
|
||||||
|
# routes, locales, etc. This feature depends on the listen gem.
|
||||||
|
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@ Rails.application.configure do
|
||||||
# Configure public file server for tests with Cache-Control for performance.
|
# Configure public file server for tests with Cache-Control for performance.
|
||||||
config.public_file_server.enabled = true
|
config.public_file_server.enabled = true
|
||||||
config.public_file_server.headers = {
|
config.public_file_server.headers = {
|
||||||
'Cache-Control' => 'public, max-age=3600'
|
'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Show full error reports and disable caching.
|
# Show full error reports and disable caching.
|
||||||
|
|
|
@ -3,11 +3,14 @@
|
||||||
# Version of your assets, change this if you want to expire all your assets.
|
# Version of your assets, change this if you want to expire all your assets.
|
||||||
Rails.application.config.assets.version = '1.0'
|
Rails.application.config.assets.version = '1.0'
|
||||||
|
|
||||||
# Add additional assets to the asset load path
|
# Add additional assets to the asset load path.
|
||||||
# Rails.application.config.assets.paths << Emoji.images_path
|
# Rails.application.config.assets.paths << Emoji.images_path
|
||||||
|
# Add Yarn node_modules folder to the asset load path.
|
||||||
|
Rails.application.config.assets.paths << Rails.root.join('node_modules')
|
||||||
|
|
||||||
# Precompile additional assets.
|
# Precompile additional assets.
|
||||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
# application.js, application.css, and all non-JS/CSS in the app/assets
|
||||||
|
# folder are already added.
|
||||||
Rails.application.config.assets.precompile += %w( print.css mobile.css jquery-ui/datepicker-*.js swf_fu.js )
|
Rails.application.config.assets.precompile += %w( print.css mobile.css jquery-ui/datepicker-*.js swf_fu.js )
|
||||||
|
|
||||||
# add /app/assets/swfs to asset pipeline for charts
|
# add /app/assets/swfs to asset pipeline for charts
|
||||||
|
|
14
config/initializers/new_framework_defaults_5_1.rb
Normal file
14
config/initializers/new_framework_defaults_5_1.rb
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# 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,13 +1,13 @@
|
||||||
# Puma can serve each request in a thread from an internal thread pool.
|
# 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
|
# 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
|
# 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
|
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 }
|
port ENV.fetch("PORT") { 3000 }
|
||||||
|
|
||||||
|
@ -32,16 +32,25 @@ environment ENV.fetch("RAILS_ENV") { "development" }
|
||||||
#
|
#
|
||||||
# preload_app!
|
# 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
|
# 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
|
# 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!`
|
# 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
|
# option, you will want to use this block to reconnect to any threads
|
||||||
# or connections that may have been created at application boot, Ruby
|
# or connections that may have been created at application boot, as Ruby
|
||||||
# cannot share connections between processes.
|
# cannot share connections between processes.
|
||||||
#
|
#
|
||||||
# on_worker_boot do
|
# on_worker_boot do
|
||||||
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
||||||
# end
|
# end
|
||||||
|
#
|
||||||
|
|
||||||
# Allow puma to be restarted by `rails restart` command.
|
# Allow puma to be restarted by `rails restart` command.
|
||||||
plugin :tmp_restart
|
plugin :tmp_restart
|
||||||
|
|
|
@ -10,13 +10,23 @@
|
||||||
# Make sure the secrets in this file are kept private
|
# Make sure the secrets in this file are kept private
|
||||||
# if you're sharing your code publicly.
|
# if you're sharing your code publicly.
|
||||||
|
|
||||||
|
# Shared secrets are available across all environments.
|
||||||
|
|
||||||
|
# shared:
|
||||||
|
# api_key: a1B2c3D4e5F6
|
||||||
|
|
||||||
|
# Environmental secrets are only available for that specific environment.
|
||||||
|
|
||||||
development:
|
development:
|
||||||
secret_key_base: <%= SITE_CONFIG["secret_token"] || SecureRandom.hex(64) %>
|
secret_key_base: <%= SITE_CONFIG["secret_token"] || SecureRandom.hex(64) %>
|
||||||
|
|
||||||
test:
|
test:
|
||||||
secret_key_base: <%= SITE_CONFIG["secret_token"] || SecureRandom.hex(64) %>
|
secret_key_base: <%= SITE_CONFIG["secret_token"] || SecureRandom.hex(64) %>
|
||||||
|
|
||||||
# Do not keep production secrets in the repository,
|
# Do not keep production secrets in the unencrypted secrets file.
|
||||||
# instead read values from the environment.
|
# Instead, either read values from the environment.
|
||||||
|
# Or, use `bin/rails secrets:setup` to configure encrypted secrets
|
||||||
|
# and move the `production:` environment over there.
|
||||||
|
|
||||||
production:
|
production:
|
||||||
secret_key_base: <%= SITE_CONFIG["secret_token"] || SecureRandom.hex(64) %>
|
secret_key_base: <%= SITE_CONFIG["secret_token"] || SecureRandom.hex(64) %>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue