cloner 0.4.1 → 0.5.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: 9f053124059bb67150acb7844510dbd68c4b59de
4
- data.tar.gz: 88a6c80d311046b2897c1eacd132607d6618e43e
3
+ metadata.gz: 5f458cd38cf985729bae72765cff1a62b1e20b95
4
+ data.tar.gz: 49f0ec43973df92b49f320485fa492149e12310b
5
5
  SHA512:
6
- metadata.gz: 958a391e9bf77a47e6015c59a93ec1ed2cd04956fefccfa9f3fafce0f031e10e20a5f4805d223f13b636fcbc4e08b5b3299f62fa4a9a11478d2b4f613a2c063d
7
- data.tar.gz: 6c7fb0c2a632b1abbc9b9c2644e3240652bf03b5d101ab130fee23c3f4d5d772851ffe3bba113e94be3f933fbfc23b45d4f8c5636557e214770f46c7d91b8793
6
+ metadata.gz: 3d8adf2b9f7ad47e2b311ee6417f6b6d49eca5e2b5afbec134b4a856dc29fc22c62952a6d0b39ac4b98b76e8101ca23b2b882221ea5a73529b969da0afca4bb7
7
+ data.tar.gz: 319bf7a34e025e9d5b651195e58b922d905cb4bcd4046549bd4869eeb4fc273ec928636721069dfbf7feb5bcfa00e14b01aec33fdf2236202224bab5d6491227
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Cloner
2
2
 
3
- Easily clone your production Mongoid database and files for local development
3
+ Easily clone your production Mongoid or PostgreSQL database and files for local development or staging area.
4
4
 
5
5
  ## Installation
6
6
 
@@ -3,7 +3,12 @@ module Cloner::MongoDB
3
3
 
4
4
  def mongodb_conf
5
5
  @conf ||= begin
6
- YAML.load_file(Rails.root.join('config', 'mongoid.yml'))[Rails.env]['sessions']['default']
6
+ yml = YAML.load_file(Rails.root.join('config', 'mongoid.yml'))[Rails.env]
7
+ if yml.key?('sessions')
8
+ yml['sessions']['default']
9
+ else
10
+ yml['clients']['default']
11
+ end
7
12
  end
8
13
  end
9
14
 
@@ -16,7 +21,12 @@ module Cloner::MongoDB
16
21
  Net::SSH.start(ssh_host, ssh_user, ssh_opts) do |ssh|
17
22
  ret = ssh_exec!(ssh, "cat #{e(remote_app_path + '/config/mongoid.yml')}")
18
23
  check_ssh_err(ret)
19
- YAML.load(ret[0])[env_from]['sessions']['default']
24
+ yml = YAML.load(ret[0])[env_from]
25
+ if yml.key?('sessions')
26
+ yml['sessions']['default']
27
+ else
28
+ yml['clients']['default']
29
+ end
20
30
  end
21
31
  end
22
32
  end
@@ -56,7 +56,7 @@ module Cloner::Postgres
56
56
  def pg_dump_restore
57
57
  puts "restoring DB"
58
58
  host = ar_conf['host'].present? ? "-h #{e ar_conf['host']}" : ""
59
- restore = pg_local_auth + "pg_restore -Fc -c -U #{e ar_conf['username']} #{host} -d #{e ar_to} #{e(pg_path + '/tmp.bak')}"
59
+ restore = pg_local_auth + "pg_restore --no-owner -Fc -c -U #{e ar_conf['username']} #{host} -d #{e ar_to} #{e(pg_path + '/tmp.bak')}"
60
60
  puts restore if verbose?
61
61
  pipe = IO.popen(restore)
62
62
  while (line = pipe.gets)
@@ -1,3 +1,3 @@
1
1
  module Cloner
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
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.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - glebtv
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-09 00:00:00.000000000 Z
11
+ date: 2015-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor