mysql_truck 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/TODO ADDED
@@ -0,0 +1,4 @@
1
+ # TODO
2
+
3
+ * Add ability to manage number of backups on S3
4
+ * Better error handling messages rather than stack dumps
@@ -1,3 +1,3 @@
1
1
  module MysqlTruck
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
data/lib/mysql_truck.rb CHANGED
@@ -186,23 +186,22 @@ module MysqlTruck
186
186
  print "complete.\n"
187
187
  end
188
188
 
189
- # Load schemas
190
- puts "Loading schema."
191
- cmd = "cat #{tmp_path}/*.sql | "
192
- cmd += "mysql #{db_connection_options}"
193
- puts cmd
194
- `#{cmd}`
195
-
196
189
  # Load data
197
-
198
- puts "Loading data."
199
- cmd = "mysqlimport #{db_connection_options}"
200
- cmd += csv_options
201
- Dir["#{tmp_path}/*.csv"].each do |table|
202
- print " - Importing #{File.basename(table, ".csv")} ... "
203
- puts cmd + " " + table
204
- `#{cmd} #{table}`
190
+ puts "Loading schema and data by table"
191
+ import_cmd = "mysqlimport #{db_connection_options}"
192
+ import_cmd += csv_options
193
+ Dir["#{tmp_path}/*.sql"].each do |file|
194
+ print " - Loading schema for #{File.basename(file, ".sql")} ... "
195
+ cmd = "cat #{file} | mysql #{db_connection_options}"
196
+ `#{cmd}`
205
197
  print "complete.\n"
198
+
199
+ csv_file = "#{tmp_path}/#{File.basename(file, ".sql")}.csv"
200
+ if File.exists?(csv_file)
201
+ print " - Importing #{File.basename(csv_file, ".csv")} ... "
202
+ `#{import_cmd} #{csv_file}`
203
+ print "complete.\n"
204
+ end
206
205
  end
207
206
 
208
207
  puts "Backup loaded."
@@ -211,7 +210,7 @@ module MysqlTruck
211
210
  puts e.message
212
211
  puts e.backtrace.join("\n")
213
212
  ensure
214
- remove_directories
213
+ # remove_directories
215
214
  end
216
215
 
217
216
  def download_file(key)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysql_truck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -15,7 +15,7 @@ default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: right_aws
18
- requirement: &2160179560 !ruby/object:Gem::Requirement
18
+ requirement: &2163670640 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,7 +23,7 @@ dependencies:
23
23
  version: '0'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *2160179560
26
+ version_requirements: *2163670640
27
27
  description: Mysql database backup tool. Dumps/Loads to/from S3.
28
28
  email:
29
29
  - peter@paydrotalks.com
@@ -35,6 +35,7 @@ files:
35
35
  - .gitignore
36
36
  - Gemfile
37
37
  - Rakefile
38
+ - TODO
38
39
  - bin/mysql_truck
39
40
  - lib/mysql_truck.rb
40
41
  - lib/mysql_truck/version.rb