Class: Cheese::Postgresql
- Inherits:
-
Object
- Object
- Cheese::Postgresql
- Defined in:
- lib/database/postgresql.rb
Overview
Create and remove postgresql databases
Constant Summary collapse
- SILENCER =
">/dev/null 2>/dev/null"
Class Method Summary collapse
-
.create(name) ⇒ Object
create a user and new db.
-
.remove(name) ⇒ Object
remove a user and new db.
Class Method Details
.create(name) ⇒ Object
create a user and new db
9 10 11 12 13 14 15 16 |
# File 'lib/database/postgresql.rb', line 9 def self.create(name) while puts "We need to set a database password for #{name.gsub(".", "_")}." end %x{ su -c "createuser -S -D -R #{name.gsub(".", "_")} -W" postgres } %x{ su -c "createdb #{name.gsub(".", "_")}" postgres #{SILENCER} } end |