mysql-inspector 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -12,6 +12,17 @@ module MysqlInspector
12
12
  Command.new(mysqldump_path, *all_args)
13
13
  end
14
14
 
15
+ def strip_timestamps_from_dump!(dir)
16
+ Dir[File.join(dir, "*.sql")].each do |file|
17
+ lines = File.readlines(file)
18
+ File.open(file, "w") do |f|
19
+ lines.each do |line|
20
+ f.puts line unless line =~ /^--/ or line =~ /^\/\*/ or line.strip.empty?
21
+ end
22
+ end
23
+ end
24
+ end
25
+
15
26
  def mysql_user
16
27
  @mysql_user ||= "root"
17
28
  end
@@ -47,8 +58,8 @@ module MysqlInspector
47
58
 
48
59
  attr_reader :version, :base_dir
49
60
 
50
- def db_name
51
- @db_name ||= read_db_name
61
+ def db_date
62
+ @db_date ||= read_db_date
52
63
  end
53
64
 
54
65
  def dir
@@ -65,10 +76,10 @@ module MysqlInspector
65
76
 
66
77
  def dump!(db_name)
67
78
  raise Precondition, "Can't overwrite an existing schema at #{dir.inspect}" if exists?
68
- @db_name = db_name
69
79
  FileUtils.mkdir_p(dir)
70
80
  Config.mysqldump("--no-data", "-T #{dir}", "--skip-opt", db_name).run!
71
- File.open(info_file, "w") { |f| f.puts(db_name) }
81
+ Config.strip_timestamps_from_dump!(dir)
82
+ File.open(info_file, "w") { |f| f.puts(Time.now.utc.strftime("%Y-%m-%d")) }
72
83
  end
73
84
 
74
85
  protected
@@ -77,7 +88,7 @@ module MysqlInspector
77
88
  File.join(dir, ".info")
78
89
  end
79
90
 
80
- def read_db_name
91
+ def read_db_date
81
92
  raise Precondition, "No dump exists at #{dir.inspect}" unless File.exist?(info_file)
82
93
  File.read(info_file).strip
83
94
  end
@@ -108,7 +119,7 @@ module MysqlInspector
108
119
 
109
120
  def find(writer, *matchers)
110
121
  writer.puts
111
- writer.puts "Searching #{dump.version} (#{dump.db_name}) for #{matchers.inspect}"
122
+ writer.puts "Searching #{dump.version} (#{dump.db_date}) for #{matchers.inspect}"
112
123
  writer.puts
113
124
  files = Dir[File.join(dump.dir, "*.sql")].collect { |f| File.basename(f) }.sort
114
125
  files.each do |f|
@@ -155,8 +166,8 @@ module MysqlInspector
155
166
 
156
167
  def compare(writer=STDOUT)
157
168
  writer.puts
158
- writer.puts "Current: #{current.version} (#{current.db_name})"
159
- writer.puts "Target: #{target.version} (#{target.db_name})"
169
+ writer.puts "Current: #{current.version} (#{current.db_date})"
170
+ writer.puts "Target: #{target.version} (#{target.db_date})"
160
171
 
161
172
  current_files = Dir[File.join(current.dir, "*.sql")].collect { |f| File.basename(f) }.sort
162
173
  target_files = Dir[File.join(target.dir, "*.sql")].collect { |f| File.basename(f) }.sort
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mysql-inspector}
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ryan Carver"]
12
- s.date = %q{2010-03-08}
12
+ s.date = %q{2010-03-18}
13
13
  s.default_executable = %q{mysql-inspector}
14
14
  s.email = %q{ryan@fivesevensix.com}
15
15
  s.executables = ["mysql-inspector"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ryan Carver
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-08 00:00:00 -08:00
17
+ date: 2010-03-18 00:00:00 -07:00
18
18
  default_executable: mysql-inspector
19
19
  dependencies: []
20
20