karo 2.3.4 → 2.3.5
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/karo/cli.rb +1 -1
- data/lib/karo/config.rb +45 -36
- data/lib/karo/db.rb +1 -1
- data/lib/karo/extensions/hash.rb +11 -0
- data/lib/karo/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6bb2f2f052f4233b76e74240444ff57dad0198b
|
4
|
+
data.tar.gz: 472ec29a410344e0794d8403b0bc578f1d330420
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b4e80082714410de9882d1b924273131cf4324fabd98dc2f6d9e309e4b7461972ce3ebb5ed506f9a477b225a624923685b4d0bcd8b6bc17ea426dce7d5bbe87
|
7
|
+
data.tar.gz: ff3db3a5ee10f35d6dd2110ded09ae6b5bc09b458cf5c690362fa3e65ec15a1ad600e08b70c83684738b63eb360c465502f7992bab9fc4124cec875082926470
|
data/CHANGELOG.md
CHANGED
data/lib/karo/cli.rb
CHANGED
data/lib/karo/config.rb
CHANGED
@@ -1,43 +1,52 @@
|
|
1
|
+
require_relative 'extensions/hash'
|
1
2
|
require 'yaml'
|
2
3
|
require 'thor'
|
3
4
|
|
4
5
|
module Karo
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
7
|
+
class Config
|
8
|
+
|
9
|
+
def self.default_file_name
|
10
|
+
".karo.yml"
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.load_configuration(options)
|
14
|
+
configuration = lookup_configuration(Dir.getwd, options[:config_file])
|
15
|
+
configuration = configuration[options[:environment]]
|
16
|
+
|
17
|
+
if configuration.nil? || configuration.empty?
|
18
|
+
puts "Please pass a valid configuration for an environment '#{options[:environment]}' within this file '#{File.expand_path(options[:config_file])}'"
|
19
|
+
raise Thor::Error, "You can use 'karo generate' to generate a skeleton .karo.yml file"
|
20
|
+
else
|
21
|
+
configuration
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def self.lookup_configuration(dir, config_file, configuration={})
|
28
|
+
return configuration if dir.empty?
|
29
|
+
|
30
|
+
config_file_path = File.join(dir, config_file)
|
31
|
+
config = read_configuration(config_file_path)
|
32
|
+
|
33
|
+
lookup_configuration(pop_dir(dir), config_file, config.deep_merge(configuration))
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.pop_dir(dir)
|
37
|
+
dirs = dir.split("/")
|
38
|
+
dirs.pop
|
39
|
+
dirs.join("/")
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.read_configuration(file_name)
|
43
|
+
if File.exist?(file_name)
|
44
|
+
YAML.load_file(file_name)
|
45
|
+
else
|
46
|
+
{}
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
42
51
|
|
43
52
|
end
|
data/lib/karo/db.rb
CHANGED
@@ -95,7 +95,7 @@ module Karo
|
|
95
95
|
def sync_server_to_local_database(server_db_config, local_db_config)
|
96
96
|
ssh = "ssh #{@configuration["user"]}@#{@configuration["host"]}"
|
97
97
|
|
98
|
-
command = "#{ssh} \"mysqldump --opt -C -u#{server_db_config["username"]} -p#{server_db_config["password"]} #{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"]}"
|
98
|
+
command = "#{ssh} \"mysqldump --opt -C -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"]}"
|
99
99
|
|
100
100
|
run_it command, options[:verbose]
|
101
101
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class Hash
|
2
|
+
|
3
|
+
def deep_merge(other_hash)
|
4
|
+
self.merge(other_hash) do |key, oldval, newval|
|
5
|
+
oldval = oldval.to_hash if oldval.respond_to?(:to_hash)
|
6
|
+
newval = newval.to_hash if newval.respond_to?(:to_hash)
|
7
|
+
oldval.class.to_s == 'Hash' && newval.class.to_s == 'Hash' ? oldval.deep_merge(newval) : newval
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
data/lib/karo/version.rb
CHANGED
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.
|
4
|
+
version: 2.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rahul Trikha
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -150,6 +150,7 @@ files:
|
|
150
150
|
- lib/karo/common.rb
|
151
151
|
- lib/karo/config.rb
|
152
152
|
- lib/karo/db.rb
|
153
|
+
- lib/karo/extensions/hash.rb
|
153
154
|
- lib/karo/templates/karo.yml
|
154
155
|
- lib/karo/version.rb
|
155
156
|
- lib/karo/workflow.rb
|
@@ -174,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
175
|
version: '0'
|
175
176
|
requirements: []
|
176
177
|
rubyforge_project:
|
177
|
-
rubygems_version: 2.
|
178
|
+
rubygems_version: 2.1.1
|
178
179
|
signing_key:
|
179
180
|
specification_version: 4
|
180
181
|
summary: SSH toolbox to make running logs, sync, cache commands easier for a given
|