myslog 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6f02eb9634c5f3b4abe378b1358bd93dc1187caf
4
+ data.tar.gz: e672b7ffdc61f7c4b7f71ca92677ebc507dd8143
5
+ SHA512:
6
+ metadata.gz: 0f9be4886e77c116f1d8544ce66e54c7f8ed321db5522a440146117626365b9153d95917dfd669da08235bd86b612d1d9d316f407e0cf6dacada4f235f5593e1
7
+ data.tar.gz: b1274e4d02dc43d8c3efc69f50a4471211b991be947861afae5ea921de3ce52300f0adaaa0cc4843cfaa29020407558e2350cf99a4fdd5f1be4ccad8b05d591c
data/README.md CHANGED
@@ -37,7 +37,7 @@ records = myslog.parse(text)
37
37
 
38
38
  ```ruby
39
39
  records[0]
40
- #=> {:time => 2011-10-03 14:17:38 +0900,
40
+ #=> {:date => 2011-10-03 14:17:38 +0900,
41
41
  #=> :user => "root[root]",
42
42
  #=> :host => "localhost",
43
43
  #=> :host_ip => "",
@@ -84,6 +84,14 @@ class MySlog
84
84
  end
85
85
  end
86
86
  else
87
+ if database = record.match(/^use ([^;]+)/)
88
+ response[:db] = database[1]
89
+ end
90
+
91
+ if timestamp = record.match(/SET timestamp=(\d+)/)
92
+ response[:date] = Time.at(timestamp[1].to_i)
93
+ end
94
+
87
95
  response[:sql] = record
88
96
  end
89
97
  end
@@ -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.9"
15
+ gem.version = "0.0.10"
16
16
  gem.add_development_dependency "rspec"
17
17
  end
@@ -115,7 +115,7 @@ use webtie;
115
115
  context "given full log" do
116
116
  describe "response" do
117
117
  before :each do
118
- @date = Time.now
118
+ @date = Time.at(1317619058)
119
119
  @user = "root[root]"
120
120
  @host = "localhost"
121
121
  @host_ip = ""
@@ -167,7 +167,7 @@ use webtie;
167
167
  end
168
168
 
169
169
  it "should have expected values" do
170
- @response[:date].should == nil
170
+ @response[:date].to_s.should == "2011-10-03 14:17:38 +0900"
171
171
  @response[:user].should == @user
172
172
  @response[:host].should == @host
173
173
  @response[:host_ip].should == @host_ip
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myslog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
5
- prerelease:
4
+ version: 0.0.10
6
5
  platform: ruby
7
6
  authors:
8
7
  - taka84u9
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-15 00:00:00.000000000 Z
11
+ date: 2014-01-13 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  description: MySQL slow query parser.
@@ -45,27 +42,26 @@ files:
45
42
  - spec/spec_helper.rb
46
43
  homepage: https://github.com/taka84u9/myslog
47
44
  licenses: []
45
+ metadata: {}
48
46
  post_install_message:
49
47
  rdoc_options: []
50
48
  require_paths:
51
49
  - lib
52
50
  required_ruby_version: !ruby/object:Gem::Requirement
53
- none: false
54
51
  requirements:
55
- - - ! '>='
52
+ - - '>='
56
53
  - !ruby/object:Gem::Version
57
54
  version: '0'
58
55
  required_rubygems_version: !ruby/object:Gem::Requirement
59
- none: false
60
56
  requirements:
61
- - - ! '>='
57
+ - - '>='
62
58
  - !ruby/object:Gem::Version
63
59
  version: '0'
64
60
  requirements: []
65
61
  rubyforge_project:
66
- rubygems_version: 1.8.23
62
+ rubygems_version: 2.1.11
67
63
  signing_key:
68
- specification_version: 3
64
+ specification_version: 4
69
65
  summary: MySQL slow query parser.
70
66
  test_files:
71
67
  - spec/myslog.rb