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