Sha256: 18d546d91a2b5860a443ac6224e274b7698fb73b0c3738d829874a54935659f4

Contents?: true

Size: 1.37 KB

Versions: 3

Compression:

Stored size: 1.37 KB

Contents

require 'ostruct'

def create(name, options = {})
  case name
  when :message
    Vx::Message::PerformBuild.test_message

  when :task
    msg = create(:message)
    Vx::Builder::Task.new(
      job_id:                1,
      build_id:              12,
      name:                  'name',
      src:                   msg.src,
      sha:                   msg.sha,
      deploy_key:            msg.deploy_key,
      branch:                msg.branch,
      cache_url_prefix:      "http://example.com",
      artifacts_url_prefix:  "http://example.com",
      pull_request_id:       options[:pull_request_id],
      deploy:                options[:deploy]
    )

  when :source
    name = options[:name] || "travis.yml"
    Vx::Builder::BuildConfiguration.from_yaml(fixture(name))

  when :env
    OpenStruct.new(
      init:           [],
      before_install: [],
      install:        [],
      announce:       [],
      before_script:  [],
      script:         [],
      after_script:   [],
      after_script_init: [],
      source:         options[:source] || create(:source),
      after_success:  [],
      task:           options[:task] || create(:task),
      cache_key:      [],
      cached_directories: [],
      before_deploy:       [],
      deploy:              [],
    )

  when :command_from_env
    env = options[:env]
    a = ["set -e"]
    a += env.init
    a.join("\n")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vx-builder-0.2.2 spec/support/create.rb
vx-builder-0.2.1 spec/support/create.rb
vx-builder-0.2.0 spec/support/create.rb