5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-21 22:36:22 +00:00

actualizar a rails 6 y jekyll 4

This commit is contained in:
f 2019-08-29 14:54:19 -03:00
parent 39643637bf
commit b598022650
No known key found for this signature in database
GPG key ID: 2AE5A13E321F953D
14 changed files with 289 additions and 201 deletions

View file

@ -10,9 +10,9 @@ end
gem 'dotenv-rails', require: 'dotenv/rails-now'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2'
gem 'rails', '~> 6'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.3.6'
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets

View file

@ -1,69 +1,82 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.3)
actionpack (= 5.2.3)
actioncable (6.0.0)
actionpack (= 6.0.0)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.3)
actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
actionmailbox (6.0.0)
actionpack (= 6.0.0)
activejob (= 6.0.0)
activerecord (= 6.0.0)
activestorage (= 6.0.0)
activesupport (= 6.0.0)
mail (>= 2.7.1)
actionmailer (6.0.0)
actionpack (= 6.0.0)
actionview (= 6.0.0)
activejob (= 6.0.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.3)
actionview (= 5.2.3)
activesupport (= 5.2.3)
actionpack (6.0.0)
actionview (= 6.0.0)
activesupport (= 6.0.0)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.3)
activesupport (= 5.2.3)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.0)
actionpack (= 6.0.0)
activerecord (= 6.0.0)
activestorage (= 6.0.0)
activesupport (= 6.0.0)
nokogiri (>= 1.8.5)
actionview (6.0.0)
activesupport (= 6.0.0)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.3)
activesupport (= 5.2.3)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.0.0)
activesupport (= 6.0.0)
globalid (>= 0.3.6)
activemodel (5.2.3)
activesupport (= 5.2.3)
activerecord (5.2.3)
activemodel (= 5.2.3)
activesupport (= 5.2.3)
arel (>= 9.0)
activestorage (5.2.3)
actionpack (= 5.2.3)
activerecord (= 5.2.3)
activemodel (6.0.0)
activesupport (= 6.0.0)
activerecord (6.0.0)
activemodel (= 6.0.0)
activesupport (= 6.0.0)
activestorage (6.0.0)
actionpack (= 6.0.0)
activejob (= 6.0.0)
activerecord (= 6.0.0)
marcel (~> 0.3.1)
activesupport (5.2.3)
activesupport (6.0.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.1, >= 2.1.8)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
airbrussh (1.3.1)
airbrussh (1.3.3)
sshkit (>= 1.6.1, != 1.7.0)
arel (9.0.0)
ast (2.4.0)
autoprefixer-rails (9.6.1)
autoprefixer-rails (9.6.1.1)
execjs
bcrypt (3.1.12)
bcrypt_pbkdf (1.0.0)
bindex (0.5.0)
bcrypt (3.1.13)
bcrypt_pbkdf (1.0.1)
bindex (0.8.1)
bootstrap (4.3.1)
autoprefixer-rails (>= 9.1.0)
popper_js (>= 1.14.3, < 2)
sassc-rails (>= 2.0.0)
builder (3.2.3)
capistrano (3.11.0)
capistrano (3.11.1)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-bundler (1.5.0)
capistrano-bundler (1.6.0)
capistrano (~> 3.1)
capistrano-passenger (0.2.0)
capistrano (~> 3.0)
@ -80,30 +93,30 @@ GEM
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (>= 2.0, < 4.0)
childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
childprocess (1.0.1)
rake (< 13.0)
coderay (1.1.2)
colorator (1.1.0)
commonmarker (0.18.2)
commonmarker (0.20.1)
ruby-enum (~> 0.5)
concurrent-ruby (1.1.5)
connection_pool (2.2.2)
crass (1.0.4)
database_cleaner (1.7.0)
devise (4.6.2)
devise (4.7.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 6.0)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
devise-i18n (1.8.0)
devise-i18n (1.8.1)
devise (>= 4.6)
devise_invitable (2.0.1)
actionmailer (>= 5.0)
devise (>= 4.6)
dotenv (2.7.2)
dotenv-rails (2.7.2)
dotenv (= 2.7.2)
dotenv (2.7.5)
dotenv-rails (2.7.5)
dotenv (= 2.7.5)
railties (>= 3.2, < 6.1)
ed25519 (1.2.4)
em-websocket (0.5.1)
@ -114,9 +127,9 @@ GEM
simpleidn
erubi (1.8.0)
eventmachine (1.2.7)
exception_notification (4.3.0)
actionmailer (>= 4.0, < 6)
activesupport (>= 4.0, < 6)
exception_notification (4.4.0)
actionmailer (>= 4.0, < 7)
activesupport (>= 4.0, < 7)
execjs (2.7.0)
factory_bot (5.0.2)
activesupport (>= 4.2.0)
@ -124,8 +137,8 @@ GEM
factory_bot (~> 5.0.2)
railties (>= 4.2.0)
ffi (1.11.1)
font-awesome-rails (4.7.0.4)
railties (>= 3.2, < 6.0)
font-awesome-rails (4.7.0.5)
railties (>= 3.2, < 6.1)
forwardable-extended (2.6.0)
friendly_id (5.2.5)
activerecord (>= 4.0.0)
@ -136,7 +149,7 @@ GEM
tilt
haml-lint (0.999.999)
haml_lint
haml_lint (0.32.0)
haml_lint (0.33.0)
haml (>= 4.0, < 5.2)
rainbow
rake (>= 10, < 13)
@ -153,37 +166,40 @@ GEM
railties (>= 4.0.1)
hiredis (0.6.3)
http_parser.rb (0.6.0)
i18n (0.9.5)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
image_processing (1.9.1)
mini_magick (>= 4.9.3, < 5)
image_processing (1.9.3)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.13, < 3)
jaro_winkler (1.5.3)
jbuilder (2.8.0)
jbuilder (2.9.1)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
jekyll (3.8.5)
jekyll (4.0.0)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 0.7)
jekyll-sass-converter (~> 1.0)
i18n (>= 0.9.5, < 2)
jekyll-sass-converter (~> 2.0)
jekyll-watch (~> 2.0)
kramdown (~> 1.14)
kramdown (~> 2.1)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (~> 0.3.3)
pathutil (~> 0.9)
rouge (>= 1.7, < 4)
rouge (~> 3.0)
safe_yaml (~> 1.0)
jekyll-sass-converter (1.5.2)
sass (~> 3.4)
terminal-table (~> 1.8)
jekyll-sass-converter (2.0.0)
sassc (> 2.0.1, < 3.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
jquery-rails (4.3.3)
jquery-rails (4.3.5)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
kramdown (1.17.0)
kramdown (2.1.0)
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.7.0)
@ -203,19 +219,18 @@ GEM
mercenary (0.3.6)
method_source (0.9.2)
mimemagic (0.3.3)
mini_magick (4.9.4)
mini_mime (1.0.1)
mini_magick (4.9.5)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.11.3)
mobility (0.8.7)
i18n (>= 0.6.10, < 2)
request_store (~> 1.0)
multi_json (1.13.1)
net-scp (2.0.0)
net-ssh (>= 2.6.5, < 6.0.0)
net-ssh (5.2.0)
netaddr (2.0.3)
nio4r (2.3.1)
nio4r (2.5.1)
nokogiri (1.10.4)
mini_portile2 (~> 2.4.0)
orm_adapter (0.5.0)
@ -228,44 +243,46 @@ GEM
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
public_suffix (3.0.3)
public_suffix (3.1.1)
puma (3.12.1)
pundit (2.0.1)
pundit (2.1.0)
activesupport (>= 3.0.0)
rack (2.0.6)
rack-protection (2.0.5)
rack (2.0.7)
rack-protection (2.0.7)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.3)
actioncable (= 5.2.3)
actionmailer (= 5.2.3)
actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
activemodel (= 5.2.3)
activerecord (= 5.2.3)
activestorage (= 5.2.3)
activesupport (= 5.2.3)
rails (6.0.0)
actioncable (= 6.0.0)
actionmailbox (= 6.0.0)
actionmailer (= 6.0.0)
actionpack (= 6.0.0)
actiontext (= 6.0.0)
actionview (= 6.0.0)
activejob (= 6.0.0)
activemodel (= 6.0.0)
activerecord (= 6.0.0)
activestorage (= 6.0.0)
activesupport (= 6.0.0)
bundler (>= 1.3.0)
railties (= 5.2.3)
railties (= 6.0.0)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
rails-html-sanitizer (1.2.0)
loofah (~> 2.2, >= 2.2.2)
rails-i18n (5.1.3)
rails-i18n (6.0.0)
i18n (>= 0.7, < 2)
railties (>= 5.0, < 6)
railties (>= 6.0.0, < 7)
rails_warden (0.6.0)
warden (>= 1.2.0)
railties (5.2.3)
actionpack (= 5.2.3)
activesupport (= 5.2.3)
railties (6.0.0)
actionpack (= 6.0.0)
activesupport (= 6.0.0)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
thor (>= 0.20.3, < 2.0)
rainbow (3.0.0)
rake (12.3.3)
rb-fsevent (0.10.3)
@ -274,12 +291,12 @@ GEM
rbnacl (4.0.2)
ffi
redis (4.1.2)
redis-actionpack (5.0.2)
actionpack (>= 4.0, < 6)
redis-actionpack (5.1.0)
actionpack (>= 4.0, < 7)
redis-rack (>= 1, < 3)
redis-store (>= 1.1.0, < 2)
redis-activesupport (5.0.7)
activesupport (>= 3, < 6)
redis-activesupport (5.2.0)
activesupport (>= 3, < 7)
redis-store (>= 1.3, < 2)
redis-rack (2.0.5)
rack (>= 1.5, < 3)
@ -295,7 +312,7 @@ GEM
responders (3.0.0)
actionpack (>= 5.0)
railties (>= 5.0)
rouge (3.3.0)
rouge (3.9.0)
rubocop (0.74.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
@ -303,7 +320,7 @@ GEM
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
rubocop-rails (2.2.0)
rubocop-rails (2.3.1)
rack (>= 1.1)
rubocop (>= 0.72.0)
ruby-enum (0.7.2)
@ -312,31 +329,30 @@ GEM
ruby-vips (2.0.14)
ffi (~> 1.9)
ruby_dep (1.5.0)
rubyzip (1.2.2)
rugged (0.28.2)
rubyzip (1.2.3)
rugged (0.28.3.1)
safe_yaml (1.0.5)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass-rails (5.1.0)
railties (>= 5.2.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
sassc (2.0.1)
sassc (2.2.0)
ffi (~> 1.9)
rake
sassc-rails (2.1.2)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
sprockets-rails
tilt
selenium-webdriver (3.141.0)
childprocess (~> 0.5)
selenium-webdriver (3.142.3)
childprocess (>= 0.5, < 2.0)
rubyzip (~> 1.2, >= 1.2.2)
sidekiq (5.2.7)
connection_pool (~> 2.2, >= 2.2.2)
@ -345,8 +361,7 @@ GEM
redis (>= 3.3.5, < 5)
simpleidn (0.1.1)
unf (~> 0.1.4)
spring (2.0.2)
activesupport (>= 4.2)
spring (2.1.0)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
@ -357,8 +372,8 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
sshkit (1.18.2)
sqlite3 (1.4.1)
sshkit (1.20.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
sysexits (1.2.0)
@ -377,23 +392,24 @@ GEM
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
unf_ext (0.0.7.6)
unicode-display_width (1.6.0)
validates_hostname (1.0.8)
activerecord (>= 3.0)
activesupport (>= 3.0)
warden (1.2.8)
rack (>= 2.0.6)
web-console (3.7.0)
actionview (>= 5.0)
activemodel (>= 5.0)
web-console (4.0.1)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 5.0)
websocket-driver (0.7.0)
railties (>= 6.0.0)
websocket-driver (0.7.1)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
websocket-extensions (0.1.4)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.1.9)
PLATFORMS
ruby
@ -434,7 +450,7 @@ DEPENDENCIES
pry
puma (~> 3.7)
pundit
rails (~> 5.2)
rails (~> 6)
rails-i18n
rails_warden
rbnacl (< 5.0)
@ -448,7 +464,7 @@ DEPENDENCIES
sidekiq
spring
spring-watcher-listen (~> 2.0.0)
sqlite3 (~> 1.3.6)
sqlite3
terminal-table
turbolinks (~> 5)
uglifier (>= 1.3.0)

View file

@ -68,15 +68,14 @@ class MetadataImage < MetadataTemplate
end
# Almacena el archivo en el sitio y lo devuelve
# XXX: ActiveStorage devuelve un Array al guardar
#
# @return ActiveStorage::Attachment
def static_file
if uploaded?
blob = ActiveStorage::Blob.find_by(key: key_from_path)
@static_file ||= site.static_files.find_by(blob_id: blob.id)
else
@static_file ||= site.static_files.attach(value['path']).first
elsif site.static_files.attach(value['path'])
@static_file ||= site.static_files.last
end
end

View file

@ -23,7 +23,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
# Actualiza el sitio y guarda los cambios en la configuración
def update
I18n.with_locale(usuarie.try(:lang) || I18n.default_locale) do
site.update_attributes(params) &&
site.update(params) &&
site.config.write &&
commit_config(action: :update)
end

View file

@ -1,6 +1,7 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'fileutils'
include FileUtils
# path to your application root.
APP_ROOT = File.expand_path('..', __dir__)
@ -9,24 +10,26 @@ 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.
# Add necessary setup steps to this file.
FileUtils.chdir APP_ROOT do
# This script is a way to setup or update your development environment
# automatically. This script is idempotent, so that you can run it at
# anytime and get an expectable outcome. Add necessary setup steps to
# this file.
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
# Install JavaScript dependencies if using Yarn
# Install JavaScript dependencies
# system('bin/yarn')
# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
# cp 'config/database.yml.sample', 'config/database.yml'
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
# end
puts "\n== Preparing database =="
system! 'bin/rails db:setup'
system! 'bin/rails db:prepare'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'

View file

@ -7,13 +7,15 @@ require 'rails'
require 'active_model/railtie'
require 'active_job/railtie'
require 'active_record/railtie'
require 'active_storage/engine'
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 'active_storage/engine'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
@ -24,15 +26,15 @@ module Sutty
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails
# version.
config.load_defaults 5.1
config.load_defaults 6.0
# Settings in config/environments/* take precedence over those
# specified here. Application configuration should go into files in
# specified here. Application configuration can go into files in
# config/initializers -- all .rb files in that directory are
# automatically loaded.
# automatically loaded after loading the framework and any gems in
# your application.
config.action_dispatch
.rescue_responses['Pundit::NotAuthorizedError'] = :forbidden
config.active_record.sqlite3.represent_boolean_as_integer = true
config.active_storage.variant_processor = :vips
end

View file

@ -17,12 +17,13 @@ Rails.application.configure do
config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :redis_cache_store
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
'Cache-Control' => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
@ -30,6 +31,10 @@ Rails.application.configure do
config.cache_store = :null_store
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
@ -41,20 +46,22 @@ Rails.application.configure do
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets. This
# option may cause significant delays in view rendering with a large
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Suppress logger output for asset requests.
config.assets.quiet = true
# Raises error for missing translations
# Raises error for missing translations.
# 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.
# 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.action_mailer.perform_caching = false
@ -62,6 +69,4 @@ Rails.application.configure do
config.action_mailer.perform_deliveries = true
config.action_mailer.default_url_options = { host: 'localhost',
port: 3000 }
config.active_storage.service = :local
end

View file

@ -17,26 +17,22 @@ Rails.application.configure do
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Attempt to read encrypted secrets from `config/secrets.yml.enc`.
# Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
# `config/secrets.yml.key`.
config.read_encrypted_secrets = true
# 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
# decrypt credentials (and other encrypted files).
config.require_master_key = true
# Disable serving static files from the `/public` folder by default
# since Apache or NGINX already handles this.
config.public_file_server
.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Compress CSS using a preprocessor.
config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# `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'
@ -44,6 +40,10 @@ Rails.application.configure do
# Specifies the header that your server uses for sending files.
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
# Store uploaded files on the local file system (see
# config/storage.yml for options).
config.active_storage.service = :local
# Force all access to the app over SSL, use Strict-Transport-Security,
# and use secure cookies.
config.force_ssl = true
@ -62,6 +62,7 @@ Rails.application.configure do
# environment)
config.active_job.queue_adapter = :sidekiq
config.active_job.queue_name_prefix = "sutty_#{Rails.env}"
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
@ -83,7 +84,7 @@ Rails.application.configure do
# Use a different logger for distributed setups.
require 'syslog/logger'
config.logger = ActiveSupport::TaggedLogging
.new(Syslog::Logger.new('app-name'))
.new(Syslog::Logger.new('sutty'))
if ENV['RAILS_LOG_TO_STDOUT'].present?
logger = ActiveSupport::Logger.new(STDOUT)
@ -94,6 +95,30 @@ Rails.application.configure do
# Do not dump schema after migrations.
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
# Recibir por mail notificaciones de excepciones
config.action_mailer.default_url_options = { host: ENV['SUTTY'] }
config.action_mailer.perform_deliveries = true
@ -107,5 +132,4 @@ Rails.application.configure do
sender_address: ENV['DEFAULT_FROM'],
exception_recipients: ENV['EXCEPTION_TO']
}
config.active_storage.service = :local
end

View file

@ -1,13 +1,15 @@
# frozen_string_literal: true
#
# 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
# Settings specified here will take precedence over those in
# config/application.rb.
# 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!
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole
@ -20,17 +22,22 @@ Rails.application.configure do
# performance.
config.public_file_server.enabled = true
config.public_file_server.headers = { 'Cache-Control' => "public,
max-age=#{1.hour.seconds.to_i}" }
max-age=#{1.hour.to_i}" }
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.cache_store = :null_store
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
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.
@ -43,7 +50,6 @@ Rails.application.configure do
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raises error for missing translations
# Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true
config.active_storage.service = :test
end

View file

@ -0,0 +1,36 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Define an application-wide content security policy
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
# Rails.application.config.content_security_policy do |policy|
# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https
# # If you are using webpack-dev-server then specify
# # webpack-dev-server host
# policy.connect_src :self, :https, "http://localhost:3035",
# "ws://localhost:3035" if Rails.env.development?
# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# end
# If you are using UJS then enable automatic nonce generation
# Rails.application.config.content_security_policy_nonce_generator =
# -> request { SecureRandom.base64(16) }
# Set the nonce only to specific directives
# Rails.application.config.content_security_policy_nonce_directives =
# %w(script-src)
# Report CSP violations to a specified URI
# For further information see the following documentation:
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
# Rails.application.config.content_security_policy_report_only = true

View file

@ -2,14 +2,16 @@
# 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.
# 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') { 1 }
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 }
@ -17,8 +19,8 @@ port ENV.fetch('PORT') { 3000 }
#
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
# 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).
@ -28,31 +30,10 @@ 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.
# process behavior so workers use less memory.
#
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

View file

@ -1,5 +1,6 @@
# frozen_string_literal: true
# Ignorar los sitios Jekyll
# https://github.com/thoughtbot/ember-cli-rails/issues/479#issuecomment-241302961
Spring::Watcher::Listen.class_eval do
def base_directories
@ -8,9 +9,9 @@ Spring::Watcher::Listen.class_eval do
end
end
%w[
.ruby-version
.rbenv-vars
tmp/restart.txt
tmp/caching-dev.txt
].each { |path| Spring.watch(path) }
Spring.watch(
'.ruby-version',
'.rbenv-vars',
'tmp/restart.txt',
'tmp/caching-dev.txt'
)

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
# This migration comes from active_storage (originally 20180723000244)
class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0]
def up
return if foreign_key_exists?(:active_storage_attachments, column: :blob_id)
return unless table_exists?(:active_storage_blobs)
add_foreign_key :active_storage_attachments,
:active_storage_blobs, column: :blob_id
end
end

View file

@ -4,15 +4,15 @@
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
# This file is the source Rails uses to define your schema when running `rails
# db:schema:load`. When creating a new database, `rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20_190_820_225_238) do
ActiveRecord::Schema.define(version: 20_190_829_163_530) do
create_table 'active_storage_attachments', force: :cascade do |t|
t.string 'name', null: false
t.string 'record_type', null: false
@ -161,4 +161,6 @@ ActiveRecord::Schema.define(version: 20_190_820_225_238) do
t.index ['reset_password_token'], name: 'index_usuaries_on_reset_password_token', unique: true
t.index ['unlock_token'], name: 'index_usuaries_on_unlock_token', unique: true
end
add_foreign_key 'active_storage_attachments', 'active_storage_blobs', column: 'blob_id'
end