Migration to Ruby on Rails 5.1
This commit is contained in:
parent
4b7dfa2772
commit
1e369a8c41
29
bin/update
Executable file
29
bin/update
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
require 'pathname'
|
||||||
|
require 'fileutils'
|
||||||
|
include FileUtils
|
||||||
|
|
||||||
|
# path to your application root.
|
||||||
|
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
||||||
|
|
||||||
|
def system!(*args)
|
||||||
|
system(*args) || abort("\n== Command #{args} failed ==")
|
||||||
|
end
|
||||||
|
|
||||||
|
chdir APP_ROOT do
|
||||||
|
# This script is a way to update your development environment automatically.
|
||||||
|
# Add necessary update steps to this file.
|
||||||
|
|
||||||
|
puts '== Installing dependencies =='
|
||||||
|
system! 'gem install bundler --conservative'
|
||||||
|
system('bundle check') || system!('bundle install')
|
||||||
|
|
||||||
|
puts "\n== Updating database =="
|
||||||
|
system! 'bin/rails db:migrate'
|
||||||
|
|
||||||
|
puts "\n== Removing old logs and tempfiles =="
|
||||||
|
system! 'bin/rails log:clear tmp:clear'
|
||||||
|
|
||||||
|
puts "\n== Restarting application server =="
|
||||||
|
system! 'bin/rails restart'
|
||||||
|
end
|
11
bin/yarn
Executable file
11
bin/yarn
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
VENDOR_PATH = File.expand_path('..', __dir__)
|
||||||
|
Dir.chdir(VENDOR_PATH) do
|
||||||
|
begin
|
||||||
|
exec "yarnpkg #{ARGV.join(' ')}"
|
||||||
|
rescue Errno::ENOENT
|
||||||
|
warn 'Yarn executable was not detected in the system.'
|
||||||
|
warn 'Download Yarn at https://yarnpkg.com/en/docs/install'
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
end
|
10
config/cable.yml
Normal file
10
config/cable.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
development:
|
||||||
|
adapter: async
|
||||||
|
|
||||||
|
test:
|
||||||
|
adapter: async
|
||||||
|
|
||||||
|
production:
|
||||||
|
adapter: redis
|
||||||
|
url: redis://localhost:6379/1
|
||||||
|
channel_prefix: agenda_du_libre_rails_production
|
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
|
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
|
57
config/puma.rb
Normal file
57
config/puma.rb
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# Puma can serve each request in a thread from an internal thread pool.
|
||||||
|
# The `threads` method setting takes two numbers: a minimum and maximum.
|
||||||
|
# Any libraries that use thread pools should be configured to match
|
||||||
|
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
||||||
|
# and maximum; this matches the default thread size of Active Record.
|
||||||
|
#
|
||||||
|
threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }
|
||||||
|
threads 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!
|
||||||
|
|
||||||
|
# If you are preloading your application and using Active Record, it's
|
||||||
|
# recommended that you close any connections to the database before workers
|
||||||
|
# are forked to prevent connection leakage.
|
||||||
|
#
|
||||||
|
# before_fork do
|
||||||
|
# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
|
||||||
|
# end
|
||||||
|
|
||||||
|
# The code in the `on_worker_boot` will be called if you are using
|
||||||
|
# clustered mode by specifying a number of `workers`. After each worker
|
||||||
|
# process is booted, this block will be run. If you are using the `preload_app!`
|
||||||
|
# option, you will want to use this block to reconnect to any threads
|
||||||
|
# or connections that may have been created at application boot, as Ruby
|
||||||
|
# cannot share connections between processes.
|
||||||
|
#
|
||||||
|
# on_worker_boot do
|
||||||
|
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
|
||||||
|
# Allow puma to be restarted by `rails restart` command.
|
||||||
|
plugin :tmp_restart
|
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) }
|
@ -0,0 +1,33 @@
|
|||||||
|
# This migration comes from acts_as_taggable_on_engine (originally 6)
|
||||||
|
if ActiveRecord.gem_version >= Gem::Version.new('5.0')
|
||||||
|
class AddMissingIndexesOnTaggings < ActiveRecord::Migration[4.2]; end
|
||||||
|
else
|
||||||
|
class AddMissingIndexesOnTaggings < ActiveRecord::Migration; end
|
||||||
|
end
|
||||||
|
|
||||||
|
AddMissingIndexesOnTaggings.class_eval do
|
||||||
|
def change
|
||||||
|
add_index :taggings, :tag_id unless index_exists? :taggings, :tag_id
|
||||||
|
add_index :taggings, :taggable_id unless index_exists? :taggings,
|
||||||
|
:taggable_id
|
||||||
|
add_index :taggings, :taggable_type unless index_exists? :taggings,
|
||||||
|
:taggable_type
|
||||||
|
add_index :taggings, :tagger_id unless index_exists? :taggings, :tagger_id
|
||||||
|
add_index :taggings, :context unless index_exists? :taggings, :context
|
||||||
|
|
||||||
|
indexes
|
||||||
|
end
|
||||||
|
|
||||||
|
def indexes
|
||||||
|
unless index_exists? :taggings, %i[tagger_id tagger_type]
|
||||||
|
add_index :taggings, %i[tagger_id tagger_type]
|
||||||
|
end
|
||||||
|
|
||||||
|
unless index_exists? :taggings,
|
||||||
|
%i[taggable_id taggable_type tagger_id context],
|
||||||
|
name: 'taggings_idy'
|
||||||
|
add_index :taggings, %i[taggable_id taggable_type tagger_id context],
|
||||||
|
name: 'taggings_idy'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user