Class: GeneSystem::Commands::DescribeManifest

Inherits:
Object
  • Object
show all
Defined in:
lib/gene_system/commands/describe_manifest.rb

Overview

Describe Manifest

Constant Summary collapse

DEFAULT_MANIFEST_NAME =

Default name of gene system manifest

'manifest.json'.freeze
STEP_HEADER =
['CMD'].freeze

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ DescribeManifest

Returns a new instance of DescribeManifest.



12
13
14
15
16
# File 'lib/gene_system/commands/describe_manifest.rb', line 12

def initialize(options)
  @options = options
  @prompt = TTY::Prompt.new
  @manifest = nil
end

Instance Method Details

#runObject

Prints manifest summary to STDOUT



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/gene_system/commands/describe_manifest.rb', line 23

def run
  manifest_path = @options.manifest
  manifest_path ||= @prompt.ask(
    'Please enter the name of the manifest',
    default: DEFAULT_MANIFEST_NAME
  )

  @manifest = GeneSystem::Manifest.new_from_file(manifest_path)

  puts <<~DESCRIPTION
    NAME: #{@manifest.name}
    VERSION: #{@manifest.version}
  DESCRIPTION

  puts 'INSTALL STEPS:'

  @manifest.steps.each do |step|
    print_step_commands(step, 'install', install_commands(step))
  end

  puts 'REMOVE STEPS:'
  @manifest.steps.each do |step|
    print_step_commands(step, 'remove', remove_commands(step))
  end
end