class Dockerspec::Configuration

Saves internal configuration for {Dockerspec}.

Attributes

compose_runner[RW]

The {Dockerspec::Runner::Compose} class used to run Docker Compose.

@return [Class] The {Dockerspec::Runner::Compose} class.

docker_runner[RW]

The {Dockerspec::Runner} class used to run Docker.

@return [Class] The {Dockerspec::Runner::Base} class.

engines[R]

A list of test engines used to run the tests.

@return [Array<Class>] A list of {Dockerspec::Engine::Base} classes.

Public Class Methods

add_engine(engine) click to toggle source

Adds a class to use as engine to run the tests.

@example

Dockerspec.Configuration.add_engine Dockerspec::Engine::Specinfra

@param engine [Class] A {Dockerspec::Engine::Base} subclass.

@return void

@api public

# File lib/dockerspec/configuration.rb, line 65
def add_engine(engine)
  instance.add_engine(engine)
end
compose_runner() click to toggle source

Gets the class used to start Docker Compose.

@return [Class] A {Dockerspec::Runner::Compose::Base} subclass.

@api public

# File lib/dockerspec/configuration.rb, line 130
def compose_runner
  instance.compose_runner
end
compose_runner=(runner) click to toggle source

Sets the class used to start Docker Compose.

@example

Dockerspec.Configuration.compose_runner = Dockerspec::Runner::Compose

@param runner [Class] A {Dockerspec::Runner::Compose::Base} subclass.

@return void

@api public

# File lib/dockerspec/configuration.rb, line 119
def compose_runner=(runner)
  instance.compose_runner = runner
end
docker_runner() click to toggle source

Gets the class used to create and start Docker Containers.

@return [Class] A {Dockerspec::Runner::Base} subclass.

@api public

# File lib/dockerspec/configuration.rb, line 103
def docker_runner
  instance.docker_runner
end
docker_runner=(runner) click to toggle source

Sets the class used to create and start Docker Containers.

@example

Dockerspec.Configuration.docker_runner = Dockerspec::Runner::Docker

@param runner [Class] A {Dockerspec::Runner::Base} subclass.

@return void

@api public

# File lib/dockerspec/configuration.rb, line 92
def docker_runner=(runner)
  instance.docker_runner = runner
end
engines() click to toggle source

Gets the engine classes used to run the tests.

@return [Array<Class>] A list of {Dockerspec::Engine::Base} subclasses.

@api public

# File lib/dockerspec/configuration.rb, line 76
def engines
  instance.engines
end
new() click to toggle source

Constructs a configuration object.

@return [Dockerspec::Configuretion] The configuration object.

@api private

# File lib/dockerspec/configuration.rb, line 182
def initialize
  @docker_runner = Runner::Docker
  @compose_runner = Runner::Compose
  @engines = []
end
reset() click to toggle source

Resets the internal Configuration singleton object.

@return void

@api public

# File lib/dockerspec/configuration.rb, line 141
def reset
  @instance = nil
end

Protected Class Methods

instance() click to toggle source

Creates the Configuration singleton instance.

@return void

@api private

# File lib/dockerspec/configuration.rb, line 154
def instance
  @instance ||= new
end

Public Instance Methods

add_engine(engine) click to toggle source

Adds a class to use as engine to run the tests.

@param engine [Class] A {Dockerspec::Engine::Base} subclass.

@return void

@api private

# File lib/dockerspec/configuration.rb, line 168
def add_engine(engine)
  @engines << engine
  @engines.uniq!
end