require 'evrone/ci/common' module Evrone module CI class Router module Middleware FetchSource = Struct.new(:app) do include Helper::Logger def call(env) env.scm = create_scm(env) if env.scm.fetch == 0 app.call env else -1 end end private def create_scm(env) SCM::Git.new(env.build.message.src, env.build.message.sha, env.repo_dir, deploy_key: env.build.message.deploy_key, &env.build.method(:add_to_output)) end end end end end end