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