siringa 0.0.3 → 0.0.4
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 +6 -14
- data/lib/siringa/dumps.rb +28 -6
- data/lib/siringa/version.rb +1 -1
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +6 -1069
- data/test/dummy/log/test.log +62 -2536
- metadata +63 -65
- data/test/dummy/tmp/dumps/db_20130927191400.dump +0 -0
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
ZWNhZjAzNTMyY2YxZTA5NWY5N2NiYmUwYmM2NDBmYzA3NmY3ODFhMWMxNzA3
|
10
|
-
N2U5Nzg2NmUwZTNiNjI3ZmIzZDIxM2Y2YmI2M2VkOWVhMjVjNGRmMWZhNDky
|
11
|
-
MzZiZGI3MDNlZmYwZjYwM2MyMjcxYmI0OGVhNjc4ZDJhZmU3OWE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NDE2NWE2NzQ3NWQ5NjdjOGE2YjRhY2E3ZDk4MmYxOGVkNzY2OTE3ZWMxZThm
|
14
|
-
MjU1NjE0Mjg2NjM0NTI1NDM1ZmQ1ZjIyYzgyMGM2OGI4NDZiZmRmZDdiOTNm
|
15
|
-
ODY0MGJiZjZiODg2ZDY0OGZiZGQ1ZWM0OTc4ZjhiYTJkMjE3OGE=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 68a1ddbf31d98af8c1e605699a92db678ca7fdf2
|
4
|
+
data.tar.gz: 7e181bb6f29c3a50da42dbc953443dae9ccee78f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 63e1d2f63d8ec314000de580fd6ff154f8bc22d53d442cdae7e6eb3071d5459958f680f10e33a78834cd60aac8c938d18f9accc8769d04fe975e334238dfaf33
|
7
|
+
data.tar.gz: 923c02e11c80cd349b7c7b9554a69c39b3a8134c5030e41c9da46dec90e2956d71d4ed0ca601bc12cde52169029ec726c3dd6a7f65691dfeb29a5ba1c58c3af5
|
data/lib/siringa/dumps.rb
CHANGED
@@ -17,7 +17,11 @@ module Siringa
|
|
17
17
|
result = {}
|
18
18
|
case adapter_config[:adapter]
|
19
19
|
when "mysql", "mysql2"
|
20
|
-
_, result[:error], result[:status] = Open3.capture3(mysql_dump_command(adapter_config[:
|
20
|
+
_, result[:error], result[:status] = Open3.capture3(mysql_dump_command(adapter_config[:host],
|
21
|
+
adapter_config[:database],
|
22
|
+
adapter_config[:username],
|
23
|
+
adapter_config[:password],
|
24
|
+
dump_path))
|
21
25
|
when "sqlite3"
|
22
26
|
_, result[:error], result[:status] = Open3.capture3(sqlite_dump_command(adapter_config[:database], dump_path))
|
23
27
|
else
|
@@ -35,7 +39,11 @@ module Siringa
|
|
35
39
|
result = {}
|
36
40
|
case adapter_config[:adapter]
|
37
41
|
when "mysql", "mysql2"
|
38
|
-
_, result[:error], result[:status] = Open3.capture3(mysql_restore_command(adapter_config[:
|
42
|
+
_, result[:error], result[:status] = Open3.capture3(mysql_restore_command(adapter_config[:host],
|
43
|
+
adapter_config[:database],
|
44
|
+
adapter_config[:username],
|
45
|
+
adapter_config[:password],
|
46
|
+
dump_path))
|
39
47
|
when "sqlite3"
|
40
48
|
_, result[:error], result[:status] = Open3.capture3(sqlite_restore_command(adapter_config[:database], dump_path))
|
41
49
|
else
|
@@ -69,20 +77,34 @@ module Siringa
|
|
69
77
|
|
70
78
|
# Return a string with the dump command for MySql
|
71
79
|
#
|
80
|
+
# @param host [String]
|
72
81
|
# @param database [String]
|
82
|
+
# @param username [String]
|
83
|
+
# @param password [String]
|
73
84
|
# @param dump_path [String]
|
74
85
|
# @return [String]
|
75
|
-
def self.mysql_dump_command(database, dump_path)
|
76
|
-
"/usr/bin/env mysqldump -
|
86
|
+
def self.mysql_dump_command(host, database, username, password, dump_path)
|
87
|
+
"/usr/bin/env mysqldump -h#{host} -u#{username} #{password_param(password)} #{database} > #{dump_path}"
|
77
88
|
end
|
78
89
|
|
79
90
|
# Return a string with the restore command for MySql
|
80
91
|
#
|
92
|
+
# @param host [String]
|
81
93
|
# @param database [String]
|
94
|
+
# @param username [String]
|
95
|
+
# @param password [String]
|
82
96
|
# @param dump_path [String]
|
83
97
|
# @return [String]
|
84
|
-
def self.mysql_restore_command(database, dump_path)
|
85
|
-
"/usr/bin/env mysql -
|
98
|
+
def self.mysql_restore_command(host, database, username, password, dump_path)
|
99
|
+
"/usr/bin/env mysql -h#{host} -u#{username} #{password_param(password)} #{database} < #{dump_path}"
|
100
|
+
end
|
101
|
+
|
102
|
+
# Return a string with the password parameter
|
103
|
+
#
|
104
|
+
# @param password [String]
|
105
|
+
# @return [String]
|
106
|
+
def self.password_param(password)
|
107
|
+
!password.nil? ? "-p#{password}" : ""
|
86
108
|
end
|
87
109
|
|
88
110
|
# Return a string with the dump command for Sqlite
|
data/lib/siringa/version.rb
CHANGED
Binary file
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|