Sha256: d77d2b87f7e73c21b42d59e6aa579cfac5336ec7c8ce7c4d67d83a8acb2dfe11

Contents?: true

Size: 1.76 KB

Versions: 4

Compression:

Stored size: 1.76 KB

Contents

require 'ostruct'

def create(name, options = {})
  case name

  when :task
    Vx::Builder::Task.new(
      job_id:           1,
      build_id:         12,
      name:             'name',
      src:              "git@github.com:dima-exe/ci-worker-test-repo.git",
      sha:              "b665f90239563c030f1b280a434b3d84daeda1bd",
      deploy_key:       fixture("insecure_private_key"),
      branch:           "master",
      cache_url_prefix: "http://example.com",
      pull_request_id:  options[:pull_request_id]
    )

  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")

  when :build_configuration_with_matrix_values
    attributes = {
      "env"            => %w{ FOO=1 BAR=2 },
      "rvm"            => %w{ 1.8.7 1.9.3 2.0.0 },
      "scala"          => %w{ 2.9.2 2.10.1 },
      "before_script"  => "echo before_script",
      "before_install" => "echo before_install",
      "script"         => "echo script",
    }.merge(options)
    Vx::Builder::BuildConfiguration.new attributes

  when :matrix_builder
    Vx::Builder::MatrixBuilder.new create(:build_configuration_with_matrix_values, options)
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vx-builder-0.3.9 spec/support/create.rb
vx-builder-0.3.8 spec/support/create.rb
vx-builder-0.3.7 spec/support/create.rb
vx-builder-0.3.6 spec/support/create.rb