From 80ae794f106b67251202c4f8057ee7f834b64ce5 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 16 Sep 2019 13:15:20 -0300 Subject: [PATCH] arreglos de produccion --- app/models/deploy_local.rb | 8 +++++--- app/models/deploy_zip.rb | 3 ++- test/models/deploy_local_test.rb | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/models/deploy_local.rb b/app/models/deploy_local.rb index 86229736..b698c07b 100644 --- a/app/models/deploy_local.rb +++ b/app/models/deploy_local.rb @@ -13,10 +13,8 @@ class DeployLocal < Deploy # # Pasamos variables de entorno mínimas para no filtrar secretos de # Sutty - # - # TODO: Recolectar estadísticas y enviarlas a la base de datos def deploy - yarn && bundle && jekyll_build + mkdir && yarn && bundle && jekyll_build end # Sólo permitimos un deploy local @@ -36,6 +34,10 @@ class DeployLocal < Deploy private + def mkdir + FileUtils.mkdir_p destination + end + # Un entorno que solo tiene lo que necesitamos def env # XXX: This doesn't support Windows paths :B diff --git a/app/models/deploy_zip.rb b/app/models/deploy_zip.rb index b5141529..4671727e 100644 --- a/app/models/deploy_zip.rb +++ b/app/models/deploy_zip.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'zip' + # Genera un ZIP a partir del sitio ya construido # # TODO: Firmar con minisign @@ -13,7 +15,6 @@ class DeployZip < Deploy # y generar un zip accesible públicamente. # # rubocop:disable Metrics/MethodLength - # rubocop:disable Metrics/AbcSize def deploy time_start Dir.chdir(destination) do diff --git a/test/models/deploy_local_test.rb b/test/models/deploy_local_test.rb index b992d8cc..0429f6d3 100644 --- a/test/models/deploy_local_test.rb +++ b/test/models/deploy_local_test.rb @@ -1,11 +1,14 @@ # frozen_string_literal: true +require 'test_helper' + class DeployZipTest < ActiveSupport::TestCase test 'se puede deployear' do deploy_local = create :deploy_local assert deploy_local.deploy assert File.directory?(deploy_local.destination) + assert File.exist?(File.join(deploy_local.destination, 'robots.txt')) assert_equal 3, deploy_local.build_stats.count assert deploy_local.build_stats.map(&:bytes).compact.inject(:+).positive?