Sha256: 5f56ffe1922d751c5c85806ed3fbfe57722969d74a504169e3a1d892310b8a5c

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

module Vx
  module Builder
    class Task

      attr_reader :name, :src, :sha, :deploy_key, :branch, :pull_request_id,
        :cache_url_prefix, :artifacts_url_prefix, :job_id, :build_id

      def initialize(options = {})
        @name                 = options[:name]
        @src                  = options[:src]
        @sha                  = options[:sha]
        @job_id               = options[:job_id]
        @build_id             = options[:build_id]
        @deploy_key           = options[:deploy_key]
        @branch               = options[:branch]
        @pull_request_id      = options[:pull_request_id]
        @cache_url_prefix     = options[:cache_url_prefix]
        @artifacts_url_prefix = options[:artifacts_url_prefix]
        @deploy               = !!options[:deploy]

        validate!
      end

      def deploy?
        @deploy
      end

      private

        def validate!
          (name && src && sha && deploy_key && branch && job_id && build_id) or
            raise(MissingKeys)
        end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vx-builder-0.2.2 lib/vx/builder/task.rb
vx-builder-0.2.1 lib/vx/builder/task.rb
vx-builder-0.2.0 lib/vx/builder/task.rb