Class: ActivePostgres::Validator
- Inherits:
-
Object
- Object
- ActivePostgres::Validator
- Defined in:
- lib/active_postgres/validator.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#ssh_executor ⇒ Object
readonly
Returns the value of attribute ssh_executor.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
-
#initialize(config, ssh_executor) ⇒ Validator
constructor
A new instance of Validator.
-
#validate_all ⇒ Object
Run all validation checks before installation.
Constructor Details
#initialize(config, ssh_executor) ⇒ Validator
Returns a new instance of Validator.
5 6 7 8 9 10 |
# File 'lib/active_postgres/validator.rb', line 5 def initialize(config, ssh_executor) @config = config @ssh_executor = ssh_executor @errors = [] @warnings = [] end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/active_postgres/validator.rb', line 3 def config @config end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
3 4 5 |
# File 'lib/active_postgres/validator.rb', line 3 def errors @errors end |
#ssh_executor ⇒ Object (readonly)
Returns the value of attribute ssh_executor.
3 4 5 |
# File 'lib/active_postgres/validator.rb', line 3 def ssh_executor @ssh_executor end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
3 4 5 |
# File 'lib/active_postgres/validator.rb', line 3 def warnings @warnings end |
Instance Method Details
#validate_all ⇒ Object
Run all validation checks before installation
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/active_postgres/validator.rb', line 13 def validate_all puts 'Running pre-flight validation checks...' validate_configuration validate_ssh_connectivity validate_network_connectivity validate_system_requirements if errors.any? puts "\n❌ Validation failed with #{errors.count} error(s):" errors.each { |error| puts " - #{error}" } return false end if warnings.any? puts "\n⚠️ Found #{warnings.count} warning(s):" warnings.each { |warning| puts " - #{warning}" } end puts "✅ All validation checks passed!\n" true end |