mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 08:16:21 +00:00
chore: rubocop
This commit is contained in:
parent
7a03269aa3
commit
8fba98f9fd
5 changed files with 23 additions and 30 deletions
|
@ -55,9 +55,7 @@ class BacktraceJob < ApplicationJob
|
|||
x['backtrace']
|
||||
end.flatten.map do |x|
|
||||
x['file'].split('@').last
|
||||
end.uniq.select do |x|
|
||||
%r{\Ahttps://} =~ x
|
||||
end
|
||||
end.uniq.grep(%r{\Ahttps://})
|
||||
end
|
||||
|
||||
# Descarga y devuelve los datos de un archivo
|
||||
|
|
|
@ -27,12 +27,11 @@ class DeployJob < ApplicationJob
|
|||
if site.building?
|
||||
notify = false
|
||||
|
||||
if 10.minutes.ago >= time
|
||||
raise DeployTimedOutException,
|
||||
"#{site.name} la tarea estuvo más de 10 minutos esperando, volviendo al estado original"
|
||||
else
|
||||
raise DeployAlreadyRunningException
|
||||
end
|
||||
raise DeployAlreadyRunningException unless 10.minutes.ago >= time
|
||||
|
||||
raise DeployTimedOutException,
|
||||
"#{site.name} la tarea estuvo más de 10 minutos esperando, volviendo al estado original"
|
||||
|
||||
end
|
||||
|
||||
@deployed = {}
|
||||
|
@ -50,9 +49,7 @@ class DeployJob < ApplicationJob
|
|||
nil
|
||||
end.compact
|
||||
|
||||
if d == site.deployment_list.last && !status
|
||||
raise DeployException, 'Falló la compilación'
|
||||
end
|
||||
raise DeployException, 'Falló la compilación' if d == site.deployment_list.last && !status
|
||||
rescue StandardError => e
|
||||
status = false
|
||||
seconds ||= 0
|
||||
|
@ -73,7 +70,7 @@ class DeployJob < ApplicationJob
|
|||
|
||||
return unless output
|
||||
|
||||
puts (Terminal::Table.new do |t|
|
||||
puts(Terminal::Table.new do |t|
|
||||
t << (%w[type] + @deployed.values.first.keys)
|
||||
t.add_separator
|
||||
@deployed.each do |type, row|
|
||||
|
|
|
@ -292,11 +292,11 @@ class Site < ApplicationRecord
|
|||
# layouts. Si pasamos un layout que no existe, obtenemos un
|
||||
# NoMethodError
|
||||
@layouts_struct ||= Struct.new(*layout_keys, keyword_init: true)
|
||||
@layouts ||= @layouts_struct.new(**data['layouts'].map do |name, metadata|
|
||||
@layouts ||= @layouts_struct.new(**data['layouts'].to_h 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)]
|
||||
end.to_h)
|
||||
end)
|
||||
end
|
||||
|
||||
# TODO: Si la estructura de datos no existe, vamos a producir una
|
||||
|
@ -389,7 +389,7 @@ class Site < ApplicationRecord
|
|||
end
|
||||
|
||||
def reload
|
||||
super.tap do |s|
|
||||
super.tap do |_s|
|
||||
reload_jekyll!
|
||||
end
|
||||
self
|
||||
|
@ -479,7 +479,7 @@ class Site < ApplicationRecord
|
|||
def clone_skel!
|
||||
return if jekyll?
|
||||
|
||||
Rugged::Repository.clone_at(ENV['SKEL_SUTTY'], path, checkout_branch: design.gem)
|
||||
Rugged::Repository.clone_at(ENV.fetch('SKEL_SUTTY', nil), path, checkout_branch: design.gem)
|
||||
|
||||
# Necesita un bloque
|
||||
repository.rugged.remotes.rename('origin', 'upstream') {}
|
||||
|
@ -579,11 +579,11 @@ class Site < ApplicationRecord
|
|||
deploy_local = deploys.find_by_type('DeployLocal')
|
||||
deploy_local.git_lfs
|
||||
|
||||
if !gems_installed? || gemfile_updated? || gemfile_lock_updated?
|
||||
deploy_local.bundle
|
||||
touch
|
||||
FileUtils.touch(gemfile_path)
|
||||
end
|
||||
return unless !gems_installed? || gemfile_updated? || gemfile_lock_updated?
|
||||
|
||||
deploy_local.bundle
|
||||
touch
|
||||
FileUtils.touch(gemfile_path)
|
||||
end
|
||||
|
||||
def gem_path
|
||||
|
|
|
@ -76,10 +76,10 @@ class Usuarie < ApplicationRecord
|
|||
# Si le usuarie (re)confirma su cuenta con una invitación pendiente,
|
||||
# considerarla aceptada también.
|
||||
def accept_invitation_after_confirmation!
|
||||
if confirmed?
|
||||
self.invitation_token = nil
|
||||
self.invitation_accepted_at ||= Time.now.utc
|
||||
end
|
||||
return unless confirmed?
|
||||
|
||||
self.invitation_token = nil
|
||||
self.invitation_accepted_at ||= Time.now.utc
|
||||
end
|
||||
|
||||
# Muestra un error si el idioma no está disponible al cambiar el
|
||||
|
@ -87,7 +87,7 @@ class Usuarie < ApplicationRecord
|
|||
#
|
||||
# @return [nil]
|
||||
def locale_available!
|
||||
return if I18n.locale_available? self.lang
|
||||
return if I18n.locale_available? lang
|
||||
|
||||
errors.add(:lang, I18n.t('activerecord.errors.models.usuarie.attributes.lang.not_available'))
|
||||
nil
|
||||
|
|
|
@ -222,9 +222,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
|
|||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def with_all_locales(&block)
|
||||
def with_all_locales
|
||||
site.locales.map do |locale|
|
||||
next unless I18n.available_locales.include? locale
|
||||
|
||||
|
|
Loading…
Reference in a new issue