karo 2.3.6 → 2.3.7

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of karo might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c8871afe1a5dfa570c4142ca9fd8cbdd68b049e
4
- data.tar.gz: b8fdc8299135d847e651631f840a81a50cc5bf4c
3
+ metadata.gz: 368231ebc105f20e2014dbf8488c698b5b2503b0
4
+ data.tar.gz: cdff0022408ee2d4292ba7e5b0c535aa7700d544
5
5
  SHA512:
6
- metadata.gz: 308305a559e77ea0ee71ec80d58c90513f3fa0a6283997dc5894f76916fc842c43cde0ea5efe3d1b540cee648d43c41ad835781910daf12bafd1bc7b797e5af5
7
- data.tar.gz: 029f13b953fdb82961967e2bd580db5a70a8ca2ae42b7a2d1752d650f862353018b4d30b01496d2e7fbd2fa6b1935122517c1a22dc15031c1b3f53c0627ca89f
6
+ metadata.gz: 4938739b61e6287d56d3da3c0152c41061297229c6db9e32e2ecc18003e5cdce21f0517c8fc367685929e5a29cc4cfe9f3674946412b10284b9ef120ba9f3922
7
+ data.tar.gz: ac1ccc32bbe862df547f1262aac1313e6d952df89853f82c8be5e73a547e8c24a4931d2cc653b64357006dd4a6aac8b3ff441b45db137f46924550ae30ec3379
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## v2.3.7
4
+
5
+ ### Features
6
+
7
+ - Added support for pulling postgres databases
8
+
3
9
  ## v2.3.6
4
10
 
5
11
  ### Bug Fixes
data/lib/karo/db.rb CHANGED
@@ -87,7 +87,17 @@ module Karo
87
87
  end
88
88
 
89
89
  def drop_and_create_local_database(local_db_config)
90
- command = "mysql -v -h #{local_db_config["host"]} -u#{local_db_config["username"]} -p#{local_db_config["password"]} -e 'DROP DATABASE IF EXISTS `#{local_db_config["database"]}`; CREATE DATABASE IF NOT EXISTS `#{local_db_config["database"]}`;'"
90
+ command = case local_db_config["adapter"]
91
+ when "mysql2"
92
+ "mysql -v -h #{local_db_config["host"]} -u#{local_db_config["username"]} -p#{local_db_config["password"]} -e 'DROP DATABASE IF EXISTS `#{local_db_config["database"]}`; CREATE DATABASE IF NOT EXISTS `#{local_db_config["database"]}`;'"
93
+ when "postgresql"
94
+ <<-EOS
95
+ dropdb -h #{local_db_config["host"]} -U #{local_db_config["username"]} --if-exists #{local_db_config["database"]}
96
+ createdb -h #{local_db_config["host"]} -U #{local_db_config["username"]} #{local_db_config["database"]}
97
+ EOS
98
+ else
99
+ raise Thor::Error, "Please make sure that the database adapter is either mysql2 or postgresql?"
100
+ end
91
101
 
92
102
  run_it command, options[:verbose]
93
103
  end
@@ -95,7 +105,14 @@ module Karo
95
105
  def sync_server_to_local_database(server_db_config, local_db_config)
96
106
  ssh = "ssh #{@configuration["user"]}@#{@configuration["host"]}"
97
107
 
98
- command = "#{ssh} \"mysqldump --opt -C -h #{server_db_config["host"]} -u#{server_db_config["username"]} -p#{server_db_config["password"]} -h#{server_db_config["host"]} #{server_db_config["database"]}\" | mysql -v -h #{local_db_config["host"]} -C -u#{local_db_config["username"]} -p#{local_db_config["password"]} #{local_db_config["database"]}"
108
+ command = case server_db_config["adapter"]
109
+ when /mysql|mysql2/
110
+ "#{ssh} \"mysqldump --opt -C -h #{server_db_config["host"]} -u#{server_db_config["username"]} -p#{server_db_config["password"]} -h#{server_db_config["host"]} #{server_db_config["database"]}\" | mysql -v -h #{local_db_config["host"]} -C -u#{local_db_config["username"]} -p#{local_db_config["password"]} #{local_db_config["database"]}"
111
+ when "postgresql"
112
+ "#{ssh} \"export PGPASSWORD='#{server_db_config["password"]}'; pg_dump -Fc -U #{server_db_config["username"]} -h #{server_db_config["host"]} #{server_db_config["database"]}\" | pg_restore -h #{local_db_config["host"]} -U #{local_db_config["username"]} -d #{local_db_config["database"]}"
113
+ else
114
+ raise Thor::Error, "Please make sure that the database adapter is either mysql2 or postgresql?"
115
+ end
99
116
 
100
117
  run_it command, options[:verbose]
101
118
  end
data/lib/karo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Karo
2
- VERSION = "2.3.6"
2
+ VERSION = "2.3.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.6
4
+ version: 2.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rahul Trikha
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-26 00:00:00.000000000 Z
11
+ date: 2014-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry