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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a9abdbd914641860a5b7e2be230902f925bf0095
4
- data.tar.gz: 99afd230f8c3023a9e5cdaed8b900ee214f7885e
3
+ metadata.gz: e299670152c7d651a2f1720a1727c50aba82cdbe
4
+ data.tar.gz: cc43f159e7fc1e3cc53695f74a4e788b3f46e57d
5
5
  SHA512:
6
- metadata.gz: aa4fc3271f0babc80b2d3180369100d81fbb343e3db85557be58a3273c5688225afc501c4eabe0a719aec0fdc1f55dd16c00643e8ea8fc6ed414a7167ba1a55c
7
- data.tar.gz: 5527270c00d24bfbeecf3ac47f365f955a1e000059ab0fb1810ebbff1f036533270aac2bb24b5d15c34a6758f3b7b11190eedb24af10f19caece5ee48b5c5cf8
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
- searchkick_server = fork do
9
- explainer_server = LogMagic::SearchkickExplainer.new
10
- explainer_server.start
15
+ searchkick_server_pid = fork do
16
+ explainer_server_instance = LogMagic::SearchkickExplainer.new
17
+ explainer_server_instance.start
11
18
  end
12
- Process.detach(searchkick_server)
19
+ Process.detach(searchkick_server_pid)
13
20
 
14
- mysql_server = fork do
15
- explainer_server = LogMagic::MySqlExplainer.new
16
- explainer_server.start
21
+ mysql_server_pid = fork do
22
+ explainer_server_instance = LogMagic::MySqlExplainer.new
23
+ explainer_server_instance.start
17
24
  end
18
- Process.detach(mysql_server)
25
+ Process.detach(mysql_server_pid)
19
26
 
20
27
  log_magic.initialize_listener
21
28
  log_magic.start
22
29
  ensure
23
- [mysql_server, searchkick_server].each do |server|
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
@@ -53,6 +53,7 @@ require 'active_support/all'
53
53
 
54
54
  require 'log_magic/utils/json_utils'
55
55
  require 'log_magic/utils/templating_utils'
56
+ require 'log_magic/utils/port_utils'
56
57
 
57
58
  require 'log_magic/log_listener'
58
59
 
@@ -0,0 +1,2 @@
1
+ %a{href: 'https://www.techonthenet.com/mysql/is_null.php' }
2
+ IS NULL
@@ -0,0 +1,2 @@
1
+ %a{href: 'http://www.w3schools.com/sql/sql_orderby.asp'}
2
+ ORDER BY
@@ -0,0 +1,7 @@
1
+ class LogMagic::MySqlExplainer::IsNullExplainerSection
2
+ include ::LogMagic::TemplatingUtils
3
+
4
+ def term_name
5
+ 'IS NULL'
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ class LogMagic::MySqlExplainer::OrderByExplainerSection
2
+ include ::LogMagic::TemplatingUtils
3
+
4
+ def term_name
5
+ 'ORDER BY'
6
+ end
7
+ end
@@ -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.10
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: