log_magic 0.0.10 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/log_magic +16 -9
- data/lib/log_magic.rb +1 -0
- data/lib/log_magic/explainer_templates/mysql/IS NULL.haml +2 -0
- data/lib/log_magic/explainer_templates/mysql/ORDER BY.haml +2 -0
- data/lib/log_magic/explainers/mysql/is_null_explainer.rb +7 -0
- data/lib/log_magic/explainers/mysql/ordery_by_explainer.rb +7 -0
- data/lib/log_magic/explainers/mysql/query_explainer.rb +2 -0
- data/lib/log_magic/utils/port_utils.rb +24 -0
- metadata +6 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e299670152c7d651a2f1720a1727c50aba82cdbe
|
4
|
+
data.tar.gz: cc43f159e7fc1e3cc53695f74a4e788b3f46e57d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c819bc1d62d6ed760ba3b9f1d5845c9094644308f0f4d2bfdb272a40dfa823a9a5bb7583f536e5b4df5240b41e5ff6d949039888f98b0d50815a783c3f9ebe26
|
7
|
+
data.tar.gz: a7adfac933522bdf12fd13be573db120851919b4c6fccb8b6b1d1fa34dd94e3c821515fc65b5ed276d3af353ad4497b751405fceca6bcdea91749d088a3172c1
|
data/bin/log_magic
CHANGED
@@ -2,25 +2,32 @@
|
|
2
2
|
|
3
3
|
require 'log_magic'
|
4
4
|
|
5
|
+
unless LogMagic::PortUtils.port_open?('127.0.0.1', 6379)
|
6
|
+
redis_server_pid = fork do
|
7
|
+
`redis-server`
|
8
|
+
end
|
9
|
+
Process.detach(redis_server_pid)
|
10
|
+
end
|
11
|
+
|
5
12
|
begin
|
6
13
|
log_magic = LogMagic.new(ARGV[0])
|
7
14
|
|
8
|
-
|
9
|
-
|
10
|
-
|
15
|
+
searchkick_server_pid = fork do
|
16
|
+
explainer_server_instance = LogMagic::SearchkickExplainer.new
|
17
|
+
explainer_server_instance.start
|
11
18
|
end
|
12
|
-
Process.detach(
|
19
|
+
Process.detach(searchkick_server_pid)
|
13
20
|
|
14
|
-
|
15
|
-
|
16
|
-
|
21
|
+
mysql_server_pid = fork do
|
22
|
+
explainer_server_instance = LogMagic::MySqlExplainer.new
|
23
|
+
explainer_server_instance.start
|
17
24
|
end
|
18
|
-
Process.detach(
|
25
|
+
Process.detach(mysql_server_pid)
|
19
26
|
|
20
27
|
log_magic.initialize_listener
|
21
28
|
log_magic.start
|
22
29
|
ensure
|
23
|
-
[
|
30
|
+
[mysql_server_pid, searchkick_server_pid].each do |server|
|
24
31
|
`kill -9 #{server}` unless server.nil?
|
25
32
|
end
|
26
33
|
end
|
data/lib/log_magic.rb
CHANGED
@@ -16,6 +16,8 @@ class LogMagic::MySqlExplainer::QueryExplainerSection
|
|
16
16
|
|
17
17
|
def explainer_section_classes
|
18
18
|
[
|
19
|
+
::LogMagic::MySqlExplainer::IsNullExplainerSection,
|
20
|
+
::LogMagic::MySqlExplainer::OrderByExplainerSection,
|
19
21
|
::LogMagic::MySqlExplainer::WhereExplainerSection,
|
20
22
|
::LogMagic::MySqlExplainer::SelectExplainerSection
|
21
23
|
]
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'socket'
|
2
|
+
require 'timeout'
|
3
|
+
|
4
|
+
class LogMagic
|
5
|
+
module PortUtils
|
6
|
+
# copied from http://stackoverflow.com/questions/517219/ruby-see-if-a-port-is-open
|
7
|
+
def self.port_open?(ip, port)
|
8
|
+
begin
|
9
|
+
Timeout::timeout(1) do
|
10
|
+
begin
|
11
|
+
s = TCPSocket.new(ip, port)
|
12
|
+
s.close
|
13
|
+
return true
|
14
|
+
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
|
15
|
+
return false
|
16
|
+
end
|
17
|
+
end
|
18
|
+
rescue Timeout::Error
|
19
|
+
end
|
20
|
+
|
21
|
+
return false
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: log_magic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel Korfmann
|
@@ -134,6 +134,8 @@ files:
|
|
134
134
|
- bin/rebuild
|
135
135
|
- lib/log_magic.rb
|
136
136
|
- lib/log_magic/explainer_templates/mysql.haml
|
137
|
+
- lib/log_magic/explainer_templates/mysql/IS NULL.haml
|
138
|
+
- lib/log_magic/explainer_templates/mysql/ORDER BY.haml
|
137
139
|
- lib/log_magic/explainer_templates/mysql/SELECT.haml
|
138
140
|
- lib/log_magic/explainer_templates/mysql/WHERE.haml
|
139
141
|
- lib/log_magic/explainer_templates/mysql/query.haml
|
@@ -148,6 +150,8 @@ files:
|
|
148
150
|
- lib/log_magic/explainer_templates/searchkick/query.haml
|
149
151
|
- lib/log_magic/explainer_templates/searchkick/settings.haml
|
150
152
|
- lib/log_magic/explainers/base_explainer.rb
|
153
|
+
- lib/log_magic/explainers/mysql/is_null_explainer.rb
|
154
|
+
- lib/log_magic/explainers/mysql/ordery_by_explainer.rb
|
151
155
|
- lib/log_magic/explainers/mysql/query_explainer.rb
|
152
156
|
- lib/log_magic/explainers/mysql/select_explainer.rb
|
153
157
|
- lib/log_magic/explainers/mysql/where_explainer.rb
|
@@ -173,6 +177,7 @@ files:
|
|
173
177
|
- lib/log_magic/renderers/hover_renderer.rb
|
174
178
|
- lib/log_magic/util_templates/hovering.haml
|
175
179
|
- lib/log_magic/utils/json_utils.rb
|
180
|
+
- lib/log_magic/utils/port_utils.rb
|
176
181
|
- lib/log_magic/utils/templating_utils.rb
|
177
182
|
homepage: https://github.com/ManuelArno/log_magic
|
178
183
|
licenses:
|