mina-data_sync 0.3.0 → 0.4.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29738315fecba443b8661ddd1acce2725094adda
4
- data.tar.gz: 9fd863f465f5787a2b8525ca0e5bcfc0caa8c264
3
+ metadata.gz: fe59f1e1973517be6af682959891f1b1f9aec9a5
4
+ data.tar.gz: cd92d1e1016a9794cfc08c7af325630258431b47
5
5
  SHA512:
6
- metadata.gz: c665ef2926752097eed3351d7290c9f03ec9ece33190254b0ed8e978e22c7051b44055d23c36c6fa532a1b7e7861ecfa4dc7eb84d4076767581c461262ddd1f6
7
- data.tar.gz: 7288f2a143c308228e1f4b2812568eeb50e53432a7a60ffbe58357ca03f4c38eacdd221e614626878852772384a0ca9c03f19279a604321e7ac82dad00e1049a
6
+ metadata.gz: 288ef3a12581f83977f70e5cc9c973504c37cc6846ade8fa1c6c8616b9634f732f5e38eda3e16ed74eef14a2ea7789627c06b03c31df5d8dd1ce0f37b724b33a
7
+ data.tar.gz: 784984bf74d646d5f9a2ccb5dc9522ec9a8477b79961675f9406f2a4e69cafd6bf4a358046f909fbb4e2f7855cb43b79b28470f11252bf5f698d26cb669b97c4
data/README.md CHANGED
@@ -23,7 +23,7 @@ And then execute:
23
23
  Or install it yourself as:
24
24
 
25
25
  $ gem install mina-data_sync
26
-
26
+
27
27
  Require it in your deploy script:
28
28
 
29
29
  ```ruby
@@ -45,8 +45,8 @@ configurable variables with defaults
45
45
  set :database_path, "config/database.yml"
46
46
  set :remote_backup_path, 'tmp'
47
47
  set :local_backup_path, -> { ENV['DATA_SYNC_BACKUP_PATH'] || 'tmp' }
48
- # if false will only make a dump and copy it without doing restore
49
- set :restore_data, -> { ENV['restore'] || 'true' }
48
+ set :restore_data, -> { ENV['restore'] || 'true' } # if false will not restore backup
49
+ set :dump_data, -> { ENV['dump'] || 'true' } # if false will not dump and copy backup
50
50
  ```
51
51
 
52
52
  ## Contributing
@@ -1,4 +1,5 @@
1
- set_default :database_path, "config/database.yml"
1
+ set_default :database_path, 'config/database.yml'
2
2
  set_default :remote_backup_path, 'tmp'
3
3
  set_default :local_backup_path, -> { ENV['DATA_SYNC_BACKUP_PATH'] || 'tmp' }
4
4
  set_default :restore_data, -> { ENV['restore'] || 'true' }
5
+ set_default :dump_data, -> { ENV['dump'] || 'true' }
@@ -6,19 +6,23 @@ namespace :data_sync do
6
6
  task pull: :setup_sync do
7
7
  set :term_mode, :pretty
8
8
 
9
- queue "echo '-----> Dumping database'"
10
- queue "cd #{deploy_to}/#{current_path}"
11
- queue "#{DATA_SYNC}"
12
- queue "mkdir -p #{remote_backup_path}"
13
- queue "CONFIG=$(#{rails} runner 'puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json')"
14
- queue %(data_sync "dump" "#{remote_backup_path}/#{backup_file}" "$CONFIG")
15
- queue %(eval $(data_sync "dump" "#{remote_backup_path}/#{backup_file}" "$CONFIG"))
9
+ if dump_data == 'true'
10
+ queue "echo '-----> Dumping database'"
11
+ queue "cd #{deploy_to}/#{current_path}"
12
+ queue "#{DATA_SYNC}"
13
+ queue "mkdir -p #{remote_backup_path}"
14
+ queue "CONFIG=$(#{rails} runner 'puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json')"
15
+ queue %(data_sync "dump" "#{remote_backup_path}/#{backup_file}" "$CONFIG")
16
+ queue %(eval $(data_sync "dump" "#{remote_backup_path}/#{backup_file}" "$CONFIG"))
17
+ end
16
18
 
17
19
  to :after_hook do
18
- queue "echo '-----> Copying backup'"
19
- queue "mkdir -p #{local_backup_path}"
20
- queue "#{DATA_SYNC}"
21
- queue "rsync --progress -e 'ssh -p #{port}' #{user}@#{domain}:#{deploy_to}/#{current_path}/#{remote_backup_path}/#{backup_file} #{local_backup_path}/#{backup_file}"
20
+ if dump_data == 'true'
21
+ queue "echo '-----> Copying backup'"
22
+ queue "mkdir -p #{local_backup_path}"
23
+ queue "#{DATA_SYNC}"
24
+ queue "rsync --progress -e 'ssh -p #{port}' #{user}@#{domain}:#{deploy_to}/#{current_path}/#{remote_backup_path}/#{backup_file} #{local_backup_path}/#{backup_file}"
25
+ end
22
26
  if restore_data == 'true'
23
27
  queue "echo '-----> Restoring database'"
24
28
  queue "CONFIG=$(RAILS_ENV=development #{bundle_bin} exec rails runner 'puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json')"
@@ -32,13 +36,15 @@ namespace :data_sync do
32
36
  set :term_mode, :pretty
33
37
 
34
38
  to :before_hook do
35
- queue "echo '-----> Dumping database'"
36
- queue "#{DATA_SYNC}"
37
- queue "CONFIG=$(RAILS_ENV=development #{bundle_bin} exec rails runner 'puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json')"
38
- queue %(data_sync "dump" "#{local_backup_path}/#{backup_file}" "$CONFIG")
39
- queue %(eval $(data_sync "dump" "#{local_backup_path}/#{backup_file}" "$CONFIG"))
40
- queue "echo '-----> Copying backup'"
41
- queue "rsync --progress -e 'ssh -p #{port}' #{local_backup_path}/#{backup_file} #{user}@#{domain}:#{deploy_to}/#{current_path}/#{remote_backup_path}/#{backup_file}"
39
+ if dump_data == 'true'
40
+ queue "echo '-----> Dumping database'"
41
+ queue "#{DATA_SYNC}"
42
+ queue "CONFIG=$(RAILS_ENV=development #{bundle_bin} exec rails runner 'puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json')"
43
+ queue %(data_sync "dump" "#{local_backup_path}/#{backup_file}" "$CONFIG")
44
+ queue %(eval $(data_sync "dump" "#{local_backup_path}/#{backup_file}" "$CONFIG"))
45
+ queue "echo '-----> Copying backup'"
46
+ queue "rsync --progress -e 'ssh -p #{port}' #{local_backup_path}/#{backup_file} #{user}@#{domain}:#{deploy_to}/#{current_path}/#{remote_backup_path}/#{backup_file}"
47
+ end
42
48
  end
43
49
 
44
50
  if restore_data == 'true'
@@ -1,5 +1,5 @@
1
1
  module Mina
2
2
  module DataSync
3
- VERSION = "0.3.0"
3
+ VERSION = '0.4.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mina-data_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stjepan Hadjic