Class: Masamune::Commands::PostgresAdmin
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Masamune::Commands::PostgresAdmin
- Includes:
- PostgresCommon
- Defined in:
- lib/masamune/commands/postgres_admin.rb
Constant Summary collapse
- DEFAULT_ATTRIBUTES =
{ create_db_path: 'createdb', drop_db_path: 'dropdb', pg_dump_path: 'pg_dump', options: [], hostname: 'localhost', username: 'postgres', pgpass_file: nil, action: nil, database: nil, output: nil }.with_indifferent_access.freeze
Instance Method Summary collapse
- #command_args ⇒ Object
-
#initialize(delegate, attrs = {}) ⇒ PostgresAdmin
constructor
A new instance of PostgresAdmin.
Methods included from PostgresCommon
Constructor Details
#initialize(delegate, attrs = {}) ⇒ PostgresAdmin
Returns a new instance of PostgresAdmin.
45 46 47 48 49 50 |
# File 'lib/masamune/commands/postgres_admin.rb', line 45 def initialize(delegate, attrs = {}) super delegate DEFAULT_ATTRIBUTES.merge(configuration.commands.postgres).merge(configuration.commands.postgres_admin).merge(attrs).each do |name, value| instance_variable_set("@#{name}", value) end end |
Instance Method Details
#command_args ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/masamune/commands/postgres_admin.rb', line 52 def command_args raise ArgumentError, ':database must be given' unless @database args = [] args << command_path args << "--host=#{@hostname}" if @hostname args << "--username=#{@username}" if @username args << '--no-password' args << database args << @options args << output args.flatten.compact end |