lib/railsmachine/recipes/pgsql.rb in railsmachine-0.1.2 vs lib/railsmachine/recipes/pgsql.rb in railsmachine-1.0.0
- old
+ new
@@ -1,10 +1,7 @@
-# Copyright 2006, Bradley Taylor, bradley@railsmachine.com
-# Licensed under the GNU Lesser General Public License.
-
-# CentOS 4.3 install for Rails Machine
-# sudo -s
+# CentOS install for Rails Machine
+# sudo su -
# yum install postgresql-client postgresql-server postgresql-devel
# chkconfig postgresql on
# service postgresql start
# gem install postgres
# su - postgres
@@ -39,28 +36,27 @@
end
Capistrano.plugin :pgsql, PostgreSQLMethods
-Capistrano.configuration(:must_exist).load do
+Capistrano::Configuration.instance(:must_exist).load do
- desc "Create PosgreSQL database and user based on config/database.yml"
- task :setup_pgsql, :roles => :db, :only => { :primary => true } do
- # on_rollback {} TODO
- read_config
- pgsql.createuser db_user, db_password
- pgsql.createdb db_name, db_user
- end
+ namespace :postgresql do
- desc "Setup database"
- task :setup_db, :roles => :db, :only => { :primary => true } do
- setup_pgsql
+ desc "Create PosgreSQL database and user based on config/database.yml"
+ task :setup, :roles => :db, :only => { :primary => true } do
+ # on_rollback {} TODO
+ read_config
+ pgsql.createuser db_user, db_password
+ pgsql.createdb db_name, db_user
+ end
+
end
def read_config
db_config = YAML.load_file('config/database.yml')
set :db_user, db_config[rails_env]["username"]
set :db_password, db_config[rails_env]["password"]
set :db_name, db_config[rails_env]["database"]
end
-end
\ No newline at end of file
+end