blavosync 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Blavosync.gemspec +1 -1
- data/README.markdown +6 -0
- data/VERSION +1 -1
- data/lib/blavosync/recipes/content_rsync.rb +5 -1
- data/lib/blavosync/recipes/local.rb +49 -52
- metadata +1 -1
data/Blavosync.gemspec
CHANGED
data/README.markdown
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
== blavosync
|
2
2
|
|
3
|
+
REQUIREMENTS:
|
4
|
+
|
5
|
+
a valid database.yml file with access to both production and development data
|
6
|
+
rsync binaries locally and on server, or gzip and tar
|
7
|
+
a config/deploy.rb script and ssh access to your production box
|
8
|
+
|
3
9
|
INSTALLATION:
|
4
10
|
Add this line to your config/deploy.rb file
|
5
11
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
@@ -12,7 +12,11 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
12
12
|
if exists?(:rsync_domain)
|
13
13
|
remote_domain = fetch(:rsync_domain)
|
14
14
|
end
|
15
|
-
|
15
|
+
if exists?(:user)
|
16
|
+
remote_user = fetch(:user)
|
17
|
+
end
|
18
|
+
|
19
|
+
system("rsync -avz -e ssh '#{[remote_user, remote_domain].join("@")}:#{content_path}' '#{rails_root}/tmp/'")
|
16
20
|
end
|
17
21
|
|
18
22
|
desc <<-DESC
|
@@ -17,57 +17,54 @@
|
|
17
17
|
#
|
18
18
|
Capistrano::Configuration.instance(:must_exist).load do |configuration|
|
19
19
|
|
20
|
-
def rails_root
|
21
|
-
|
22
|
-
end
|
23
|
-
def content_dir
|
24
|
-
|
25
|
-
end
|
26
|
-
def content_path
|
27
|
-
|
28
|
-
end
|
29
|
-
def public_path
|
30
|
-
|
31
|
-
end
|
32
|
-
def remote_backup_expires
|
33
|
-
|
34
|
-
end
|
35
|
-
def zip
|
36
|
-
|
37
|
-
end
|
38
|
-
def unzip
|
39
|
-
|
40
|
-
end
|
41
|
-
def zip_ext
|
42
|
-
|
43
|
-
end
|
44
|
-
def tmp_dir
|
45
|
-
|
46
|
-
end
|
47
|
-
def content_sync_method
|
48
|
-
|
49
|
-
end
|
50
|
-
def from_env
|
51
|
-
|
52
|
-
end
|
53
|
-
def to_env
|
54
|
-
|
55
|
-
end
|
56
|
-
def rsync_content_backup_file
|
57
|
-
|
58
|
-
end
|
59
|
-
def tar_content_backup_file
|
60
|
-
|
61
|
-
end
|
62
|
-
def db_backup_file
|
63
|
-
|
64
|
-
end
|
65
|
-
def db_backup_zip_file
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
|
70
|
-
|
20
|
+
def rails_root
|
21
|
+
Pathname.new('.').realpath
|
22
|
+
end
|
23
|
+
def content_dir
|
24
|
+
"system"
|
25
|
+
end
|
26
|
+
def content_path
|
27
|
+
File.join(fetch(:shared_path), content_dir)
|
28
|
+
end
|
29
|
+
def public_path
|
30
|
+
File.join(fetch(:latest_release), 'public')
|
31
|
+
end
|
32
|
+
def remote_backup_expires
|
33
|
+
100000
|
34
|
+
end
|
35
|
+
def zip
|
36
|
+
"gzip"
|
37
|
+
end
|
38
|
+
def unzip
|
39
|
+
"gunzip"
|
40
|
+
end
|
41
|
+
def zip_ext
|
42
|
+
"gz"
|
43
|
+
end
|
44
|
+
def tmp_dir
|
45
|
+
"tmp"
|
46
|
+
end
|
47
|
+
def content_sync_method
|
48
|
+
'rsync'
|
49
|
+
end
|
50
|
+
def from_env
|
51
|
+
(ENV['FROM_ENV'].nil? ? 'production' : ENV['RAILS_ENV'])
|
52
|
+
end
|
53
|
+
def to_env
|
54
|
+
(ENV['TO_ENV'].nil? ? 'development' : ENV['TO_ENV'])
|
55
|
+
end
|
56
|
+
def rsync_content_backup_file
|
57
|
+
"#{shared_path}/system"
|
58
|
+
end
|
59
|
+
def tar_content_backup_file
|
60
|
+
"#{shared_path}/backup_#{from_env}_content.tar.#{zip_ext}"
|
61
|
+
end
|
62
|
+
def db_backup_file
|
63
|
+
"#{shared_path}/backup_#{from_env}_db.sql"
|
64
|
+
end
|
65
|
+
def db_backup_zip_file
|
66
|
+
"#{db_backup_file}.#{zip_ext}"
|
67
|
+
end
|
71
68
|
|
72
69
|
def local_content_backup_dir(args={})
|
73
70
|
timestamp = args[:timestamp] || current_timestamp
|
@@ -102,7 +99,7 @@ end
|
|
102
99
|
end
|
103
100
|
|
104
101
|
def last_mod_time(path)
|
105
|
-
capture("stat -c%Y #{path}")
|
102
|
+
capture("stat -c%Y #{path}") rescue 0
|
106
103
|
end
|
107
104
|
|
108
105
|
def server_cache_valid?(path)
|