Sha256: d9b654c28c2bf89885783d820c8274d4a6c5fb8001752676371e4aeca9b419b8

Contents?: true

Size: 803 Bytes

Versions: 14

Compression:

Stored size: 803 Bytes

Contents

require 'tempfile'
require 'fileutils'
require 'logger'

module Vx
  module ContainerConnector

    class Local

      include Instrument

      autoload :Spawner, File.expand_path("../local/spawner", __FILE__)

      attr_reader :work_dir

      def initialize(options = {})
        @work_dir = options[:work_dir] || default_work_dir
        @work_dir = File.expand_path(@work_dir)
      end

      def start(&block)
        instrument( "start_container", container_type: 'local', container: { work_dir: work_dir }) do
          FileUtils.rm_rf(work_dir)
          FileUtils.mkdir_p(work_dir)
        end

        spawner = Spawner.new(work_dir)

        yield spawner
      end

      private

        def default_work_dir
          "#{Dir.tmpdir}/.vx_local_connector"
        end

    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
vx-container_connector-0.5.7 lib/vx/container_connector/local.rb
vx-container_connector-0.5.6 lib/vx/container_connector/local.rb
vx-container_connector-0.5.5 lib/vx/container_connector/local.rb
vx-container_connector-0.5.4 lib/vx/container_connector/local.rb
vx-container_connector-0.5.3 lib/vx/container_connector/local.rb
vx-container_connector-0.5.2 lib/vx/container_connector/local.rb
vx-container_connector-0.5.1 lib/vx/container_connector/local.rb
vx-container_connector-0.5.0 lib/vx/container_connector/local.rb
vx-container_connector-0.4.3 lib/vx/container_connector/local.rb
vx-container_connector-0.4.2 lib/vx/container_connector/local.rb
vx-container_connector-0.4.1 lib/vx/container_connector/local.rb
vx-container_connector-0.4.0 lib/vx/container_connector/local.rb
vx-container_connector-0.3.1 lib/vx/container_connector/local.rb
vx-container_connector-0.3.0 lib/vx/container_connector/local.rb