mina-data_sync 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37645f8d3589d9c55c0e6042f047918331c7875f
4
- data.tar.gz: aabc85f46af7f5282784fbec8b14f04407f4c5a9
3
+ metadata.gz: 92a035865f6842eb4d25129ed3f29f0d7247b4e1
4
+ data.tar.gz: 075a5dd9b6427429c51d09c1439bdd71c177cd6e
5
5
  SHA512:
6
- metadata.gz: 29fa23eb847731061d236b957ee2b853f276ed9c8f9de1847426fd8afd99541146f8baafae55fb11bf82f66d57620c78894c316e52b711a30955947bdce63fd2
7
- data.tar.gz: d1a76a1b1e152117fea3289d2b2ffa6fc1887346ddf82053438dc8b80fff73039aa078756d1a429202ace6626ff2a08cdeb5552d28c59b710f9590f30df789d2
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=$(#{fetch(:rails)} runner "puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json")}
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
@@ -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.yes?("Are you sure you want to restore #{fetch(:rails_env)} database?")
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
@@ -1,5 +1,5 @@
1
1
  module Mina
2
2
  module DataSync
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
  end
5
5
  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.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-09-27 00:00:00.000000000 Z
11
+ date: 2016-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler