Class: RailsWayback::Doctor
- Inherits:
-
Object
- Object
- RailsWayback::Doctor
- Defined in:
- lib/rails_wayback/doctor.rb
Overview
Performs explicit, non-destructive readiness checks for the host app.
Defined Under Namespace
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(configuration: RailsWayback.configuration, git: nil, environment: RailsWayback.current_environment, capture3: nil) ⇒ Doctor
constructor
A new instance of Doctor.
Constructor Details
#initialize(configuration: RailsWayback.configuration, git: nil, environment: RailsWayback.current_environment, capture3: nil) ⇒ Doctor
Returns a new instance of Doctor.
27 28 29 30 31 32 33 |
# File 'lib/rails_wayback/doctor.rb', line 27 def initialize(configuration: RailsWayback.configuration, git: nil, environment: RailsWayback.current_environment, capture3: nil) @configuration = configuration @git = git || Git.new(root: configuration.app_root_path) @environment = environment.to_s @capture3 = capture3 || Open3.method(:capture3) end |
Instance Method Details
#call ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rails_wayback/doctor.rb', line 35 def call root_check = app_root_check checks = [environment_check, root_check] git_check = executable_check("Git", "git") checks << git_check checks << repository_check unless git_check.error? || root_check.error? checks << executable_check("tar", "tar", version_optional: true) checks << if root_check.error? check("Cache directory", :error, "not checked because the application root is missing") else cache_check end checks << configured_paths_check Result.new(checks: checks) end |