Sha256: db4ea8d178ffd5b32cd4e535563fa4e2b5073ff14bf58264a472c69aaf9a97ec
Contents?: true
Size: 1.12 KB
Versions: 22
Compression:
Stored size: 1.12 KB
Contents
require 'evrone/ci/common' module Evrone module CI module Worker LocalScript = Struct.new(:app) do include Common::Helper::Shell def call(env) script = env.tmp_dir.join("build.sh") write_file script, content(env), 0700 code = bash file: script, &env.job.method(:add_to_output) if code == 0 app.call env else state = read_state(env) case state when "script" code else code * -1 end end end private def content(env) buf = ["set -e"] buf << "echo before_script > #{env.tmp_dir}/state" buf << env.job.message.before_script buf << "echo script > #{env.tmp_dir}/state" buf << env.job.message.script buf.join("\n") end def read_state(env) state_file = env.tmp_dir.join("state") if File.readable? state_file File.read(state_file).strip end end end end end end
Version data entries
22 entries across 22 versions & 1 rubygems