cloner 0.8.0 → 0.9.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
  SHA256:
3
- metadata.gz: 84c8fe363198647047f69099007af0a106d4820cdc7758b9cae1d26909b79c73
4
- data.tar.gz: e96bc96b11c84cc67d2a06747e379cacdc633eb94e1f435d19227cb2b26c8550
3
+ metadata.gz: 652e0cb307e408f626c4376e97480acb8bb830f3463b7272befe0eb8b6cd9b2c
4
+ data.tar.gz: 825b8ea077f10294d0a561ef75d751e4f85e0109935cafb51ec92de7bd1d74e2
5
5
  SHA512:
6
- metadata.gz: bceec6cdef8aef9384a003ed93607e6d7bb27c22ddf61326b45dee79b17deb92fbbe1806f33405b4882201d9a330a820b44cb84722dab1a7bca4b7e6ffd23142
7
- data.tar.gz: deaa7c11906fd6a184fba2abbe1fc05d510064665aefdf10f0d29e744ab6956687b62dcd37ac88811758412558af564f4fea6af0fb29eb5677ef2cd18237a488
6
+ metadata.gz: 87ab8f908f2c9428f39bf8a2d536a54b647b4eac6393aa07c9ebe4db2149226f0d80bed75f46eb25c1359f03e097ac036cde83b847bed9e21d62c26be724d23c
7
+ data.tar.gz: 5b172cfb19ad692494218221ac0ca0dae3ebbabab08978fdaf314e911bcf334d2fd6db47ce600ebf426f0df6ff8409a9542058e9d36461d269a349b57e416b2f
data/README.md CHANGED
@@ -109,6 +109,11 @@ All functions from cloner/internal.rb can be overriden, for example:
109
109
 
110
110
  ## Changelog
111
111
 
112
+ ### 0.9.0
113
+
114
+ - Add option to rsync to allow sync one file (thx @AnatolyShirykalov)
115
+ - Add env_database to allow overriding database env (thx @Yarroo)
116
+
112
117
  ### 0.8.0
113
118
 
114
119
  - Change default rsync flags - -z to -zz to support newer versions of rsync
@@ -1,10 +1,14 @@
1
1
  module Cloner::Ar
2
2
  def ar_conf
3
3
  @conf ||= begin
4
- YAML.load_file(Rails.root.join('config', 'database.yml'))[Rails.env]
4
+ YAML.load_file(Rails.root.join('config', 'database.yml'))[env_database]
5
5
  end
6
6
  end
7
7
 
8
+ def env_database
9
+ Rails.env
10
+ end
11
+
8
12
  def ar_to
9
13
  ar_conf['database']
10
14
  end
@@ -65,7 +65,7 @@ module Cloner::MySQL
65
65
  def my_dump_copy
66
66
  FileUtils.mkdir_p(my_path)
67
67
  `mkdir -p #{e my_path}`
68
- rsync(remote_dump_path + '/', my_path)
68
+ rsync(remote_dump_path, my_path)
69
69
  end
70
70
 
71
71
  def clone_my
@@ -82,7 +82,7 @@ module Cloner::Postgres
82
82
  def pg_dump_copy
83
83
  FileUtils.mkdir_p(pg_path)
84
84
  `mkdir -p #{e pg_path}`
85
- rsync(remote_dump_path + '/', pg_path)
85
+ rsync(remote_dump_path, pg_path)
86
86
  end
87
87
 
88
88
  def clone_pg
@@ -10,8 +10,12 @@ module Cloner::RSync
10
10
  "#{rsync_compression} -utvr --checksum -e \"ssh -p #{port}\""
11
11
  end
12
12
 
13
- def rsync(from, to)
14
- cmd = "rsync #{rsync_flags} #{e ssh_user}@#{e ssh_host}:#{e from}/ #{e to}/"
13
+ def rsync(from, to, directory: true, raise_on_error: false)
14
+ if directory
15
+ from = "#{from}/" unless from.ends_with?('/')
16
+ to = "#{to}/" unless to.ends_with?('/')
17
+ end
18
+ cmd = "rsync #{rsync_flags} #{e ssh_user}@#{e ssh_host}:#{e from} #{e to}"
15
19
  puts "Running RSync: #{cmd}"
16
20
  pipe = IO.popen(cmd)
17
21
  while (line = pipe.gets)
@@ -20,6 +24,9 @@ module Cloner::RSync
20
24
  pipe.close
21
25
  ret = $?.to_i
22
26
  if ret != 0
27
+ if raise_on_error
28
+ raise "Error: local command exited with #{ret}"
29
+ end
23
30
  puts "Error: local command exited with #{ret}"
24
31
  end
25
32
  end
@@ -1,4 +1,4 @@
1
1
  module Cloner
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - glebtv
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-13 00:00:00.000000000 Z
11
+ date: 2020-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -111,7 +111,7 @@ homepage: https://github.com/rs-pro/cloner
111
111
  licenses:
112
112
  - MIT
113
113
  metadata: {}
114
- post_install_message:
114
+ post_install_message:
115
115
  rdoc_options: []
116
116
  require_paths:
117
117
  - lib
@@ -126,8 +126,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  requirements: []
129
- rubygems_version: 3.0.3
130
- signing_key:
129
+ rubygems_version: 3.1.3
130
+ signing_key:
131
131
  specification_version: 4
132
132
  summary: Easily clone your production Mongoid database and files for local development
133
133
  test_files: []