public
Description: Automate your wordpress deploys with capistrano and git
Homepage: http://www.jestro.com
Clone URL: git://github.com/jestro/wordpress-capistrano.git
fix windows hack, permissions fix
jnewland (author)
Mon Nov 24 11:55:16 -0800 2008
commit  827c9366c6133c338f417e17ac5cf21d5d3a79a5
tree    4e4b09b9fd30541b06c15f5238224a561aa552e6
parent  045539400448bd5c4bc5c6b33bec05359a0ee3e9
...
10
11
12
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
15
16
...
20
21
22
 
23
24
25
...
61
62
63
 
64
65
66
...
86
87
88
 
 
 
 
89
90
91
...
10
11
12
 
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
...
37
38
39
40
41
42
43
...
79
80
81
82
83
84
85
...
105
106
107
108
109
110
111
112
113
114
0
@@ -10,7 +10,24 @@ Capistrano::Configuration.instance.load do
0
   set :git_enable_submodules, 1
0
 
0
   #allow deploys w/o having git installed locally
0
-  set(:real_revision) { capture("git ls-remote #{repository} #{branch} | cut -f 1") }
0
+  set(:real_revision) do
0
+    output = ""
0
+    invoke_command("git ls-remote #{repository} #{branch} | cut -f 1", :once => true) do |ch, stream, data|
0
+      case stream
0
+      when :out
0
+        if data =~ /\(yes\/no\)\?/ # first time connecting via ssh, add to known_hosts?
0
+          ch.send_data "yes\n"
0
+        elsif data =~ /Warning/
0
+        elsif data =~ /yes/
0
+          #
0
+        else
0
+          output << data
0
+        end
0
+      when :err then warn "[err :: #{ch[:server]}] #{data}"
0
+      end
0
+    end
0
+    output.gsub(/\\/, '').chomp
0
+  end
0
   #no need for system, log, and pids directory
0
   set :shared_children, %w()
0
 
0
@@ -20,6 +37,7 @@ Capistrano::Configuration.instance.load do
0
 
0
   before "deploy:setup", "puppet:initial_setup"
0
   before "deploy:setup", "setup:users"
0
+  after "deploy:setup", "setup:fix_permissions"
0
 
0
   namespace :deploy do
0
     desc "Override deploy restart to not do anything"
0
@@ -61,6 +79,7 @@ Capistrano::Configuration.instance.load do
0
 
0
     task :generate_ssh_keys do
0
       run "mkdir -p /home/wordpress/.ssh"
0
+      run "chmod 700 /home/wordpress/.ssh"
0
       run "ssh-keygen -q -f /home/wordpress/.ssh/id_rsa -N ''"
0
       pubkey = capture("cat /home/wordpress/.ssh/id_rsa.pub")
0
       puts "Below is a freshly generated SSH public key for your server."
0
@@ -86,6 +105,10 @@ Capistrano::Configuration.instance.load do
0
         puts "Not resetting password, none provided"
0
       end
0
     end
0
+
0
+    task :fix_permissions do
0
+      sudo "chown -R #{user}:wheel #{deploy_to}"
0
+    end
0
   end
0
 
0
   namespace :apache do

Comments