Sha256: a02bbd34cbc7a256575cbd7ae59e3752358a613f14f7ff0e16d63de0fbb62c68

Contents?: true

Size: 1021 Bytes

Versions: 4

Compression:

Stored size: 1021 Bytes

Contents

require 'evrone/ci/common'

module Evrone
  module CI
    module Worker

      LocalCreateDirs = Struct.new(:app) do

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

        def call(env)
          tmp_dir!  env
          work_dir! env
          repo_dir! env

          app.call env
        end

        private

          def tmp_dir!(env)
            env.tmp_dir = env.path_prefix.join(config.tmp_dir_name)
                                         .join(env.job.message.name)
            recreate env.tmp_dir
          end

          def work_dir!(env)
            env.work_dir = env.path_prefix.join(config.work_dir_name)
                                          .join(env.job.message.name)

            recreate env.work_dir
          end

          def repo_dir!(env)
            env.repo_dir = env.path_prefix.join(config.repo_dir_name)
                                          .join(env.job.message.name)

            mkdir env.repo_dir
          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/middlewares/local_create_dirs.rb
evrone-ci-worker-0.2.0.pre3 lib/evrone/ci/worker/middlewares/local_create_dirs.rb
evrone-ci-worker-0.2.0.pre1 lib/evrone/ci/worker/middlewares/local_create_dirs.rb
evrone-ci-worker-0.2.0.pre0 lib/evrone/ci/worker/middlewares/local_create_dirs.rb