Module: Avm::EacPostgresqlBase0::Instance::Commands
- Defined in:
- lib/avm/eac_postgresql_base0/instance/commands.rb
Instance Method Summary collapse
-
#common_command_args(database = true) ⇒ Object
rubocop:disable Style/OptionalBooleanParameter.
- #dump_command ⇒ EacRubyUtils::Envs::Command
- #dump_gzip_command ⇒ EacRubyUtils::Envs::Command
- #load_gzip_command ⇒ EacRubyUtils::Envs::Command
- #password_command_argument ⇒ String
-
#psql_command(database = true) ⇒ Object
rubocop:disable Style/OptionalBooleanParameter.
-
#psql_command_command(sql, database = true) ⇒ Object
rubocop:disable Style/OptionalBooleanParameter.
- #root_psql_command(sql = nil) ⇒ Object
Instance Method Details
#common_command_args(database = true) ⇒ Object
rubocop:disable Style/OptionalBooleanParameter
42 43 44 |
# File 'lib/avm/eac_postgresql_base0/instance/commands.rb', line 42 def common_command_args(database = true) # rubocop:disable Style/OptionalBooleanParameter ['--host', host, '--username', user, '--port', port] + database_args(database) end |
#dump_command ⇒ EacRubyUtils::Envs::Command
8 9 10 |
# File 'lib/avm/eac_postgresql_base0/instance/commands.rb', line 8 def dump_command pg_dump_command end |
#dump_gzip_command ⇒ EacRubyUtils::Envs::Command
13 14 15 |
# File 'lib/avm/eac_postgresql_base0/instance/commands.rb', line 13 def dump_gzip_command dump_command end |
#load_gzip_command ⇒ EacRubyUtils::Envs::Command
18 19 20 |
# File 'lib/avm/eac_postgresql_base0/instance/commands.rb', line 18 def load_gzip_command pg_restore_command end |
#password_command_argument ⇒ String
23 24 25 |
# File 'lib/avm/eac_postgresql_base0/instance/commands.rb', line 23 def password_command_argument "@ESC_PGPASSWORD=#{password}" end |
#psql_command(database = true) ⇒ Object
rubocop:disable Style/OptionalBooleanParameter
27 28 29 30 |
# File 'lib/avm/eac_postgresql_base0/instance/commands.rb', line 27 def psql_command(database = true) # rubocop:disable Style/OptionalBooleanParameter env.command(password_command_argument, 'psql', '--variable', 'ON_ERROR_STOP=t', *common_command_args(database)) end |
#psql_command_command(sql, database = true) ⇒ Object
rubocop:disable Style/OptionalBooleanParameter
32 33 34 |
# File 'lib/avm/eac_postgresql_base0/instance/commands.rb', line 32 def psql_command_command(sql, database = true) # rubocop:disable Style/OptionalBooleanParameter psql_command(database).append(['--quiet', '--tuples-only', '--command', sql]) end |
#root_psql_command(sql = nil) ⇒ Object
36 37 38 39 40 |
# File 'lib/avm/eac_postgresql_base0/instance/commands.rb', line 36 def root_psql_command(sql = nil) args = ['sudo', '-u', 'postgres', 'psql'] args += ['--quiet', '--tuples-only', '--command', sql] if sql.present? env.command(*args) end |