myslog 0.0.10 → 0.0.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f02eb9634c5f3b4abe378b1358bd93dc1187caf
4
- data.tar.gz: e672b7ffdc61f7c4b7f71ca92677ebc507dd8143
3
+ metadata.gz: 80788f037295ef11c3170012ebc5b2796190bb71
4
+ data.tar.gz: c89207a4068ada4490f8973ca7026d398b8bb9ec
5
5
  SHA512:
6
- metadata.gz: 0f9be4886e77c116f1d8544ce66e54c7f8ed321db5522a440146117626365b9153d95917dfd669da08235bd86b612d1d9d316f407e0cf6dacada4f235f5593e1
7
- data.tar.gz: b1274e4d02dc43d8c3efc69f50a4471211b991be947861afae5ea921de3ce52300f0adaaa0cc4843cfaa29020407558e2350cf99a4fdd5f1be4ccad8b05d591c
6
+ metadata.gz: 5c6800cf04a879821b1fcab7f2d0d244f2230fff976b599426734893c0f316c3d3c0fbe62bad227f8ede031736b74e99ee775dfa273371bd465f9db06a080dac
7
+ data.tar.gz: 91ada3731ba6290a078a1768c2127274f700681490030697b335228f2c13bfd83fef58f15206ffe9484052cc3db09205a36b1defa657c483f495fd0f0b31b086
data/.coverrails.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore CHANGED
@@ -1,18 +1,34 @@
1
1
  *.gem
2
2
  *.rbc
3
- .bundle
4
- .config
5
- coverage
6
- InstalledFiles
7
- lib/bundler/man
8
- pkg
9
- rdoc
10
- spec/reports
11
- test/tmp
12
- test/version_tmp
13
- tmp
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
14
11
 
15
- # YARD artifacts
16
- .yardoc
17
- _yardoc
18
- doc/
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ Gemfile.lock
30
+ .ruby-version
31
+ .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
data/Gemfile CHANGED
@@ -1,3 +1,7 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ group :test do
6
+ gem 'coveralls', require: false
7
+ end
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (C) 2015 Yuku TAKAHASHI
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  myslog
2
2
  ======
3
3
 
4
+ [![Build Status](https://travis-ci.org/yuku-t/myslog.svg?branch=master)](https://travis-ci.org/yuku-t/myslog) [![Code Climate](https://codeclimate.com/github/yuku-t/myslog/badges/gpa.svg)](https://codeclimate.com/github/yuku-t/myslog) [![Coverage Status](https://coveralls.io/repos/yuku-t/myslog/badge.svg)](https://coveralls.io/r/yuku-t/myslog)
5
+
4
6
  MySQL slow query log parser
5
7
 
6
8
  Install
data/Rakefile CHANGED
@@ -1,2 +1,5 @@
1
- #!/usr/bin/env rake
2
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new('spec')
5
+ task default: :spec
data/lib/myslog.rb CHANGED
@@ -1,20 +1,3 @@
1
- #
2
- # MySlog
3
- #
4
- # Copyright (C) 2012 Yuku TAKAHASHI
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
1
  require "time"
19
2
 
20
3
  class MySlog
@@ -36,7 +19,7 @@ class MySlog
36
19
  end
37
20
 
38
21
  sql = []
39
- while line != nil && !line.start_with?("#")
22
+ while line != nil && !line.start_with?("# Time") && !line.start_with?("# User@Host") && !line.start_with?("# Query_time")
40
23
  sql << line.strip
41
24
  line = lines.shift
42
25
  end
data/myslog.gemspec CHANGED
@@ -1,17 +1,16 @@
1
- # -*- coding:utf-8 -*-
1
+ Gem::Specification.new do |spec|
2
+ spec.name = "myslog"
3
+ spec.version = "0.0.11"
4
+ spec.authors = ["taka84u9"]
5
+ spec.email = ["taka84u9@gmail.com"]
6
+ spec.summary = "MySQL slow query parser."
7
+ spec.description = "MySQL slow query parser."
8
+ spec.homepage = "https://github.com/taka84u9/myslog"
2
9
 
3
- Gem::Specification.new do |gem|
4
- gem.authors = ["taka84u9"]
5
- gem.email = ["taka84u9@gmail.com"]
6
- gem.description = %q{MySQL slow query parser.}
7
- gem.summary = %q{MySQL slow query parser.}
8
- gem.homepage = "https://github.com/taka84u9/myslog"
10
+ spec.files = `git ls-files -z`.split("\x0")
11
+ spec.require_paths = ["lib"]
9
12
 
10
- gem.files = `git ls-files`.split($\)
11
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
12
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
- gem.name = "myslog"
14
- gem.require_paths = ["lib"]
15
- gem.version = "0.0.10"
16
- gem.add_development_dependency "rspec"
13
+ spec.add_development_dependency "bundler", "~> 1.7"
14
+ spec.add_development_dependency "rake", "~> 10.0"
15
+ spec.add_development_dependency "rspec"
17
16
  end
@@ -51,9 +51,9 @@ use webtie;
51
51
  describe "#parse" do
52
52
  it "should return Array of Hash" do
53
53
  results = @myslog.parse(@log)
54
- results.should be_an_instance_of Array
54
+ expect(results).to be_an_instance_of Array
55
55
  results.each do |result|
56
- results.should be_an_instance_of Array
56
+ expect(results).to be_an_instance_of Array
57
57
  end
58
58
  end
59
59
  end
@@ -65,9 +65,9 @@ use webtie;
65
65
 
66
66
  it "should return Array of Array" do
67
67
  results = @myslog.divide(@lines)
68
- results.should be_an_instance_of Array
68
+ expect(results).to be_an_instance_of Array
69
69
  results.each do |result|
70
- results.should be_an_instance_of Array
70
+ expect(results).to be_an_instance_of Array
71
71
  end
72
72
  end
73
73
 
@@ -75,24 +75,28 @@ use webtie;
75
75
  results = @myslog.divide(@lines)
76
76
 
77
77
  record = results[0]
78
- record.size.should == 3
79
- record[0].should ==
78
+ expect(record.size).to eq(3)
79
+ expect(record[0]).to eq(
80
80
  "# User@Host: gimp[drool] @ algernon.retards.org [10.10.10.7]"
81
+ )
81
82
 
82
83
  record = results[1]
83
- record.size.should == 3
84
- record[0].should ==
84
+ expect(record.size).to eq(3)
85
+ expect(record[0]).to eq(
85
86
  "# User@Host: gimp[drool] @ algernon.retards.org [10.10.10.7]"
87
+ )
86
88
 
87
89
  record = results[2]
88
- record.size.should == 4
89
- record[0].should ==
90
+ expect(record.size).to eq(4)
91
+ expect(record[0]).to eq(
90
92
  "# Time: 010626 10:44:50"
93
+ )
91
94
 
92
95
  record = results[3]
93
- record.size.should == 4
94
- record[0].should ==
96
+ expect(record.size).to eq(4)
97
+ expect(record[0]).to eq(
95
98
  "# Time: 010626 10:44:51"
99
+ )
96
100
  end
97
101
  end
98
102
 
@@ -106,10 +110,10 @@ use webtie;
106
110
  ]
107
111
  response = @myslog.parse_record(lines)
108
112
 
109
- response.should be_an_instance_of Hash
113
+ expect(response).to be_an_instance_of Hash
110
114
  %w[
111
115
  date user host host_ip time lock_time rows_sent rows_examined sql
112
- ].each { |k| response.should have_key k.to_sym}
116
+ ].each { |k| expect(response).to have_key k.to_sym}
113
117
  end
114
118
 
115
119
  context "given full log" do
@@ -134,15 +138,15 @@ use webtie;
134
138
  end
135
139
 
136
140
  it "should have expected values" do
137
- @response[:date].to_i.should == @date.to_i
138
- @response[:user].should == @user
139
- @response[:host].should == @host
140
- @response[:host_ip].should == @host_ip
141
- @response[:query_time].should == @query_time
142
- @response[:lock_time].should == @lock_time
143
- @response[:rows_sent].should == @rows_sent
144
- @response[:rows_examined].should == @rows_examined
145
- @response[:sql].should == @sql.strip
141
+ expect(@response[:date].to_i).to eq(@date.to_i)
142
+ expect(@response[:user]).to eq(@user)
143
+ expect(@response[:host]).to eq(@host)
144
+ expect(@response[:host_ip]).to eq(@host_ip)
145
+ expect(@response[:query_time]).to eq(@query_time)
146
+ expect(@response[:lock_time]).to eq(@lock_time)
147
+ expect(@response[:rows_sent]).to eq(@rows_sent)
148
+ expect(@response[:rows_examined]).to eq(@rows_examined)
149
+ expect(@response[:sql]).to eq(@sql.strip)
146
150
  end
147
151
  end
148
152
  end
@@ -167,15 +171,15 @@ use webtie;
167
171
  end
168
172
 
169
173
  it "should have expected values" do
170
- @response[:date].to_s.should == "2011-10-03 14:17:38 +0900"
171
- @response[:user].should == @user
172
- @response[:host].should == @host
173
- @response[:host_ip].should == @host_ip
174
- @response[:query_time].should == @query_time
175
- @response[:lock_time].should == @lock_time
176
- @response[:rows_sent].should == @rows_sent
177
- @response[:rows_examined].should == @rows_examined
178
- @response[:sql].should == @sql.strip
174
+ expect(@response[:date].utc.to_s).to eq("2011-10-03 05:17:38 UTC")
175
+ expect(@response[:user]).to eq(@user)
176
+ expect(@response[:host]).to eq(@host)
177
+ expect(@response[:host_ip]).to eq(@host_ip)
178
+ expect(@response[:query_time]).to eq(@query_time)
179
+ expect(@response[:lock_time]).to eq(@lock_time)
180
+ expect(@response[:rows_sent]).to eq(@rows_sent)
181
+ expect(@response[:rows_examined]).to eq(@rows_examined)
182
+ expect(@response[:sql]).to eq(@sql.strip)
179
183
  end
180
184
  end
181
185
 
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,9 @@
1
- $LOAD_PATH.unshift File.expand_path("../", __FILE__)
2
- $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
1
+ require "coveralls"
2
+ Coveralls.wear!
3
3
 
4
4
  require "myslog"
5
+
6
+ RSpec.configure do |config|
7
+ config.color = true
8
+ config.run_all_when_everything_filtered = true
9
+ end
metadata CHANGED
@@ -1,27 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myslog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - taka84u9
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-13 00:00:00.000000000 Z
11
+ date: 2015-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: rspec
15
43
  requirement: !ruby/object:Gem::Requirement
16
44
  requirements:
17
- - - '>='
45
+ - - ">="
18
46
  - !ruby/object:Gem::Version
19
47
  version: '0'
20
48
  type: :development
21
49
  prerelease: false
22
50
  version_requirements: !ruby/object:Gem::Requirement
23
51
  requirements:
24
- - - '>='
52
+ - - ">="
25
53
  - !ruby/object:Gem::Version
26
54
  version: '0'
27
55
  description: MySQL slow query parser.
@@ -31,14 +59,16 @@ executables: []
31
59
  extensions: []
32
60
  extra_rdoc_files: []
33
61
  files:
34
- - .gitignore
62
+ - ".coverrails.yml"
63
+ - ".gitignore"
64
+ - ".travis.yml"
35
65
  - Gemfile
36
- - Gemfile.lock
66
+ - LICENSE
37
67
  - README.md
38
68
  - Rakefile
39
69
  - lib/myslog.rb
40
70
  - myslog.gemspec
41
- - spec/myslog.rb
71
+ - spec/myslog_spec.rb
42
72
  - spec/spec_helper.rb
43
73
  homepage: https://github.com/taka84u9/myslog
44
74
  licenses: []
@@ -49,21 +79,19 @@ require_paths:
49
79
  - lib
50
80
  required_ruby_version: !ruby/object:Gem::Requirement
51
81
  requirements:
52
- - - '>='
82
+ - - ">="
53
83
  - !ruby/object:Gem::Version
54
84
  version: '0'
55
85
  required_rubygems_version: !ruby/object:Gem::Requirement
56
86
  requirements:
57
- - - '>='
87
+ - - ">="
58
88
  - !ruby/object:Gem::Version
59
89
  version: '0'
60
90
  requirements: []
61
91
  rubyforge_project:
62
- rubygems_version: 2.1.11
92
+ rubygems_version: 2.2.2
63
93
  signing_key:
64
94
  specification_version: 4
65
95
  summary: MySQL slow query parser.
66
- test_files:
67
- - spec/myslog.rb
68
- - spec/spec_helper.rb
96
+ test_files: []
69
97
  has_rdoc:
data/Gemfile.lock DELETED
@@ -1,24 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- myslog (0.0.1)
5
-
6
- GEM
7
- remote: http://rubygems.org/
8
- specs:
9
- diff-lcs (1.1.3)
10
- rspec (2.10.0)
11
- rspec-core (~> 2.10.0)
12
- rspec-expectations (~> 2.10.0)
13
- rspec-mocks (~> 2.10.0)
14
- rspec-core (2.10.1)
15
- rspec-expectations (2.10.0)
16
- diff-lcs (~> 1.1.3)
17
- rspec-mocks (2.10.1)
18
-
19
- PLATFORMS
20
- ruby
21
-
22
- DEPENDENCIES
23
- myslog!
24
- rspec