From 7ec98dadefec8b956fd7c8a70f0f0428bb7f8e7d Mon Sep 17 00:00:00 2001 From: f Date: Sat, 13 May 2023 17:42:37 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20en=20algunos=20casos=20el=20directorio?= =?UTF-8?q?=20exist=C3=ADa=20aunque=20vac=C3=ADo=20#13428?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/site.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/models/site.rb b/app/models/site.rb index cd2385c5..04505f49 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -561,15 +561,25 @@ class Site < ApplicationRecord deploy_local = deploys.find_by_type('DeployLocal') deploy_local.git_lfs - if !gem_dir? || gemfile_updated? || gemfile_lock_updated? + if !gems_installed? || gemfile_updated? || gemfile_lock_updated? deploy_local.bundle touch end end + def gem_path + @gem_path ||= + begin + ruby_version = Gem::Version.new(RUBY_VERSION) + ruby_version.canonical_segments[2] = 0 + + bundle_path.join('ruby', ruby_version.canonical_segments.join('.')) + end + end + # Detecta si el repositorio de gemas existe - def gem_dir? - Rails.root.join('_storage', 'gems', name).directory? + def gems_installed? + gem_path.directory? && !gem_path.empty? end # Detecta si el Gemfile fue modificado