Sha256: 98ab419a3eefdae4704c62defdda39d6dea5a4a9ee9f0ec11fc37b41f37ae242

Contents?: true

Size: 1 KB

Versions: 6

Compression:

Stored size: 1 KB

Contents

module Janky
  module Builder
    class Runner
      def initialize(base_url, build, adapter)
        @base_url = base_url
        @build    = build
        @adapter  = adapter
      end

      def run
        context_push
        @adapter.run(json_params, create_url)
      end

      def output
        context_push
        @adapter.output(output_url)
      end

      def json_params
        Yajl.dump(:parameter => [
          { :name => "JANKY_SHA1", :value => @build.sha1 },
          { :name => "JANKY_ID",   :value => @build.id }
        ])
      end

      def output_url
        URI(@build.url + "consoleText")
      end

      def create_url
        URI("#{@base_url}job/#{@build.repo_job_name}/build")
      end

      def context_push
        Exception.push(
          :base_url   => @base_url.inspect,
          :build      => @build.inspect,
          :adapter    => @adapter.inspect,
          :params     => json_params.inspect,
          :create_url => create_url.inspect
        )
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
janky-0.9.13 lib/janky/builder/runner.rb
janky-0.9.12 lib/janky/builder/runner.rb
janky-0.9.11 lib/janky/builder/runner.rb
janky-0.9.10 lib/janky/builder/runner.rb
janky-0.9.9 lib/janky/builder/runner.rb
janky-0.9.0 lib/janky/builder/runner.rb