Class: Discharger::SetupRunner::PreCommands::PostgresqlToolsPreCommand
- Inherits:
-
BasePreCommand
- Object
- BasePreCommand
- Discharger::SetupRunner::PreCommands::PostgresqlToolsPreCommand
- Defined in:
- lib/discharger/setup_runner/pre_commands/postgresql_tools_pre_command.rb
Overview
Ensures PostgreSQL client tools (pg_dump, psql) are installed. These tools are needed for database operations like db:structure:dump.
Instance Attribute Summary
Attributes inherited from BasePreCommand
Instance Method Summary collapse
Methods inherited from BasePreCommand
Constructor Details
This class inherits a constructor from Discharger::SetupRunner::PreCommands::BasePreCommand
Instance Method Details
#description ⇒ Object
30 31 32 |
# File 'lib/discharger/setup_runner/pre_commands/postgresql_tools_pre_command.rb', line 30 def description "Ensure PostgreSQL client tools are installed" end |
#execute ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/discharger/setup_runner/pre_commands/postgresql_tools_pre_command.rb', line 11 def execute if command_exists?("pg_dump") log "PostgreSQL client tools found" return true end log "PostgreSQL client tools (pg_dump) not found." pg_version = config.dig("database", "version") || "14" if platform_darwin? install_via_homebrew(pg_version) elsif platform_linux? install_via_apt(pg_version) else log "WARNING: Unsupported platform for PostgreSQL client tools installation" false end end |