capistrano_auto_multi_install 1.0.4 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
@@ -23,24 +23,6 @@ DEFAULT COLLATE utf8_general_ci;'")
|
|
23
23
|
log "Database done"
|
24
24
|
end
|
25
25
|
|
26
|
-
def create_database_yml_file
|
27
|
-
|
28
|
-
mysql_password = fetch(:mysql_user_password)
|
29
|
-
mysql_user = fetch(:mysql_user)
|
30
|
-
|
31
|
-
conf = ERB.new(File.read(File.dirname(__FILE__)+"/database.yml.erb")).result(binding)
|
32
|
-
run_with_power "mkdir -p #{fetch(:shared_path)}/db", fetch(:runner)
|
33
|
-
run_with_power "mkdir -p #{fetch(:shared_path)}/config", fetch(:runner)
|
34
|
-
put_with_power conf, "#{fetch(:shared_path)}/config/database.yml", fetch(:runner)
|
35
|
-
|
36
|
-
syslink
|
37
|
-
end
|
38
|
-
|
39
|
-
def syslink
|
40
|
-
run_with_power "ln -nfs #{fetch(:shared_path)}/config/database.yml #{fetch(:current_path)}/config/database.yml", fetch(:runner)
|
41
|
-
end
|
42
|
-
|
43
|
-
|
44
26
|
|
45
27
|
def check_or_create_user
|
46
28
|
log 'Checking if '+fetch(:mysql_user)+' has already been created and granted correctly'
|
@@ -51,7 +33,7 @@ DEFAULT COLLATE utf8_general_ci;'")
|
|
51
33
|
ok = true
|
52
34
|
|
53
35
|
required_grants = ["SELECT","INSERT","UPDATE","DELETE","CREATE","DROP", "INDEX", "LOCK TABLES", "ALTER", "CREATE VIEW"]
|
54
|
-
if grants
|
36
|
+
if grants =~ /ERROR/ # User is not present
|
55
37
|
log 'User not present, creating him'
|
56
38
|
ok = false
|
57
39
|
# now let's create him
|
@@ -80,7 +62,21 @@ DEFAULT COLLATE utf8_general_ci;'")
|
|
80
62
|
log "Alright, now database and user are correctly set up"
|
81
63
|
|
82
64
|
|
83
|
-
|
65
|
+
|
66
|
+
# Create database.yml
|
67
|
+
mysql_password = fetch(:mysql_user_password)
|
68
|
+
mysql_user = fetch(:mysql_user)
|
69
|
+
application = fetch(:application)
|
70
|
+
|
71
|
+
conf = ERB.new(File.read(File.dirname(__FILE__)+"/database.yml.erb")).result(binding)
|
72
|
+
run_with_power "mkdir -p #{fetch(:shared_path)}/db", fetch(:runner)
|
73
|
+
run_with_power "mkdir -p #{fetch(:shared_path)}/config", fetch(:runner)
|
74
|
+
put_with_power conf, "#{fetch(:shared_path)}/config/database.yml", fetch(:runner)
|
75
|
+
|
76
|
+
|
77
|
+
# syslinks it
|
78
|
+
|
79
|
+
run_with_power "ln -nfs #{fetch(:shared_path)}/config/database.yml #{fetch(:current_path)}/config/database.yml", fetch(:runner)
|
84
80
|
end
|
85
81
|
|
86
82
|
private
|
@@ -13,7 +13,7 @@ class CapistranoAutoMultiInstall::Passenger < CapistranoAutoMultiInstall::Server
|
|
13
13
|
|
14
14
|
def generate_conf_files
|
15
15
|
# Intanciate some locals which will be used in erb file
|
16
|
-
document_root = fetch(:deploy_to)+'/public'
|
16
|
+
document_root = fetch(:deploy_to)+'/current/public'
|
17
17
|
server_name = name
|
18
18
|
passenger_tmp = tmp
|
19
19
|
|