deploify 0.2.14 → 0.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,65 @@
1
+ # Copyright 2006-2008 by Mike Bailey. All rights reserved.
2
+ # Copyright 2012 by Richard Riman. All rights reserved.
3
+
4
+ Capistrano::Configuration.instance(:must_exist).load do
5
+
6
+ set :postgresql_admin_user, "postgres"
7
+ set(:postgresql_admin_pass) { Capistrano::CLI.password_prompt "Enter database password for '#{postgresql_admin_user}':" }
8
+
9
+ before "deploify:postgresql:create_database", "deploify:postgresql:create_user"
10
+
11
+ namespace :deploify do
12
+
13
+ namespace :postgresql do
14
+
15
+ desc "Start PostgreSQL"
16
+ task :start, :roles => :db do
17
+ send(run_method, "service postgresql start")
18
+ end
19
+
20
+ desc "Stop PostgreSQL"
21
+ task :stop, :roles => :db do
22
+ send(run_method, "service postgresql stop")
23
+ end
24
+
25
+ desc "Restart PostgreSQL"
26
+ task :restart, :roles => :db do
27
+ send(run_method, "service postgresql restart")
28
+ end
29
+
30
+ desc "Reload PostgreSQL"
31
+ task :reload, :roles => :db do
32
+ send(run_method, "service postgresql reload")
33
+ end
34
+
35
+ desc "Create a PostgreSQL user"
36
+ task :create_user, :roles => :db do
37
+ run "#{sudo} su - postgres -c 'createuser -P -D -A -E #{db_user}; exit 0'" do |channel, stream, data|
38
+ if data =~ /^Enter password for new/
39
+ channel.send_data "#{db_password}\n"
40
+ end
41
+ if data =~ /^Enter it again:/
42
+ channel.send_data "#{db_password}\n"
43
+ end
44
+ if data =~ /^Shall the new role be allowed to create more new roles?/
45
+ channel.send_data "n\n"
46
+ end
47
+ end
48
+ end
49
+
50
+ desc "Create a PostgreSQL database"
51
+ task :create_database, :roles => :db do
52
+ run "#{sudo} su - postgres -c 'createdb -O #{db_user} #{db_name}; exit 0'"
53
+ end
54
+
55
+ desc "Grant user access to database"
56
+ task :grant_user_access_to_database, :roles => :db do
57
+ # "GRANT ALL PRIVILEGES ON DATABASE jerry to tom;"
58
+ # run "#{sudo} what's the command for this using #{db_user} #{db_name}\'"
59
+ end
60
+
61
+ end # namespace :postgresql
62
+
63
+ end # namespace :deploify
64
+
65
+ end
@@ -165,7 +165,9 @@ Capistrano::Configuration.instance(:must_exist).load do
165
165
  # database things
166
166
 
167
167
  set :db_host, "localhost"
168
- set :db_socket, "/var/run/mysqld/mysqld.sock"
168
+ set(:db_socket) do
169
+ db_server_type.eql?(:mysql) ? "/var/run/mysqld/mysqld.sock" : nil
170
+ end
169
171
  set(:db_adapter) do
170
172
  Capistrano::CLI.ui.ask("Enter database adapter") do |q|
171
173
  q.default = "mysql2"
@@ -9,6 +9,7 @@ require "#{File.dirname(__FILE__)}/recipes/monit"
9
9
  require "#{File.dirname(__FILE__)}/recipes/mysql"
10
10
  require "#{File.dirname(__FILE__)}/recipes/nginx"
11
11
  require "#{File.dirname(__FILE__)}/recipes/passenger"
12
+ require "#{File.dirname(__FILE__)}/recipes/postgresql"
12
13
  # require "#{File.dirname(__FILE__)}/recipes/puma"
13
14
  require "#{File.dirname(__FILE__)}/recipes/rails"
14
15
  require "#{File.dirname(__FILE__)}/recipes/thin"
@@ -1,7 +1,7 @@
1
1
  module Deploify
2
2
  MAJOR = 0
3
3
  MINOR = 2
4
- PATCH = 14
4
+ PATCH = 15
5
5
  BUILD = nil
6
6
 
7
7
  if BUILD.nil?
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deploify
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 14
10
- version: 0.2.14
9
+ - 15
10
+ version: 0.2.15
11
11
  platform: ruby
12
12
  authors:
13
13
  - Richard Riman
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-01-08 00:00:00 Z
18
+ date: 2013-01-21 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: bundler
@@ -140,6 +140,7 @@ files:
140
140
  - lib/deploify/recipes/mysql.rb
141
141
  - lib/deploify/recipes/nginx.rb
142
142
  - lib/deploify/recipes/passenger.rb
143
+ - lib/deploify/recipes/postgresql.rb
143
144
  - lib/deploify/recipes/puma.rb
144
145
  - lib/deploify/recipes/rails.rb
145
146
  - lib/deploify/recipes/thin.rb