From 5880c4767639860855224955d61e48c4bf004355 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 6 May 2021 17:54:49 -0300 Subject: [PATCH] rubocop --- .ruby-version | 1 - app/models/metadata_template.rb | 6 +++--- app/models/site.rb | 12 +++++++----- config/environments/production.rb | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) delete mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index bec3a35..0000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -system diff --git a/app/models/metadata_template.rb b/app/models/metadata_template.rb index 5800059..62e6da2 100644 --- a/app/models/metadata_template.rb +++ b/app/models/metadata_template.rb @@ -14,9 +14,9 @@ MetadataTemplate = Struct.new(:site, :document, :name, :label, :type, # Queremos que los artículos nuevos siempre cacheen, si usamos el UUID # siempre vamos a obtener un item nuevo. def cache_key - return layout.value + '/' + name.to_s if post.new? + return "#{layout.value}/#{name}" if post.new? - @cache_key ||= 'post/' + post.uuid.value + '/' + name.to_s + @cache_key ||= "post/#{post.uuid.value}/#{name}" end def cache_version @@ -24,7 +24,7 @@ MetadataTemplate = Struct.new(:site, :document, :name, :label, :type, end def cache_key_with_version - cache_key + '-' + cache_version + "#{cache_key}-#{cache_version}" end # XXX: Deberíamos sanitizar durante la asignación? diff --git a/app/models/site.rb b/app/models/site.rb index 3a69923..7a8b4b4 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -97,7 +97,7 @@ class Site < ApplicationRecord # @param slash Boolean Agregar / al final o no # @return String La URL con o sin / al final def url(slash: true) - 'https://' + hostname + (slash ? '/' : '') + "https://#{hostname}#{slash ? '/' : ''}" end # Obtiene los dominios alternativos @@ -105,7 +105,7 @@ class Site < ApplicationRecord # @return Array def alternative_hostnames deploys.where(type: 'DeployAlternativeDomain').map(&:hostname).map do |h| - h.end_with?('.') ? h[0..-2] : h + '.' + Site.domain + h.end_with?('.') ? h[0..-2] : "#{h}.#{Site.domain}" end end @@ -114,7 +114,7 @@ class Site < ApplicationRecord # @return Array def alternative_urls(slash: true) alternative_hostnames.map do |h| - 'https://' + h + (slash ? '/' : '') + "https://#{h}#{slash ? '/' : ''}" end end @@ -275,7 +275,9 @@ class Site < ApplicationRecord # NoMethodError @layouts_struct ||= Struct.new(*layout_keys, keyword_init: true) @layouts ||= @layouts_struct.new(**data['layouts'].map do |name, metadata| - [name.to_sym, Layout.new(site: self, name: name.to_sym, meta: metadata.delete('meta')&.with_indifferent_access, metadata: metadata.with_indifferent_access)] + [name.to_sym, + Layout.new(site: self, name: name.to_sym, meta: metadata.delete('meta')&.with_indifferent_access, + metadata: metadata.with_indifferent_access)] end.to_h) end @@ -404,7 +406,7 @@ class Site < ApplicationRecord end def self.default - find_by(name: Site.domain + '.') + find_by(name: "#{Site.domain}.") end def reset diff --git a/config/environments/production.rb b/config/environments/production.rb index a51e1a5..c1269fb 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -100,7 +100,7 @@ Rails.application.configure do .new(Syslog::Logger.new('sutty')) if ENV['RAILS_LOG_TO_STDOUT'].present? - logger = ActiveSupport::Logger.new(STDOUT) + logger = ActiveSupport::Logger.new($stdout) logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger) end