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 CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{blavosync}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["jayronc"]
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
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
- system("rsync -avz -e ssh '#{user}@#{remote_domain}:#{content_path}' '#{rails_root}/tmp/'")
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
- 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
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blavosync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jayronc