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.



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

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

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.



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

def project
  @project
end

#runnerObject (readonly)

Returns the value of attribute runner.



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

def runner
  @runner
end

Instance Method Details

#checksObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/lambda/microvms/doctor.rb', line 17

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
  ]
end

#ok?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/lambda/microvms/doctor.rb', line 30

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