query_reviewer 0.1.6 → 0.1.7
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.
data/lib/query_reviewer.rb
CHANGED
@@ -12,9 +12,9 @@ module QueryReviewer
|
|
12
12
|
CONFIGURATION.merge!(default_config["all"] || {})
|
13
13
|
CONFIGURATION.merge!(default_config[Rails.env || "test"] || {})
|
14
14
|
|
15
|
-
app_config_file = Rails.root
|
15
|
+
app_config_file = File.join(Rails.root, 'config/query_reviewer.yml')
|
16
16
|
|
17
|
-
if
|
17
|
+
if File.file?(app_config_file)
|
18
18
|
app_config = YAML.load(ERB.new(IO.read(app_config_file)).result)
|
19
19
|
CONFIGURATION.merge!(app_config["all"] || {})
|
20
20
|
CONFIGURATION.merge!(app_config[Rails.env || "test"] || {})
|
@@ -30,8 +30,6 @@ module QueryReviewer
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def add_query_output_to_view(total_time)
|
33
|
-
return unless Thread.current["query_reviewer_enabled"]
|
34
|
-
|
35
33
|
if request.xhr?
|
36
34
|
if cookies["query_review_enabled"]
|
37
35
|
if !response.content_type || response.content_type.include?("text/html")
|
@@ -41,7 +39,7 @@ module QueryReviewer
|
|
41
39
|
end
|
42
40
|
end
|
43
41
|
else
|
44
|
-
if response.body.is_a?(String) && response.body.match(/<\/body>/i)
|
42
|
+
if response.body.is_a?(String) && response.body.match(/<\/body>/i)
|
45
43
|
idx = (response.body =~ /<\/body>/i)
|
46
44
|
html = query_review_output(false, total_time)
|
47
45
|
response.body = response.body.insert(idx, html)
|
@@ -50,8 +48,8 @@ module QueryReviewer
|
|
50
48
|
end
|
51
49
|
|
52
50
|
def perform_action_with_query_review(*args)
|
53
|
-
|
54
|
-
|
51
|
+
return unless (CONFIGURATION["enabled"] == true and cookies["query_review_enabled"]) ||
|
52
|
+
(CONFIGURATION["enabled"] == "based_on_session" and session["query_review_enabled"])
|
55
53
|
|
56
54
|
t1 = Time.now
|
57
55
|
r = defined?(Rails::Railtie) ? process_action_without_query_review(*args) : perform_action_without_query_review(*args)
|
@@ -1,2 +1,2 @@
|
|
1
1
|
<p>SQL analysis has been disabled for you. A cookie must be set to enable analysis. This generally slows down your browser, so it's only recommended for users analyzing SQL queries.</p>
|
2
|
-
<p id="query_review_enable_link"><b><a href="#" onclick="createCookie('query_review_enabled', '1'); query_review_hide('query_review_enable_link'); alert('Cookie successfully set.');">
|
2
|
+
<p id="query_review_enable_link"><b><a href="#" onclick="createCookie('query_review_enabled', '1'); query_review_hide('query_review_enable_link'); alert('Cookie successfully set.');">Enable it</a> on next page load and from now on.</b></p>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: query_reviewer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Runs explain before each select query and displays results in an overlayed
|
15
15
|
div
|
@@ -50,7 +50,8 @@ files:
|
|
50
50
|
- lib/query_reviewer/views/query_review_box_helper.rb
|
51
51
|
- lib/query_reviewer.rb
|
52
52
|
homepage: https://github.com/nesquena/query_reviewer
|
53
|
-
licenses:
|
53
|
+
licenses:
|
54
|
+
- MIT
|
54
55
|
post_install_message:
|
55
56
|
rdoc_options: []
|
56
57
|
require_paths:
|