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 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.



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/pgtk/pgsql_task.rb', line 48

def initialize(*args, &task_block)
  @name = args.shift || :pgsql
  @fresh_start = false
  @quite = false
  @user = 'test'
  @password = 'test'
  @dbname = 'test'
  @port = nil
  unless ::Rake.application.last_description
    desc 'Start a local PostgreSQL server'
  end
  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

#dbnameObject

Returns the value of attribute dbname.



43
44
45
# File 'lib/pgtk/pgsql_task.rb', line 43

def dbname
  @dbname
end

#dirObject

Returns the value of attribute dir.



39
40
41
# File 'lib/pgtk/pgsql_task.rb', line 39

def dir
  @dir
end

#fresh_startObject

Returns the value of attribute fresh_start.



40
41
42
# File 'lib/pgtk/pgsql_task.rb', line 40

def fresh_start
  @fresh_start
end

#nameObject

Returns the value of attribute name.



38
39
40
# File 'lib/pgtk/pgsql_task.rb', line 38

def name
  @name
end

#passwordObject

Returns the value of attribute password.



42
43
44
# File 'lib/pgtk/pgsql_task.rb', line 42

def password
  @password
end

#portObject

Returns the value of attribute port.



46
47
48
# File 'lib/pgtk/pgsql_task.rb', line 46

def port
  @port
end

#quietObject

Returns the value of attribute quiet.



45
46
47
# File 'lib/pgtk/pgsql_task.rb', line 45

def quiet
  @quiet
end

#userObject

Returns the value of attribute user.



41
42
43
# File 'lib/pgtk/pgsql_task.rb', line 41

def user
  @user
end

#yamlObject

Returns the value of attribute yaml.



44
45
46
# File 'lib/pgtk/pgsql_task.rb', line 44

def yaml
  @yaml
end