# frozen_string_literal: true require 'open3' # Este modelo implementa los distintos tipos de alojamiento que provee # Sutty. # # Los datos se guardan en la tabla `deploys`. Para guardar los # atributos, cada modelo tiene que definir su propio `store # :attributes`. class Deploy < ApplicationRecord belongs_to :site def deploy raise NotImplementedError end def limit raise NotImplementedError end # Corre un comando y devuelve true si terminó correctamente def run(cmd) r = 1 Dir.chdir(site.path) do Open3.popen2(env, cmd, unsetenv_others: true) do |_, _o, t| r = t.value end end r.exited? end end