Class: Pgtk::PgsqlTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/pgtk/pgsql_task.rb

Overview

Pgsql rake task.

Author

Yegor Bugayenko ([email protected])

Copyright

Copyright © 2019-2025 Yegor Bugayenko

License

MIT

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, &task_block) ⇒ PgsqlTask

Returns a new instance of PgsqlTask.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/pgtk/pgsql_task.rb', line 24

def initialize(*args, &task_block)
  super()
  @name = args.shift || :pgsql
  @fresh_start = false
  @quiet = false
  @user = 'test'
  @config = {}
  @password = 'test'
  @dbname = 'test'
  @port = nil
  desc 'Start a local PostgreSQL server' unless ::Rake.application.last_description
  task(name, *args) do |_, task_args|
    RakeFileUtils.send(:verbose, true) do
      yield(*[self, task_args].slice(0, task_block.arity)) if block_given?
      run
    end
  end
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



22
23
24
# File 'lib/pgtk/pgsql_task.rb', line 22

def config
  @config
end

#dbnameObject

Returns the value of attribute dbname.



22
23
24
# File 'lib/pgtk/pgsql_task.rb', line 22

def dbname
  @dbname
end

#dirObject

Returns the value of attribute dir.



22
23
24
# File 'lib/pgtk/pgsql_task.rb', line 22

def dir
  @dir
end

#fresh_startObject

Returns the value of attribute fresh_start.



22
23
24
# File 'lib/pgtk/pgsql_task.rb', line 22

def fresh_start
  @fresh_start
end

#nameObject

Returns the value of attribute name.



22
23
24
# File 'lib/pgtk/pgsql_task.rb', line 22

def name
  @name
end

#passwordObject

Returns the value of attribute password.



22
23
24
# File 'lib/pgtk/pgsql_task.rb', line 22

def password
  @password
end

#portObject

Returns the value of attribute port.



22
23
24
# File 'lib/pgtk/pgsql_task.rb', line 22

def port
  @port
end

#quietObject

Returns the value of attribute quiet.



22
23
24
# File 'lib/pgtk/pgsql_task.rb', line 22

def quiet
  @quiet
end

#userObject

Returns the value of attribute user.



22
23
24
# File 'lib/pgtk/pgsql_task.rb', line 22

def user
  @user
end

#yamlObject

Returns the value of attribute yaml.



22
23
24
# File 'lib/pgtk/pgsql_task.rb', line 22

def yaml
  @yaml
end