capistrano_auto_multi_install 1.0.4 → 1.0.6

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.
@@ -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 == "" # User is not present
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
- create_database_yml_file
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano_auto_multi_install
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Grioni