Module: Kitchen::Terraform::Version
- Defined in:
- lib/kitchen/terraform/version.rb
Overview
Kitchen::Terraform::Version represents the version of the Kitchen-Terraform gem. The module can send the version to different containers as well as conditionally yield to blocks based on version requirements.
Class Method Summary collapse
-
.assign_plugin_version(configurable_class:) ⇒ self
assign_plugin_version assigns the version to a class which includes Kitchen::Configurable.
-
.assign_specification_version(specification:) ⇒ self
assign_specification_version assigns the version to a Gem::Specification.
-
.if_satisfies(requirement:) { ... } ⇒ self
if_satisfies yields control if the provided requirement is satisfied by the version.
-
.temporarily_override(version:) { ... } ⇒ self
temporarily_override overrides the current version with the version provided, yields control, and then resets the version.
Class Method Details
.assign_plugin_version(configurable_class:) ⇒ self
assign_plugin_version assigns the version to a class which includes Kitchen::Configurable.
29 30 31 32 |
# File 'lib/kitchen/terraform/version.rb', line 29 def assign_plugin_version(configurable_class:) configurable_class.plugin_version value.to_s self end |
.assign_specification_version(specification:) ⇒ self
assign_specification_version assigns the version to a Gem::Specification.
38 39 40 41 |
# File 'lib/kitchen/terraform/version.rb', line 38 def assign_specification_version(specification:) specification.version = value self end |
.if_satisfies(requirement:) { ... } ⇒ self
if_satisfies yields control if the provided requirement is satisfied by the version.
49 50 51 52 53 |
# File 'lib/kitchen/terraform/version.rb', line 49 def if_satisfies(requirement:) yield if ::Gem::Requirement.new(requirement).satisfied_by? value self end |
.temporarily_override(version:) { ... } ⇒ self
temporarily_override must only be used in tests to validate version flow control logic.
temporarily_override overrides the current version with the version provided, yields control, and then resets the version.
62 63 64 65 66 67 68 |
# File 'lib/kitchen/terraform/version.rb', line 62 def temporarily_override(version:) current_value = value self.value = version yield self.value = current_value self end |