Sha256: 13e769d64385dbeda58b1cf2f6b8240adb331ac931dfc7ecbd33e36ed683558a

Contents?: true

Size: 1.35 KB

Versions: 4

Compression:

Stored size: 1.35 KB

Contents

module Evrone
  module CI
    module Worker
      class Runner
        class Local

          include Worker::Helper::Logger
          include Worker::Helper::Config
          include Common::Helper::Shell

          attr_reader :build, :path, :build_script

          def initialize(build, path)
            @build        = build
            @path         = path
            @build_script = path.tmp_dir.join(".build.sh").expand_path
          end

          def perform
            make_build_script
            run_build_script
          end

          private

            def run_build_script
              bash file: build_script, chdir: path.work_dir, &method(:add_output)
            end

            def make_build_script
              content = build.travis.to_queue.to_shell_script script_replaces do |env|
                prepare_env env
              end
              write_file build_script, content, 0755
              add_output_command build_script
            end

            def script_replaces
              { "SHARED_PATH" => path.shared_dir }
            end

            def prepare_env(env)
              env['init'].unshift "echo 'copy repo from #{path.repo_dir} to #{path.work_dir}'"
              env['init'].unshift build.csm.make_export_command path.repo_dir, path.work_dir
              env
            end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
evrone-ci-worker-0.2.0.pre4 lib/evrone/ci/worker/runner/local.rb
evrone-ci-worker-0.2.0.pre3 lib/evrone/ci/worker/runner/local.rb
evrone-ci-worker-0.2.0.pre1 lib/evrone/ci/worker/runner/local.rb
evrone-ci-worker-0.2.0.pre0 lib/evrone/ci/worker/runner/local.rb