Class: Lambda::MicroVMs::Doctor

Inherits:
Object
  • Object
show all
Defined in:
lib/lambda/microvms/doctor.rb

Overview

Performs lightweight local project readiness checks.

Defined Under Namespace

Classes: Check

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project:, runner: Kernel) ⇒ Doctor

Returns a new instance of Doctor.



13
14
15
16
# File 'lib/lambda/microvms/doctor.rb', line 13

def initialize(project:, runner: Kernel)
  @project = project
  @runner = runner
end

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.



11
12
13
# File 'lib/lambda/microvms/doctor.rb', line 11

def project
  @project
end

#runnerObject (readonly)

Returns the value of attribute runner.



11
12
13
# File 'lib/lambda/microvms/doctor.rb', line 11

def runner
  @runner
end

Instance Method Details

#checksArray<Check>

Run all local readiness checks.

Returns:

  • (Array<Check>)

    check results



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/lambda/microvms/doctor.rb', line 21

def checks
  [
    check('Ruby', RUBY_VERSION >= '3.2', RUBY_VERSION),
    command_check('Docker', 'docker --version'),
    command_check('AWS CLI', 'aws --version'),
    file_check('microvm.yml', project.config_path),
    file_check('Dockerfile', project.dockerfile),
    config_check('role_arn', project.role_arn),
    config_check('deployment.bucket', project.s3_bucket),
    ric_check,
    sdk_contract_check
  ]
end

#ok?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/lambda/microvms/doctor.rb', line 35

def ok?
  checks.all?(&:ok)
end