myslog 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/lib/myslog.rb +3 -4
  2. data/myslog.gemspec +1 -1
  3. data/spec/myslog.rb +5 -5
  4. metadata +3 -3
data/lib/myslog.rb CHANGED
@@ -39,12 +39,11 @@ class MySlog
39
39
  record << lines.shift # query time
40
40
  end
41
41
 
42
- record << lines.shift # user@host
43
- record << lines.shift # query time
44
-
42
+ sql = []
45
43
  while (line = lines.shift) != nil && !line.start_with?("#")
46
- record << line
44
+ sql << line.strip
47
45
  end
46
+ record << sql.join(" ")
48
47
 
49
48
  records << record
50
49
  end
data/myslog.gemspec CHANGED
@@ -12,6 +12,6 @@ Gem::Specification.new do |gem|
12
12
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
13
  gem.name = "myslog"
14
14
  gem.require_paths = ["lib"]
15
- gem.version = "0.0.2"
15
+ gem.version = "0.0.3"
16
16
  gem.add_development_dependency "rspec"
17
17
  end
data/spec/myslog.rb CHANGED
@@ -73,22 +73,22 @@ use webtie;
73
73
  results = @myslog.divide(@lines)
74
74
 
75
75
  record = results[0]
76
- record.size.should == 12
76
+ record.size.should == 3
77
77
  record[0].should ==
78
78
  "# User@Host: gimp[drool] @ algernon.retards.org [10.10.10.7]"
79
79
 
80
80
  record = results[1]
81
- record.size.should == 4
81
+ record.size.should == 3
82
82
  record[0].should ==
83
83
  "# User@Host: gimp[drool] @ algernon.retards.org [10.10.10.7]"
84
84
 
85
85
  record = results[2]
86
- record.size.should == 9
86
+ record.size.should == 4
87
87
  record[0].should ==
88
88
  "# Time: 010626 10:44:50"
89
89
 
90
90
  record = results[3]
91
- record.size.should == 11
91
+ record.size.should == 4
92
92
  record[0].should ==
93
93
  "# Time: 010626 10:44:51"
94
94
  end
@@ -121,7 +121,7 @@ use webtie;
121
121
  @lock_time = 0.000097
122
122
  @rows_sent = 1
123
123
  @rows_examined = 0
124
- @sql = "SET timestamp=1317619058;\nSELECT * FROM life;"
124
+ @sql = "SET timestamp=1317619058; SELECT * FROM life;"
125
125
  @lines = [
126
126
  "# Time: #{@date.strftime("%y%m%d %H:%M:%S")}",
127
127
  "# User@Host: #{@user} @ #{@host} [#{@host_ip}]",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myslog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-06-07 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70279301611840 !ruby/object:Gem::Requirement
16
+ requirement: &70298330581000 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70279301611840
24
+ version_requirements: *70298330581000
25
25
  description: MySQL slow query parser.
26
26
  email:
27
27
  - taka84u9@gmail.com