Sha256: 3fa922ad96aca23b189cd08dec0793a72d8f2c34b9b7366810443b0e21ca8784

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

require 'yaml'

def create(who, *args)

  options = args.last.is_a?(Hash) ? args.pop : {}

  case who

  when :local_repo
    Evrone::CI::Router.root.join("fixtures/repo").to_s

  when :travis
    klass = Evrone::CI::Router::Travis
    travis = nil
    if options[:yaml]
      travis = klass.from_yaml options[:yaml]
    elsif options[:attributes]
      travis = klass.from_attributes options[:attributes]
    else
      klass.from_yaml fixture("travis.yml")
    end

  when :message
    name = args.shift

    klass = Evrone::CI::Message.const_get name
    klass.test_message options

  when :build
    message = options[:message] || create(:message, 'PerformBuild', options)
    Evrone::CI::Router::Build.new message

  when :git
    build = args.shift
    path  = args.shift
    Evrone::CI::SCM::Git.new build.src, build.sha, path, deploy_key: build.deploy_key, &build.method(:add_to_output)

  when :commit_info
    OpenStruct.new(
      sha:     "sha",
      author:  "author",
      email:   "email",
      message: "message"
    )
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
evrone-ci-router-0.2.0.pre4 spec/support/create.rb
evrone-ci-router-0.2.0.pre3 spec/support/create.rb
evrone-ci-router-0.2.0.pre1 spec/support/create.rb
evrone-ci-router-0.2.0.pre0 spec/support/create.rb