class GeneSystem::Manifest
Manifest
is an in memory representation of a manifest file
Constants
- DEFAULT_QUERY
- SUPPORTED_PLATFORMS
list of supported platforms
Public Class Methods
Incompatible returns true if the current manifest is not compatible with this version of GeneSystem
.
A manifest is not compatible if it was created with a version greater than this the installed version.
@param [Hash] manifest
@return [Boolean]
# File lib/gene_system/manifest.rb, line 43 def incompatible?(manifest) manifest_version = manifest['metadata']['gene_system']['version'] manifest_version > GeneSystem::VERSION rescue NoMethodError true end
# File lib/gene_system/manifest.rb, line 54 def initialize(path, data) @path = path @data = Hashie::Mash.new(data) @steps = GeneSystem::Step.load_steps(@data.steps) end
Creates a [GeneSystem::Manifest] from a manifest json so long as the manifest is compatible with this version of GeneSystem
.
@param [String] file_path
# File lib/gene_system/manifest.rb, line 16 def new_from_file(file_path) manifest = Jsonnet.evaluate( File.read(file_path) ) if incompatible?(manifest) raise 'provided manifest is invalid or incompatible with '\ 'this version of gene_system' end new( file_path, manifest ) end
Public Instance Methods
Manifest
name getter
@return [String]
# File lib/gene_system/manifest.rb, line 65 def name @data.name end
Steps executes a query function in a select call against each step to return a list of steps relevant to an operation.
The given query function should evaluate to true when the desired step should be in the return set.
By default a all steps will be returned.
@example query = ->(step) { step.tags.include?(“foo”) } manifest.steps(query)
@param [Lambda] query
@return [Array]
# File lib/gene_system/manifest.rb, line 121 def steps(query = DEFAULT_QUERY) @steps.select do |step| query.call(step) end end
Manifest
version getter
@return [String]
# File lib/gene_system/manifest.rb, line 74 def version @data.version end