mina-data_sync 0.4.1 → 1.0.0.beta1

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: 906ce53248e5536ed14641628c09a512a963d1db
4
- data.tar.gz: 44e56be60f736e278570ddcac0f2de19f5d7439e
3
+ metadata.gz: cbc55191410b3e3d69b32902de3cc174063a1a36
4
+ data.tar.gz: 048278bb16f1acbe1675d2e1aab84901bda59965
5
5
  SHA512:
6
- metadata.gz: 37eed3b371f1ffa5e1f9a04df013ff5d91927ad6bf44bfc1d02276855d60ba88372eae64eb4843abf46d37915a272fce84c725cf739e1049403989e6df7322a2
7
- data.tar.gz: b7cc556f6a96b36a607561be75bb0af2ff294319d817bf315e4da1d95aeafe66a7cb45bead9ec20ea48bb9b62f5e52c067bd30f10fe0d90c2ca68fed4a160905
6
+ metadata.gz: ae6354d4470eb087d293ae20bf4dc085c1b93a9e5c4b18314ceff2040efa01ed1fe4aaf273b64c06cf9390af482867ad3498340a0f5aeaee10281ae49f62d4f7
7
+ data.tar.gz: c48644f25409d87141562ece0e2bf58bd7aa9b9fae1ef857352b24ed189d8ba5f4e9b236eca1eb5673f37f3ccf10a2b96e74de402fde74fb40aad3f681feba39
@@ -1,5 +1,5 @@
1
- set_default :database_path, 'config/database.yml'
2
- set_default :remote_backup_path, 'tmp'
3
- set_default :local_backup_path, -> { ENV['DATA_SYNC_BACKUP_PATH'] || 'tmp' }
4
- set_default :restore_data, -> { ENV['restore'] || 'true' }
5
- set_default :dump_data, -> { ENV['dump'] || 'true' }
1
+ set :database_path, 'config/database.yml'
2
+ set :remote_backup_path, 'tmp'
3
+ set :local_backup_path, -> { ENV['DATA_SYNC_BACKUP_PATH'] || 'tmp' }
4
+ set :restore_data, -> { ENV['restore'] || 'true' }
5
+ set :dump_data, -> { ENV['dump'] || 'true' }
@@ -37,9 +37,9 @@ DATA_SYNC = <<-BASH
37
37
  BASH
38
38
 
39
39
  def config
40
- "#{rails} runner 'puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json'"
40
+ "#{fetch(:rails)} runner 'puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json'"
41
41
  end
42
42
 
43
43
  def backup_file
44
- "#{repository.split('/').last.split('.').first}-#{rails_env}-#{Date.today}.sql"
44
+ "#{fetch(:repository).split('/').last.split('.').first}-#{fetch(:rails_env)}-#{Date.today}.sql"
45
45
  end
@@ -4,56 +4,50 @@ namespace :data_sync do
4
4
  end
5
5
 
6
6
  task pull: :setup_sync do
7
- set :term_mode, :pretty
7
+ run :remote do
8
+ comment 'Dumping database'
9
+ command "cd #{fetch(:current_path)}"
10
+ command "#{DATA_SYNC}"
11
+ command "mkdir -p #{fetch(:remote_backup_path)}"
12
+ command "CONFIG=$(#{fetch(:rails)} runner 'puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json')"
13
+ command %(data_sync "dump" "#{fetch(:remote_backup_path)}/#{fetch(:backup_file)}" "$CONFIG")
14
+ command %(eval $(data_sync "dump" "#{fetch(:remote_backup_path)}/#{fetch(:backup_file)}" "$CONFIG"))
15
+ end if fetch(:dump_data) == 'true'
8
16
 
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
18
-
19
- to :after_hook do
20
- if dump_data == 'true'
21
- queue "echo '-----> Copying backup'"
22
- queue "mkdir -p #{local_backup_path}"
23
- queue "rsync --progress -e 'ssh -p #{port}' #{user}@#{domain}:#{deploy_to}/#{current_path}/#{remote_backup_path}/#{backup_file} #{local_backup_path}/#{backup_file}"
17
+ run :local do
18
+ if fetch(:dump_data) == 'true'
19
+ comment 'Copying backup'
20
+ command "mkdir -p #{fetch(:local_backup_path)}"
21
+ 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)}"
24
22
  end
25
- if restore_data == 'true'
26
- queue "echo '-----> Restoring database'"
27
- queue "#{DATA_SYNC}"
28
- queue "CONFIG=$(RAILS_ENV=development #{bundle_bin} exec rails runner 'puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json')"
29
- queue %(data_sync "restore" "#{local_backup_path}/#{backup_file}" "$CONFIG")
30
- queue %(eval $(data_sync "restore" "#{local_backup_path}/#{backup_file}" "$CONFIG"))
23
+ if fetch(:restore_data) == 'true'
24
+ comment 'Restoring database'
25
+ command "#{DATA_SYNC}"
26
+ command "CONFIG=$(RAILS_ENV=development #{fetch(:bundle_bin)} exec rails runner 'puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json')"
27
+ command %(data_sync "restore" "#{fetch(:local_backup_path)}/#{fetch(:backup_file)}" "$CONFIG")
28
+ command %(eval $(data_sync "restore" "#{fetch(:local_backup_path)}/#{fetch(:backup_file)}" "$CONFIG"))
31
29
  end
32
30
  end
33
31
  end
34
32
 
35
33
  task push: :setup_sync do
36
- set :term_mode, :pretty
37
-
38
- to :before_hook do
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
48
- end
34
+ run :local do
35
+ comment 'Dumping database'
36
+ command "#{DATA_SYNC}"
37
+ command "CONFIG=$(RAILS_ENV=development #{fetch(:bundle_bin)} exec rails runner 'puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json')"
38
+ command %(data_sync "dump" "#{fetch(:local_backup_path)}/#{fetch(:backup_file)}" "$CONFIG")
39
+ command %(eval $(data_sync "dump" "#{fetch(:local_backup_path)}/#{fetch(:backup_file)}" "$CONFIG"))
40
+ comment 'Copying backup'
41
+ 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)}"
42
+ end if fetch(:dump_data) == 'true'
49
43
 
50
- if restore_data == 'true'
51
- queue "echo '-----> Restoring database'"
52
- queue "cd #{deploy_to}/#{current_path}"
53
- queue "#{DATA_SYNC}"
54
- queue "CONFIG=$(#{rails} runner 'puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json')"
55
- queue %(data_sync "restore" "#{remote_backup_path}/#{backup_file}" "$CONFIG")
56
- queue %(eval $(data_sync "restore" "#{remote_backup_path}/#{backup_file}" "$CONFIG"))
57
- end
44
+ run :remote do
45
+ comment 'Restoring database'
46
+ command "cd #{fetch(:current_path)}"
47
+ command "#{DATA_SYNC}"
48
+ command "CONFIG=$(#{fetch(:rails)} runner 'puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json')"
49
+ command %(data_sync "restore" "#{fetch(:remote_backup_path)}/#{fetch(:backup_file)}" "$CONFIG")
50
+ command %(eval $(data_sync "restore" "#{fetch(:remote_backup_path)}/#{fetch(:backup_file)}" "$CONFIG"))
51
+ end if fetch(:restore_data) == 'true'
58
52
  end
59
53
  end
@@ -1,5 +1,5 @@
1
1
  module Mina
2
2
  module DataSync
3
- VERSION = '0.4.1'
3
+ VERSION = '1.0.0.beta1'
4
4
  end
5
5
  end
@@ -22,5 +22,5 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
23
  spec.add_development_dependency "pry", "~> 0"
24
24
 
25
- spec.add_dependency 'mina', '>= 0.3.4'
25
+ spec.add_dependency 'mina', '1.0.0.beta1'
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: 0.4.1
4
+ version: 1.0.0.beta1
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-03-31 00:00:00.000000000 Z
11
+ date: 2016-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: mina
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.3.4
61
+ version: 1.0.0.beta1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.3.4
68
+ version: 1.0.0.beta1
69
69
  description: Description
70
70
  email:
71
71
  - d4be4st@gmail.com
@@ -101,9 +101,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  requirements:
104
- - - ">="
104
+ - - ">"
105
105
  - !ruby/object:Gem::Version
106
- version: '0'
106
+ version: 1.3.1
107
107
  requirements: []
108
108
  rubyforge_project:
109
109
  rubygems_version: 2.5.1