Sha256: f3dd0e75b9735a8a3cbf5193088f5d2ad4aa3709634e019ab2e55aed7fe27857

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

require 'shellwords'
require 'evrone/ci/common'

module Evrone
  module CI
    class Router
      class Queue

        include Common::Helper::Middlewares

        middlewares do
          use Middleware::Travis::Env
          use Middleware::Travis::Ruby
          use Middleware::Travis::Script
        end

        attr_reader :travis

        def initialize(travis)
          @travis = travis
        end

        def to_before_script
          a = ["set -e"]
          a += env.init
          a += env.before_install
          a += env.install
          a += env.before_script
          a.join("\n")
        end

        def to_script
          a = ["set -e"]
          a << env.script
          a.join("\n")
        end

        private

          def env
            @env ||= run_middlewares(default_env) {|_| _ }
          end

          def default_env
            OpenStruct.new(
              init:            [],
              before_install:  [],
              install:         [],
              before_script:   [],
              script:          [],
              travis:          travis
            )
          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/queue.rb