myreplicator 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,11 +17,17 @@ module Myreplicator
17
17
  end
18
18
 
19
19
  # Database host when ssh'ed into the db server
20
- db_host = ssh_configs(db)["ssh_db_host"].nil? ? "127.0.0.1" : ssh_configs(db)["ssh_db_host"]
20
+ db_host = "127.0.0.1"
21
+
22
+ if !ssh_configs(db)["ssh_db_host"].blank?
23
+ db_host = ssh_configs(db)["ssh_db_host"]
24
+ elsif !db_configs(db)["host"].blank?
25
+ db_host += db_configs(db)["host"]
26
+ end
21
27
 
22
28
  cmd = Myreplicator.mysqldump
23
29
  cmd += "#{flags} -u#{db_configs(db)["username"]} -p#{db_configs(db)["password"]} "
24
- cmd += "-h#{db_host} " if db_configs(db)["host"]
30
+ cmd += "-h#{db_host} "
25
31
  cmd += " -P#{db_configs(db)["port"]} " if db_configs(db)["port"]
26
32
  cmd += " #{db} "
27
33
  cmd += " #{options[:table_name]} "
@@ -75,7 +81,14 @@ module Myreplicator
75
81
  options.reverse_merge! :flags => []
76
82
  db = options[:db]
77
83
  # Database host when ssh'ed into the db server
78
- db_host = ssh_configs(db)["ssh_db_host"].nil? ? "127.0.0.1" : ssh_configs(db)["ssh_db_host"]
84
+
85
+ db_host = "127.0.0.1"
86
+
87
+ if !ssh_configs(db)["ssh_db_host"].blank?
88
+ db_host = ssh_configs(db)["ssh_db_host"]
89
+ elsif !db_configs(db)["host"].blank?
90
+ db_host += db_configs(db)["host"]
91
+ end
79
92
 
80
93
  flags = ""
81
94
 
@@ -89,7 +102,8 @@ module Myreplicator
89
102
 
90
103
  cmd = Myreplicator.mysql
91
104
  cmd += "#{flags} -u#{db_configs(db)["username"]} -p#{db_configs(db)["password"]} "
92
- cmd += "-h#{db_host} " if db_configs(db)["host"].blank?
105
+ cmd += "-h#{db_host} "
106
+
93
107
  cmd += db_configs(db)["port"].blank? ? "-P3306 " : "-P#{db_configs(db)["port"]} "
94
108
  cmd += "--execute=\"#{options[:sql]}\" "
95
109
  cmd += " > #{options[:filepath]} "
@@ -1,3 +1,3 @@
1
1
  module Myreplicator
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -10108,3 +10108,4 @@ LoadError (cannot load such file -- resque):
10108
10108
  Rendered /home/sasan/.rvm/gems/ruby-1.9.3-p125/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.8ms)
10109
10109
  Rendered /home/sasan/.rvm/gems/ruby-1.9.3-p125/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.8ms)
10110
10110
  Rendered /home/sasan/.rvm/gems/ruby-1.9.3-p125/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (4.7ms)
10111
+ Connecting to database specified by database.yml
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myreplicator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-15 00:00:00.000000000 Z
12
+ date: 2013-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -344,7 +344,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
344
344
  version: '0'
345
345
  segments:
346
346
  - 0
347
- hash: -1945371352944756649
347
+ hash: -2633228139332231140
348
348
  required_rubygems_version: !ruby/object:Gem::Requirement
349
349
  none: false
350
350
  requirements:
@@ -353,7 +353,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
353
353
  version: '0'
354
354
  segments:
355
355
  - 0
356
- hash: -1945371352944756649
356
+ hash: -2633228139332231140
357
357
  requirements: []
358
358
  rubyforge_project:
359
359
  rubygems_version: 1.8.23