actualización a rails 6

This commit is contained in:
fauno 2022-03-24 21:14:02 -03:00
parent 8c202193e8
commit f10c624c2d
18 changed files with 350 additions and 237 deletions

14
Gemfile
View file

@ -4,17 +4,17 @@ source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" } git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.3' gem 'rails', '~> 6'
# Use sqlite3 as the database for Active Record # Use sqlite3 as the database for Active Record
gem 'sqlite3' gem 'sqlite3'
# Use Puma as the app server # Use Puma as the app server
gem 'puma', '~> 3.11' gem 'puma'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5' gem 'jbuilder'
# Use Redis adapter to run Action Cable in production # Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0' # gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password # Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7' gem 'bcrypt'
gem 'sucker_punch' gem 'sucker_punch'
gem 'validate_url' gem 'validate_url'
@ -24,7 +24,7 @@ gem 'webpush'
# gem 'mini_magick', '~> 4.8' # gem 'mini_magick', '~> 4.8'
# Reduces boot times through caching; required in config/boot.rb # Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false gem 'bootsnap', require: false
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), # Use Rack CORS for handling Cross-Origin Resource Sharing (CORS),
# making cross-origin AJAX possible # making cross-origin AJAX possible
@ -39,7 +39,7 @@ group :development, :test do
end end
group :development do group :development do
gem 'listen', '>= 3.0.5', '< 3.2' gem 'listen'
# Spring speeds up development by keeping your application running in # Spring speeds up development by keeping your application running in
# the background. Read more: https://github.com/rails/spring # the background. Read more: https://github.com/rails/spring
gem 'bcrypt_pbkdf' gem 'bcrypt_pbkdf'
@ -51,7 +51,7 @@ group :development do
gem 'ed25519' gem 'ed25519'
gem 'rubocop-rails' gem 'rubocop-rails'
gem 'spring' gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0' gem 'spring-watcher-listen'
gem 'stackprof' gem 'stackprof'
gem 'yard' gem 'yard'
end end

View file

@ -1,69 +1,86 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (5.2.5) actioncable (6.1.5)
actionpack (= 5.2.5) actionpack (= 6.1.5)
activesupport (= 6.1.5)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailer (5.2.5) actionmailbox (6.1.5)
actionpack (= 5.2.5) actionpack (= 6.1.5)
actionview (= 5.2.5) activejob (= 6.1.5)
activejob (= 5.2.5) activerecord (= 6.1.5)
activestorage (= 6.1.5)
activesupport (= 6.1.5)
mail (>= 2.7.1)
actionmailer (6.1.5)
actionpack (= 6.1.5)
actionview (= 6.1.5)
activejob (= 6.1.5)
activesupport (= 6.1.5)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (5.2.5) actionpack (6.1.5)
actionview (= 5.2.5) actionview (= 6.1.5)
activesupport (= 5.2.5) activesupport (= 6.1.5)
rack (~> 2.0, >= 2.0.8) rack (~> 2.0, >= 2.0.9)
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.2.0)
actionview (5.2.5) actiontext (6.1.5)
activesupport (= 5.2.5) actionpack (= 6.1.5)
activerecord (= 6.1.5)
activestorage (= 6.1.5)
activesupport (= 6.1.5)
nokogiri (>= 1.8.5)
actionview (6.1.5)
activesupport (= 6.1.5)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) 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.1, >= 1.2.0)
activejob (5.2.5) activejob (6.1.5)
activesupport (= 5.2.5) activesupport (= 6.1.5)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (5.2.5) activemodel (6.1.5)
activesupport (= 5.2.5) activesupport (= 6.1.5)
activerecord (5.2.5) activerecord (6.1.5)
activemodel (= 5.2.5) activemodel (= 6.1.5)
activesupport (= 5.2.5) activesupport (= 6.1.5)
arel (>= 9.0) activestorage (6.1.5)
activestorage (5.2.5) actionpack (= 6.1.5)
actionpack (= 5.2.5) activejob (= 6.1.5)
activerecord (= 5.2.5) activerecord (= 6.1.5)
marcel (~> 1.0.0) activesupport (= 6.1.5)
activesupport (5.2.5) marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.5)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2) i18n (>= 1.6, < 2)
minitest (~> 5.1) minitest (>= 5.1)
tzinfo (~> 1.1) tzinfo (~> 2.0)
zeitwerk (~> 2.3)
airbrussh (1.4.0) airbrussh (1.4.0)
sshkit (>= 1.6.1, != 1.7.0) sshkit (>= 1.6.1, != 1.7.0)
arel (9.0.0)
ast (2.4.2) ast (2.4.2)
axiom-types (0.1.1) axiom-types (0.1.1)
descendants_tracker (~> 0.0.4) descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0) ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1) thread_safe (~> 0.3, >= 0.3.1)
bcrypt (3.1.16) bcrypt (3.1.17)
bcrypt_pbkdf (1.1.0) bcrypt_pbkdf (1.1.0)
benchmark-ips (2.8.4) benchmark-ips (2.10.0)
bootsnap (1.7.3) bootsnap (1.11.1)
msgpack (~> 1.0) msgpack (~> 1.2)
builder (3.2.4) builder (3.2.4)
capistrano (3.16.0) capistrano (3.17.0)
airbrussh (>= 1.0.0) airbrussh (>= 1.0.0)
i18n i18n
rake (>= 10.0.0) rake (>= 10.0.0)
sshkit (>= 1.9.0) sshkit (>= 1.9.0)
capistrano-bundler (2.0.1) capistrano-bundler (2.0.1)
capistrano (~> 3.1) capistrano (~> 3.1)
capistrano-rails (1.6.1) capistrano-rails (1.6.2)
capistrano (~> 3.1) capistrano (~> 3.1)
capistrano-bundler (>= 1.1, < 3) capistrano-bundler (>= 1.1, < 3)
capistrano-rbenv (2.2.0) capistrano-rbenv (2.2.0)
@ -72,16 +89,16 @@ GEM
coderay (1.1.3) coderay (1.1.3)
coercible (1.0.0) coercible (1.0.0)
descendants_tracker (~> 0.0.1) descendants_tracker (~> 0.0.1)
concurrent-ruby (1.1.8) concurrent-ruby (1.1.10)
crass (1.0.6) crass (1.0.6)
database_cleaner (2.0.1) database_cleaner (2.0.1)
database_cleaner-active_record (~> 2.0.0) database_cleaner-active_record (~> 2.0.0)
database_cleaner-active_record (2.0.0) database_cleaner-active_record (2.0.1)
activerecord (>= 5.a) activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0) database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1) database_cleaner-core (2.0.1)
dead_end (1.1.6) dead_end (3.1.1)
derailed_benchmarks (2.0.1) derailed_benchmarks (2.1.1)
benchmark-ips (~> 2) benchmark-ips (~> 2)
dead_end dead_end
get_process_mem (~> 0) get_process_mem (~> 0)
@ -95,145 +112,147 @@ GEM
thor (>= 0.19, < 2) thor (>= 0.19, < 2)
descendants_tracker (0.0.4) descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1) thread_safe (~> 0.3, >= 0.3.1)
ed25519 (1.2.4) ed25519 (1.3.0)
equalizer (0.0.11) equalizer (0.0.11)
erubi (1.10.0) erubi (1.10.0)
factory_bot (6.1.0) factory_bot (6.2.1)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
factory_bot_rails (6.1.0) factory_bot_rails (6.2.0)
factory_bot (~> 6.1.0) factory_bot (~> 6.2.0)
railties (>= 5.0.0) railties (>= 5.0.0)
ffi (1.15.0) ffi (1.15.5)
get_process_mem (0.2.7) get_process_mem (0.2.7)
ffi (~> 1.0) ffi (~> 1.0)
globalid (0.4.2) globalid (1.0.0)
activesupport (>= 4.2.0) activesupport (>= 5.0)
heapy (0.2.0) heapy (0.2.0)
thor thor
hkdf (0.3.0) hkdf (0.3.0)
httpclient (2.8.3) httpclient (2.8.3)
i18n (1.8.10) i18n (1.10.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
ice_nine (0.11.2) ice_nine (0.11.2)
jbuilder (2.11.2) jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
jwt (2.2.2) jwt (2.3.0)
listen (3.1.5) listen (3.7.1)
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.10)
ruby_dep (~> 1.2) loofah (2.15.0)
loofah (2.9.1)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.7.1) mail (2.7.1)
mini_mime (>= 0.1.1) mini_mime (>= 0.1.1)
marcel (1.0.1) marcel (1.0.2)
memory_profiler (1.0.0) memory_profiler (1.0.0)
method_source (1.0.0) method_source (1.0.0)
mini_histogram (0.3.1) mini_histogram (0.3.1)
mini_mime (1.1.0) mini_mime (1.1.2)
mini_portile2 (2.5.0) mini_portile2 (2.8.0)
minitest (5.14.4) minitest (5.15.0)
msgpack (1.4.2) msgpack (1.4.5)
net-scp (3.0.0) net-scp (3.0.0)
net-ssh (>= 2.6.5, < 7.0.0) net-ssh (>= 2.6.5, < 7.0.0)
net-ssh (6.1.0) net-ssh (6.1.0)
nio4r (2.5.7) nio4r (2.5.8)
nokogiri (1.11.3) nokogiri (1.13.3)
mini_portile2 (~> 2.5.0) mini_portile2 (~> 2.8.0)
racc (~> 1.4) racc (~> 1.4)
parallel (1.20.1) parallel (1.22.0)
parser (3.0.1.0) parser (3.1.1.0)
ast (~> 2.4.1) ast (~> 2.4.1)
pry (0.14.0) pry (0.14.1)
coderay (~> 1.1) coderay (~> 1.1)
method_source (~> 1.0) method_source (~> 1.0)
public_suffix (4.0.6) public_suffix (4.0.6)
puma (3.12.6) puma (5.6.2)
racc (1.5.2) nio4r (~> 2.0)
racc (1.6.0)
rack (2.2.3) rack (2.2.3)
rack-cors (1.1.1) rack-cors (1.1.1)
rack (>= 2.0.0) rack (>= 2.0.0)
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rails (5.2.5) rails (6.1.5)
actioncable (= 5.2.5) actioncable (= 6.1.5)
actionmailer (= 5.2.5) actionmailbox (= 6.1.5)
actionpack (= 5.2.5) actionmailer (= 6.1.5)
actionview (= 5.2.5) actionpack (= 6.1.5)
activejob (= 5.2.5) actiontext (= 6.1.5)
activemodel (= 5.2.5) actionview (= 6.1.5)
activerecord (= 5.2.5) activejob (= 6.1.5)
activestorage (= 5.2.5) activemodel (= 6.1.5)
activesupport (= 5.2.5) activerecord (= 6.1.5)
bundler (>= 1.3.0) activestorage (= 6.1.5)
railties (= 5.2.5) activesupport (= 6.1.5)
bundler (>= 1.15.0)
railties (= 6.1.5)
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)
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0) rails-html-sanitizer (1.4.2)
loofah (~> 2.3) loofah (~> 2.3)
railties (5.2.5) railties (6.1.5)
actionpack (= 5.2.5) actionpack (= 6.1.5)
activesupport (= 5.2.5) activesupport (= 6.1.5)
method_source method_source
rake (>= 0.8.7) rake (>= 12.2)
thor (>= 0.19.0, < 2.0) thor (~> 1.0)
rainbow (3.0.0) rainbow (3.1.1)
rake (13.0.3) rake (13.0.6)
rb-fsevent (0.10.4) rb-fsevent (0.11.1)
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
regexp_parser (2.1.1) regexp_parser (2.2.1)
rexml (3.2.5) rexml (3.2.5)
rubocop (1.12.1) rubocop (1.26.1)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 3.0.0.0) parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0) regexp_parser (>= 1.8, < 3.0)
rexml rexml
rubocop-ast (>= 1.2.0, < 2.0) rubocop-ast (>= 1.16.0, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0) unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.4.1) rubocop-ast (1.16.0)
parser (>= 2.7.1.5) parser (>= 3.1.1.0)
rubocop-rails (2.9.1) rubocop-rails (2.14.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
rack (>= 1.1) rack (>= 1.1)
rubocop (>= 0.90.0, < 2.0) rubocop (>= 1.7.0, < 2.0)
ruby-progressbar (1.11.0) ruby-progressbar (1.11.0)
ruby-statistics (2.1.3) ruby-statistics (3.0.0)
ruby_dep (1.5.0)
spring (2.1.1) spring (2.1.1)
spring-watcher-listen (2.0.1) spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0) listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0) spring (>= 1.2, < 3.0)
sprockets (4.0.2) sprockets (4.0.3)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-rails (3.2.2) sprockets-rails (3.4.2)
actionpack (>= 4.0) actionpack (>= 5.2)
activesupport (>= 4.0) activesupport (>= 5.2)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sqlite3 (1.4.2) sqlite3 (1.4.2)
sshkit (1.21.2) sshkit (1.21.2)
net-scp (>= 1.1.2) net-scp (>= 1.1.2)
net-ssh (>= 2.8.0) net-ssh (>= 2.8.0)
stackprof (0.2.16) stackprof (0.2.19)
sucker_punch (3.0.1) sucker_punch (3.0.1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
telegram-bot (0.15.3) telegram-bot (0.15.6)
actionpack (>= 4.0, < 6.2) actionpack (>= 4.0, < 7.1)
activesupport (>= 4.0, < 6.2) activesupport (>= 4.0, < 7.1)
httpclient (~> 2.7) httpclient (~> 2.7)
telegram-bot-types (0.6.2) telegram-bot-types (0.6.3)
virtus (~> 1.0) virtus (~> 1.0)
thor (1.1.0) thor (1.2.1)
thread_safe (0.3.6) thread_safe (0.3.6)
tzinfo (1.2.9) tzinfo (2.0.4)
thread_safe (~> 0.1) concurrent-ruby (~> 1.0)
unicode-display_width (2.0.0) unicode-display_width (2.1.0)
validate_url (1.0.13) validate_url (1.0.13)
activemodel (>= 3.0.0) activemodel (>= 3.0.0)
public_suffix public_suffix
@ -245,18 +264,21 @@ GEM
webpush (1.1.0) webpush (1.1.0)
hkdf (~> 0.2) hkdf (~> 0.2)
jwt (~> 2.0) jwt (~> 2.0)
websocket-driver (0.7.3) webrick (1.7.0)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5) websocket-extensions (0.1.5)
yard (0.9.26) yard (0.9.27)
webrick (~> 1.7.0)
zeitwerk (2.5.4)
PLATFORMS PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
bcrypt (~> 3.1.7) bcrypt
bcrypt_pbkdf bcrypt_pbkdf
bootsnap (>= 1.1.0) bootsnap
capistrano capistrano
capistrano-bundler capistrano-bundler
capistrano-rails capistrano-rails
@ -265,15 +287,15 @@ DEPENDENCIES
derailed_benchmarks derailed_benchmarks
ed25519 ed25519
factory_bot_rails factory_bot_rails
jbuilder (~> 2.5) jbuilder
listen (>= 3.0.5, < 3.2) listen
pry pry
puma (~> 3.11) puma
rack-cors rack-cors
rails (~> 5.2.3) rails (~> 6)
rubocop-rails rubocop-rails
spring spring
spring-watcher-listen (~> 2.0.0) spring-watcher-listen
sqlite3 sqlite3
stackprof stackprof
sucker_punch sucker_punch
@ -284,4 +306,4 @@ DEPENDENCIES
yard yard
BUNDLED WITH BUNDLED WITH
2.1.4 2.2.2

View file

@ -68,7 +68,7 @@ class BarcasController < ApplicationController
# Las piratas solo pueden modificar sus propias barcas # Las piratas solo pueden modificar sus propias barcas
@barca = current_pirata.barcas.find(params[:id]) @barca = current_pirata.barcas.find(params[:id])
if @barca.update_attributes barca_params if @barca.update barca_params
notify(subject: :update, urgency: :high) notify(subject: :update, urgency: :high)
render status: :no_content render status: :no_content
else else

View file

@ -1,11 +1,6 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# frozen_string_literal: true # frozen_string_literal: true
load File.expand_path('spring', __dir__)
begin
load File.expand_path('spring', __dir__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../config/application', __dir__) APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot' require_relative '../config/boot'
require 'rails/commands' require 'rails/commands'

View file

@ -1,11 +1,6 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# frozen_string_literal: true # frozen_string_literal: true
load File.expand_path('spring', __dir__)
begin
load File.expand_path('spring', __dir__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
require_relative '../config/boot' require_relative '../config/boot'
require 'rake' require 'rake'
Rake.application.run Rake.application.run

View file

@ -1,8 +1,6 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# frozen_string_literal: true # frozen_string_literal: true
require 'fileutils' require 'fileutils'
include FileUtils
# path to your application root. # path to your application root.
APP_ROOT = File.expand_path('..', __dir__) APP_ROOT = File.expand_path('..', __dir__)
@ -11,8 +9,9 @@ def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==") system(*args) || abort("\n== Command #{args} failed ==")
end end
chdir APP_ROOT do FileUtils.chdir APP_ROOT do
# This script is a starting point to setup your application. # This script is a way to set up or update your development environment automatically.
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file. # Add necessary setup steps to this file.
puts '== Installing dependencies ==' puts '== Installing dependencies =='
@ -21,11 +20,11 @@ chdir APP_ROOT do
# 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' # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
# end # end
puts "\n== Preparing database ==" puts "\n== Preparing database =="
system! 'bin/rails db:setup' system! 'bin/rails db:prepare'
puts "\n== Removing old logs and tempfiles ==" puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear' system! 'bin/rails log:clear tmp:clear'

View file

@ -1,18 +1,15 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# frozen_string_literal: true # frozen_string_literal: true
if !defined?(Spring) && [nil, 'development', 'test'].include?(ENV['RAILS_ENV'])
# This file loads spring without using Bundler, in order to be fast. gem 'bundler'
# It gets overwritten when you run the `spring binstub` command.
unless defined?(Spring)
require 'rubygems'
require 'bundler' require 'bundler'
lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) # Load Spring without loading other gems in the Gemfile, for speed.
spring = lockfile.specs.detect { |spec| spec.name == 'spring' } Bundler.locked_gems&.specs&.find { |spec| spec.name == 'spring' }&.tap do |spring|
if spring
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
gem 'spring', spring.version gem 'spring', spring.version
require 'spring/binstub' require 'spring/binstub'
rescue Gem::LoadError
# Ignore when Spring is not installed.
end end
end end

View file

@ -5,3 +5,4 @@
require_relative 'config/environment' require_relative 'config/environment'
run Rails.application run Rails.application
Rails.application.load_server

View file

@ -7,7 +7,14 @@ require 'rails'
require 'active_model/railtie' require 'active_model/railtie'
require 'active_job/railtie' require 'active_job/railtie'
require 'active_record/railtie' require 'active_record/railtie'
# require 'active_storage/engine'
require 'action_controller/railtie' require 'action_controller/railtie'
# require 'action_mailer/railtie'
# require 'action_mailbox/engine'
# require 'action_text/engine'
# require 'action_view/railtie'
# require 'action_cable/engine'
# require 'sprockets/railtie'
require 'rails/test_unit/railtie' require 'rails/test_unit/railtie'
# Require the gems listed in Gemfile, including any gems # Require the gems listed in Gemfile, including any gems
@ -20,10 +27,13 @@ module MiniloomApi
# Initialize configuration defaults for originally generated Rails version. # Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2 config.load_defaults 5.2
# Settings in config/environments/* take precedence over those specified here. # Configuration for the application, engines, and railties goes here.
# Application configuration can go into files in config/initializers #
# -- all .rb files in that directory are automatically loaded after loading # These settings can be overridden in specific environments using the files
# the framework and any gems in your application. # in config/environments, which are processed later.
#
# config.time_zone = 'Central Time (US & Canada)'
# config.eager_load_paths << Rails.root.join('extras')
# Only loads a smaller set of middleware suitable for API only apps. # Only loads a smaller set of middleware suitable for API only apps.
# Middleware like session, flash, cookies can be added back manually. # Middleware like session, flash, cookies can be added back manually.

View file

@ -1,5 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'active_support/core_ext/integer/time'
Rails.application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in # Settings specified here will take precedence over those in
# config/application.rb. # config/application.rb.
@ -19,8 +21,6 @@ Rails.application.configure do
# Enable/disable caching. By default caching is disabled. # Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching. # Run rails dev:cache to toggle caching.
if Rails.root.join('tmp', 'caching-dev.txt').exist? if Rails.root.join('tmp', 'caching-dev.txt').exist?
config.action_controller.perform_caching = true
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=#{2.days.to_i}" 'Cache-Control' => "public, max-age=#{2.days.to_i}"
@ -31,29 +31,32 @@ Rails.application.configure do
config.cache_store = :null_store config.cache_store = :null_store
end end
# Store uploaded files on the local file system (see
# config/storage.yml for options)
# config.active_storage.service = :local
# Don't care if the mailer can't send.
# config.action_mailer.raise_delivery_errors = false
# config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger. # Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log config.active_support.deprecation = :log
# Raise exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Raise an error on page load if there are pending migrations. # 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
# Highlight code that triggered database queries in logs. # Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true config.active_record.verbose_query_logs = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in # Raises error for missing translations.
# source code, routes, locales, etc. This feature depends on the # config.i18n.raise_on_missing_translations = true
# listen gem.
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = 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 config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
end end

View file

@ -1,5 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'active_support/core_ext/integer/time'
Rails.application.routes.default_url_options[:host] = ENV.fetch('API_HOST', 'api.lumi.partidopirata.com.ar') Rails.application.routes.default_url_options[:host] = ENV.fetch('API_HOST', 'api.lumi.partidopirata.com.ar')
Rails.application.routes.default_url_options[:protocol] = 'https' Rails.application.routes.default_url_options[:protocol] = 'https'
@ -18,7 +20,6 @@ Rails.application.configure do
# Full error reports are disabled and caching is turned on. # Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Ensures that a master key has been made available in either # Ensures that a master key has been made available in either
# ENV["RAILS_MASTER_KEY"] or in config/master.key. This key is used to # ENV["RAILS_MASTER_KEY"] or in config/master.key. This key is used to
@ -36,28 +37,19 @@ Rails.application.configure do
# 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
# Store uploaded files on the local file system (see
# config/storage.yml for options)
# config.active_storage.service = :local
# Mount Action Cable outside main process or domain
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com',
# /http:\/\/example.*/ ]
# Force all access to the app over SSL, use Strict-Transport-Security, # Force all access to the app over SSL, use Strict-Transport-Security,
# and use secure cookies. # and use secure cookies.
config.force_ssl = true config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic # Include generic and useful information about system operation, but avoid
# information when problems arise. # logging too much information to avoid inadvertent exposure of personally
# identifiable information (PII).
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 = [:request_id] config.log_tags = %i[request_id]
# 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
@ -67,20 +59,22 @@ Rails.application.configure do
config.active_job.queue_adapter = :sucker_punch config.active_job.queue_adapter = :sucker_punch
config.active_job.queue_name_prefix = "lumi_#{Rails.env}" config.active_job.queue_name_prefix = "lumi_#{Rails.env}"
# config.action_mailer.perform_caching = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
# 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.
#
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall
# back to the I18n.default_locale when a translation cannot 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 disallowed deprecations.
config.active_support.disallowed_deprecation = :log
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups. # Use a different logger for distributed setups.
require 'syslog/logger' require 'syslog/logger'
config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new('miniloom')) config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new('miniloom'))
@ -93,4 +87,25 @@ Rails.application.configure do
# 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
# Inserts middleware to perform automatic connection switching.
# The `database_selector` hash is used to pass options to the DatabaseSelector
# middleware. The `delay` is used to determine how long to wait after a write
# to send a subsequent read to the primary.
#
# The `database_resolver` class is used by the middleware to determine which
# database is appropriate to use based on the time delay.
#
# The `database_resolver_context` class is used by the middleware to set
# timestamps for the last write to the primary. The resolver uses the context
# class timestamps to determine how long to wait before reading from the
# replica.
#
# By default Rails will store a last write timestamp in the session. The
# DatabaseSelector middleware is designed as such you can define your own
# strategy for connection switching and pass that into the middleware through
# these configuration options.
# config.active_record.database_selector = { delay: 2.seconds }
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
end end

View file

@ -1,14 +1,18 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'active_support/core_ext/integer/time'
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in # Settings specified here will take precedence over those in
# config/application.rb. # config/application.rb.
# The test environment is used exclusively to run your application's config.cache_classes = false
# test suite. You never need to work with it otherwise. Remember that config.action_view.cache_template_loading = true
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole # Do not eager load code on boot. This avoids loading your whole
# application just for the purpose of running a single test. If you # application just for the purpose of running a single test. If you
@ -19,12 +23,14 @@ Rails.application.configure do
# Configure public file server for tests with Cache-Control for # Configure public file server for tests with Cache-Control for
# performance. # performance.
config.public_file_server.enabled = true config.public_file_server.enabled = true
config.public_file_server.headers = { 'Cache-Control' => "public, config.public_file_server.headers = {
max-age=#{1.hour.to_i}" } 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
}
# 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
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
config.cache_store = :null_store
# Raise exceptions instead of rendering exception templates. # Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false config.action_dispatch.show_exceptions = false
@ -32,20 +38,18 @@ Rails.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
# Store uploaded files on the local file system in a temporary
# directory
# config.active_storage.service = :test
# config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
# config.action_mailer.delivery_method = :test
# Print deprecation notices to the stderr. # Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr config.active_support.deprecation = :stderr
# Raises error for missing translations # Raise exceptions for disallowed deprecations.
# config.action_view.raise_on_missing_translations = true config.active_support.disallowed_deprecation = :raise
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Raises error for missing translations.
# config.i18n.raise_on_missing_translations = true
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
end end

View file

@ -7,6 +7,6 @@
# Rails.backtrace_cleaner.add_silencer { |line| line =~ # Rails.backtrace_cleaner.add_silencer { |line| line =~
# /my_noisy_library/ } # /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
# problem that might stem from framework code. # by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
# Rails.backtrace_cleaner.remove_silencers! Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]

View file

@ -3,4 +3,6 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file. # Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password] Rails.application.config.filter_parameters += %i[
password passw secret token _key crypt salt certificate otp ssn
]

View file

@ -0,0 +1,67 @@
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 6.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.
# Support for inversing belongs_to -> has_many Active Record associations.
# Rails.application.config.active_record.has_many_inversing = true
# Track Active Storage variants in the database.
# Rails.application.config.active_storage.track_variants = true
# Apply random variation to the delay when retrying failed jobs.
# Rails.application.config.active_job.retry_jitter = 0.15
# Stop executing `after_enqueue`/`after_perform` callbacks if
# `before_enqueue`/`before_perform` respectively halts with `throw :abort`.
# Rails.application.config.active_job.skip_after_callbacks_if_terminated = true
# Specify cookies SameSite protection level: either :none, :lax, or :strict.
#
# This change is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.1.
# Rails.application.config.action_dispatch.cookies_same_site_protection = :lax
# Generate CSRF tokens that are encoded in URL-safe Base64.
#
# This change is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.1.
# Rails.application.config.action_controller.urlsafe_csrf_tokens = true
# Specify whether `ActiveSupport::TimeZone.utc_to_local` returns a time with an
# UTC offset or a UTC time.
# ActiveSupport.utc_to_local_returns_utc_offset_times = true
# Change the default HTTP status code to `308` when redirecting non-GET/HEAD
# requests to HTTPS in `ActionDispatch::SSL` middleware.
# Rails.application.config.action_dispatch.ssl_default_redirect_status = 308
# Use new connection handling API. For most applications this won't have any
# effect. For applications using multiple databases, this new API provides
# support for granular connection swapping.
# Rails.application.config.active_record.legacy_connection_handling = false
# Make `form_with` generate non-remote forms by default.
# Rails.application.config.action_view.form_with_generates_remote_forms = false
# Set the default queue name for the analysis job to the queue adapter default.
# Rails.application.config.active_storage.queues.analysis = nil
# Set the default queue name for the purge job to the queue adapter default.
# Rails.application.config.active_storage.queues.purge = nil
# Set the default queue name for the incineration job to the queue adapter default.
# Rails.application.config.action_mailbox.queues.incineration = nil
# Set the default queue name for the routing job to the queue adapter default.
# Rails.application.config.action_mailbox.queues.routing = nil
# Set the default queue name for the mail deliver job to the queue adapter default.
# Rails.application.config.action_mailer.deliver_later_queue_name = nil
# Generate a `Link` header that gives a hint to modern browsers about
# preloading assets when using `javascript_include_tag` and `stylesheet_link_tag`.
# Rails.application.config.action_view.preload_links_header = true

View file

@ -5,8 +5,7 @@
# This file contains settings for ActionController::ParamsWrapper which # This file contains settings for ActionController::ParamsWrapper which
# is enabled by default. # is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
# :format to an empty array.
ActiveSupport.on_load(:action_controller) do ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json] wrap_parameters format: [:json]
end end

View file

@ -6,8 +6,14 @@
# maximum value specified for Puma. Default is set to 5 threads for # maximum value specified for Puma. Default is set to 5 threads for
# minimum and maximum; this matches the default thread size of Active # minimum and maximum; this matches the default thread size of Active
# Record. # Record.
threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 } max_threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }
threads threads_count, threads_count min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count }
threads min_threads_count, max_threads_count
# Specifies the `worker_timeout` threshold that Puma will use to wait before
# terminating a worker in development environments.
#
worker_timeout 3600 if ENV.fetch('RAILS_ENV', 'development') == 'development'
# Specifies the `port` that Puma will listen on to receive requests; # Specifies the `port` that Puma will listen on to receive requests;
# default is 3000. # default is 3000.
@ -18,6 +24,9 @@ port ENV.fetch('PORT') { 3000 }
# #
environment ENV.fetch('RAILS_ENV') { 'development' } environment ENV.fetch('RAILS_ENV') { 'development' }
# Specifies the `pidfile` that Puma will use.
pidfile ENV.fetch('PIDFILE') { 'tmp/pids/server.pid' }
# Specifies the number of `workers` to boot in clustered mode. Workers # Specifies the number of `workers` to boot in clustered mode. Workers
# are forked webserver processes. If using threads and workers together # are forked webserver processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`. # the concurrency of the application would be max `threads` * `workers`.

View file

@ -1,8 +1,3 @@
# frozen_string_literal: true # frozen_string_literal: true
%w[ Spring.watch(*%w[.ruby-version .rbenv-vars tmp/restart.txt tmp/caching-dev.txt])
.ruby-version
.rbenv-vars
tmp/restart.txt
tmp/caching-dev.txt
].each { |path| Spring.watch(path) }