From 5799ad9a972461092dd6ef29e2870c772cd41607 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 19 Sep 2019 10:20:27 -0300 Subject: [PATCH] el directorio base es el sitio mismo --- app/models/deploy.rb | 8 ++++++++ app/models/deploy_local.rb | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/models/deploy.rb b/app/models/deploy.rb index 4d0ce45..07be18e 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -35,6 +35,14 @@ class Deploy < ApplicationRecord (@stop - @start).round(3) end + def home_dir + site.path + end + + def gems_dir + Pathname.new(File.join(home_dir, '..', 'gems')).realpath.to_s + end + # Corre un comando y devuelve true si terminó correctamente # rubocop:disable Metrics/MethodLength # rubocop:disable Metrics/AbcSize diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index a75955f..d4f8f44 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -43,7 +43,11 @@ class DeployLocal < Deploy # XXX: This doesn't support Windows paths :B paths = [File.dirname(`which bundle`), '/usr/bin'] - { 'PATH' => paths.join(':'), 'JEKYLL_ENV' => 'production' } + { + 'HOME' => home_dir, + 'PATH' => paths.join(':'), + 'JEKYLL_ENV' => 'production' + } end def yarn_lock @@ -62,7 +66,7 @@ class DeployLocal < Deploy end def bundle - run 'bundle install --path=../gems' + run %(bundle install --path="#{gems_dir}") end def jekyll_build