Sha256: 21ac2adf2be19d3559a088062a04814f6ac8f05c5ca23244ac4fc33cd3dd19c1

Contents?: true

Size: 742 Bytes

Versions: 1

Compression:

Stored size: 742 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
evrone-ci-router-0.2.0.pre0 lib/evrone/ci/router/middleware/fetch_source.rb