From e258e6e2d9928a8d721bdbfc991f5c390bf46327 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 27 Dec 2022 18:41:36 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20asegurarse=20que=20las=20gemas=20est?= =?UTF-8?q?=C3=A1n=20instaladas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/site.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/models/site.rb b/app/models/site.rb index 5dee0b85..dfc4f034 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -56,8 +56,8 @@ class Site < ApplicationRecord before_destroy :remove_directories! # Carga el sitio Jekyll una vez que se inicializa el modelo o después # de crearlo - after_initialize :load_jekyll - after_create :load_jekyll + after_initialize :install_gems, :load_jekyll + after_create :install_gems, :load_jekyll # Cambiar el nombre del directorio before_update :update_name! before_save :add_private_key_if_missing! @@ -515,4 +515,11 @@ class Site < ApplicationRecord def run_in_path(&block) Dir.chdir path, &block end + + def install_gems + return unless persisted? + return if Rails.root.join('_storage', 'gems', name).directory? + + deploys.find_by_type('DeployLocal').send(:bundle) + end end