require 'open3' module Smartcloud module Grids class Buildpacker < Smartcloud::Base def initialize end def pack logger.formatter = proc do |severity, datetime, progname, message| "\t\t\t--------> #{severity}: #{message}\n" end pack_rails if File.exist? "bin/rails" logger.info "Could not continue ... Launch Failed." logger.formatter = nil end def pack_rails # Remove server.pid if it exists FileUtils.rm("tmp/pids/server.pid") if File.exist? "tmp/pids/server.pid" # Perform bundle install logger.info "Performing bundle install ..." logger.formatter = proc do |severity, datetime, progname, message| "\t\t\t\t#{message}" end Open3.popen2("bundle", "install", "--deployment", "--clean") do |stdin, stdout_andstderr, wait_thr| stdout_andstderr.each do |line| logger.info "#{line}" end exit_status = wait_thr.value end if exit_status.success? logger.error "Could not complete bundle install." end # if system("bundle install --deployment --clean") # logger.info "Installing Javascript Dependencies & Pre-compiling Assets ..." # if system("bundle exec rails assets:precompile", out: File::NULL) # logger.debug "Starting Server ..." # if system("god -c Godfile -D") # logger.info "Launched Application ... Success." # end # # exit 0 # end # end end end end end