dumpr 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dumpr.rb +3 -0
- data/lib/dumpr/cli.rb +3 -0
- data/lib/dumpr/driver.rb +15 -1
- data/lib/dumpr/driver/mysql.rb +8 -0
- data/lib/dumpr/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 205fecfb4696237b6e460954704b0f9553604c993f257acd7dc7dc4ebf96fd92
|
4
|
+
data.tar.gz: b2be3a8c4b43607e1e0c606f5b3c1d53d5c5db7973b77a630f4ed6511dd1fb9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0eaf3d62ba27241aaa50f17d31a8b5bd249ce12a2fb210179236bd8330ac2053f6580558f579ce0ed378411f6e94ab019362759f90f2a37aa1c4e2ef921aa29f
|
7
|
+
data.tar.gz: c1268f23b9dee20df7b8179665b62c755aadc3fbfaebffee16bba8a11dbe111f2e8589137b6cb8dd9db7e016c44c52195386740fe4d71f2a4522721c64a38a90
|
data/lib/dumpr.rb
CHANGED
data/lib/dumpr/cli.rb
CHANGED
data/lib/dumpr/driver.rb
CHANGED
@@ -100,8 +100,16 @@ module Dumpr
|
|
100
100
|
@logger
|
101
101
|
end
|
102
102
|
|
103
|
+
def dump_installed?
|
104
|
+
raise BadConfig.new "#{self.class} has not defined dump_installed?"
|
105
|
+
end
|
106
|
+
|
107
|
+
def import_installed?
|
108
|
+
raise BadConfig.new "#{self.class} has not defined import_installed?"
|
109
|
+
end
|
110
|
+
|
103
111
|
def dump_cmd
|
104
|
-
raise BadConfig.new "#{self.class} has not defined dump_cmd
|
112
|
+
raise BadConfig.new "#{self.class} has not defined dump_cmd"
|
105
113
|
end
|
106
114
|
|
107
115
|
# DUMPING + EXPORTING
|
@@ -115,6 +123,9 @@ module Dumpr
|
|
115
123
|
# if @destination is defined, it then moves the dump to the @destination, which can be a remote host:path
|
116
124
|
def dump
|
117
125
|
logger.debug("begin dump")
|
126
|
+
if dump_installed? != true
|
127
|
+
raise MissingDriver.new "#{self.class} does not appear to be installed.\nCould not find command `#{dump_cmd.to_s.split.first}`"
|
128
|
+
end
|
118
129
|
dumpfn = @dumpfile + (@gzip ? ".gz" : "")
|
119
130
|
Util.with_lockfile("localhost", dumpfn, @opts[:force]) do
|
120
131
|
|
@@ -184,6 +195,9 @@ module Dumpr
|
|
184
195
|
end
|
185
196
|
|
186
197
|
def import
|
198
|
+
if import_installed? != true
|
199
|
+
raise MissingDriver.new "#{self.class} does not appear to be installed.\nCould not find command `#{import_cmd.to_s.split.first}`"
|
200
|
+
end
|
187
201
|
Util.with_lockfile("localhost", @dumpfile, @opts[:force]) do
|
188
202
|
decompress if @gzip
|
189
203
|
|
data/lib/dumpr/driver/mysql.rb
CHANGED
@@ -11,6 +11,14 @@ module Dumpr
|
|
11
11
|
@dump_options || "--single-transaction --quick"
|
12
12
|
end
|
13
13
|
|
14
|
+
def dump_installed?
|
15
|
+
system("which mysqldump") == true
|
16
|
+
end
|
17
|
+
|
18
|
+
def import_installed?
|
19
|
+
system("which mysql") == true
|
20
|
+
end
|
21
|
+
|
14
22
|
def dump_cmd
|
15
23
|
if @all_databases
|
16
24
|
"mysqldump -u #{user} --password=#{password} -h #{host} -P #{port} --all-databases #{dump_options}"
|
data/lib/dumpr/version.rb
CHANGED