Class: Dockerspec::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/dockerspec/configuration.rb

Overview

Saves internal configuration for Dockerspec.

  • The test engines to Run: Specinfra, ...
  • The internal library used to run Docker.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#compose_runnerClass

The Runner::Compose class used to run Docker Compose.

Returns:



43
44
45
# File 'lib/dockerspec/configuration.rb', line 43

def compose_runner
  @compose_runner
end

#docker_runnerClass

The Runner class used to run Docker.

Returns:



36
37
38
# File 'lib/dockerspec/configuration.rb', line 36

def docker_runner
  @docker_runner
end

#enginesArray<Class> (readonly)

A list of test engines used to run the tests.

Returns:



50
51
52
# File 'lib/dockerspec/configuration.rb', line 50

def engines
  @engines
end

Class Method Details

.add_engine(engine) ⇒ Object

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

Examples:

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

Parameters:

Returns:

  • void



65
66
67
# File 'lib/dockerspec/configuration.rb', line 65

def add_engine(engine)
  instance.add_engine(engine)
end

.compose_runnerClass

Gets the class used to start Docker Compose.

Returns:

  • (Class)

    A Runner::Compose::Base subclass.



130
131
132
# File 'lib/dockerspec/configuration.rb', line 130

def compose_runner
  instance.compose_runner
end

.compose_runner=(runner) ⇒ Object

Sets the class used to start Docker Compose.

Examples:

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

Parameters:

  • runner (Class)

    A Runner::Compose::Base subclass.

Returns:

  • void



119
120
121
# File 'lib/dockerspec/configuration.rb', line 119

def compose_runner=(runner)
  instance.compose_runner = runner
end

.docker_runnerClass

Gets the class used to create and start Docker Containers.

Returns:



103
104
105
# File 'lib/dockerspec/configuration.rb', line 103

def docker_runner
  instance.docker_runner
end

.docker_runner=(runner) ⇒ Object

Sets the class used to create and start Docker Containers.

Examples:

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

Parameters:

Returns:

  • void



92
93
94
# File 'lib/dockerspec/configuration.rb', line 92

def docker_runner=(runner)
  instance.docker_runner = runner
end

.enginesArray<Class>

Gets the engine classes used to run the tests.

Returns:



76
77
78
# File 'lib/dockerspec/configuration.rb', line 76

def engines
  instance.engines
end

.resetObject

Resets the internal Configuration singleton object.

Returns:

  • void



141
142
143
# File 'lib/dockerspec/configuration.rb', line 141

def reset
  @instance = nil
end

Instance Method Details

#add_engine(engine) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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

Parameters:

Returns:

  • void



168
169
170
171
# File 'lib/dockerspec/configuration.rb', line 168

def add_engine(engine)
  @engines << engine
  @engines.uniq!
end