mina-data_sync 1.0.0 → 1.0.1
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 +4 -4
- data/lib/mina/data_sync/helpers.rb +3 -4
- data/lib/mina/data_sync/tasks.rb +1 -1
- data/lib/mina/data_sync/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92a035865f6842eb4d25129ed3f29f0d7247b4e1
|
4
|
+
data.tar.gz: 075a5dd9b6427429c51d09c1439bdd71c177cd6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efdc23fa6c158527654882ae2d0ffb1ce39c2c1f9ce8af24450b54a78af4b46cff7593acdceb71eb2ba2eef2d829a2bb38fc4b955857ad705f2bc2e10434ac2b
|
7
|
+
data.tar.gz: 46dafc049a949ce309d1c06348a7daf7eb6f0942f4d3e47dd1ff5938da74f7ed85572507a8574a385c7f1d5bd1db32621944a9321c0e263323306165596b54b8
|
@@ -37,12 +37,11 @@ DATA_SYNC = <<-BASH
|
|
37
37
|
BASH
|
38
38
|
|
39
39
|
def dump_restore(rails_root, backup_path, mode: :dump, backend: :local)
|
40
|
-
set :rails_env, 'development' if backend == :local
|
41
40
|
comment %{#{mode == :dump ? 'Dumping' : 'Restoring'} database}
|
42
41
|
command %{cd #{rails_root}}
|
43
42
|
command DATA_SYNC.to_s
|
44
43
|
command %{mkdir -p #{backup_path}}
|
45
|
-
command %{CONFIG=$(
|
44
|
+
command %{CONFIG=$(RAILS_ENV=#{backend == :local ? 'development' : fetch(:rails_env)} bundle exec rails runner "puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json")}
|
46
45
|
comment %{$(data_sync "#{mode}" "#{backup_path}/#{fetch(:backup_file)}" "$CONFIG")}
|
47
46
|
command %{eval $(data_sync "#{mode}" "#{backup_path}/#{fetch(:backup_file)}" "$CONFIG")}
|
48
47
|
end
|
@@ -53,7 +52,7 @@ def rsync_db(mode: :remote_to_local)
|
|
53
52
|
comment %{Copying backup}
|
54
53
|
command %{mkdir -p #{fetch(:local_backup_path)}}
|
55
54
|
comment %{Backup: #{fetch(:local_backup_path)}/#{fetch(:backup_file)}}
|
56
|
-
command %{rsync --progress -e "ssh -p #{fetch(:port)}" #{fetch(:user)}@#{fetch(:domain)}:#{fetch(:current_path)}/#{fetch(:remote_backup_path)}/#{fetch(:backup_file)} #{fetch(:local_backup_path)}/#{fetch(:backup_file)}}
|
55
|
+
command %{rsync --progress -e "ssh -p #{fetch(:port, 22)}" #{fetch(:user)}@#{fetch(:domain)}:#{fetch(:current_path)}/#{fetch(:remote_backup_path)}/#{fetch(:backup_file)} #{fetch(:local_backup_path)}/#{fetch(:backup_file)}}
|
57
56
|
end
|
58
57
|
else
|
59
58
|
run :remote do
|
@@ -62,7 +61,7 @@ def rsync_db(mode: :remote_to_local)
|
|
62
61
|
run :local do
|
63
62
|
comment %{Copying backup}
|
64
63
|
comment %{Backup: #{fetch(:remote_backup_path)}/#{fetch(:backup_file)}}
|
65
|
-
command %{rsync --progress -e "ssh -p #{fetch(:port)}" #{fetch(:local_backup_path)}/#{fetch(:backup_file)} #{fetch(:user)}@#{fetch(:domain)}:#{fetch(:current_path)}/#{fetch(:remote_backup_path)}/#{fetch(:backup_file)}}
|
64
|
+
command %{rsync --progress -e "ssh -p #{fetch(:port, 22)}" #{fetch(:local_backup_path)}/#{fetch(:backup_file)} #{fetch(:user)}@#{fetch(:domain)}:#{fetch(:current_path)}/#{fetch(:remote_backup_path)}/#{fetch(:backup_file)}}
|
66
65
|
end
|
67
66
|
end
|
68
67
|
end
|
data/lib/mina/data_sync/tasks.rb
CHANGED
@@ -20,7 +20,7 @@ namespace :data_sync do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
task :restore_remote do
|
23
|
-
exit unless TTY::Prompt.new.
|
23
|
+
exit unless TTY::Prompt.new.no?("Are you sure you want to restore #{fetch(:rails_env)} database?")
|
24
24
|
run :remote do
|
25
25
|
dump_restore(fetch(:current_path), fetch(:remote_backup_path), mode: :restore, backend: :remote)
|
26
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mina-data_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stjepan Hadjic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|