Module: RedmineWithGit::DumpLoad::Database
- Included in:
- RedmineWithGit::Dump::Database, Load::Database
- Defined in:
- lib/redmine_with_git/dump_load/database.rb
Instance Method Summary collapse
- #build_postgres_command(command, args = []) ⇒ Object
- #database_schema ⇒ Object
- #password_arg ⇒ Object
Instance Method Details
#build_postgres_command(command, args = []) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/redmine_with_git/dump_load/database.rb', line 6 def build_postgres_command(command, args = []) env.command( [password_arg, command] + { host: database_schema['host'], port: database_schema['port'], username: database_schema['username'], dbname: database_schema['database'] }.flat_map { |k, v| ["--#{k}", v] } + args ) end |
#database_schema ⇒ Object
15 16 17 |
# File 'lib/redmine_with_git/dump_load/database.rb', line 15 def database_schema Rails.configuration.database_configuration[Rails.env] end |
#password_arg ⇒ Object
19 20 21 |
# File 'lib/redmine_with_git/dump_load/database.rb', line 19 def password_arg '@ESC_PGPASSWORD=' + Shellwords.escape(database_schema['password']) end |