peek-query_reviewer 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in peek-query_reviewer.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Will Farrington
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # Peek::QueryReviewer
2
+
3
+ Peek into your MySQL queries!
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'peek-query_reviewer'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install peek-query_reviewer
18
+
19
+ ## Usage
20
+
21
+ ``` ruby
22
+ # app/controllers/application_controller.rb
23
+ def query_reviewer_enabled?
24
+ current_user && cookies[:query_review_enabled]
25
+ end
26
+ ```
27
+
28
+ # config/initializers/peek.rb
29
+ Peek.into Peek::Views::QueryReviewer
30
+ ```
31
+
32
+ ``` javascript
33
+ # app/assets/javascripts/application.js
34
+ //= require jquery
35
+ //= require jquery.cookie
36
+ //= require peek/views/query_reviewer
37
+ ```
38
+
39
+ ``` scss
40
+ # app/assets/stylesheets/application.scss
41
+ #= require peek/views/query_reviewer
42
+ ```
43
+
44
+ ## Contributing
45
+
46
+ 1. Fork it
47
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
48
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
49
+ 4. Push to the branch (`git push origin my-new-feature`)
50
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,15 @@
1
+ $(document).on 'peek:update', ->
2
+ $('a.query_reviewer_toggle').on 'click', ->
3
+ $('#query_reviewer_pane').toggle()
4
+
5
+ $('a.enable_query_reviewer_button').on 'click', ->
6
+ $.cookie 'query_review_enabled', '1', path: '/'
7
+ $('a.enable_query_reviewer_button').text 'Success! Reloading page…'
8
+ document.location.reload()
9
+ false
10
+
11
+ $('a.disable_query_reviewer_button').on 'click', ->
12
+ $.cookie 'query_review_enabled', null, path: '/'
13
+ $('a.disable_query_reviewer_button').text 'Success! Reloading page…'
14
+ document.location.reload()
15
+ false
@@ -0,0 +1,156 @@
1
+ #peek-view-mysql2 {
2
+ a {
3
+ color: #fff;
4
+ }
5
+ }
6
+
7
+ #query_reviewer_pane {
8
+ padding: 0 0 20px 0;
9
+ color: #748490;
10
+ background: #1c2022;
11
+ border-bottom: 1px solid #333;
12
+
13
+ a.minibutton {
14
+ background-color: rgb(48, 114, 179);
15
+ background-image: linear-gradient(rgb(89, 155, 205), rgb(48, 114, 179));
16
+ background-repeat: repeat-x;
17
+ border-radius: 6px;
18
+ border: 1px solid rgb(42, 101, 160);
19
+ box-shadow: none;
20
+ color: #fff;
21
+ cursor: pointer;
22
+ font-weight: bold;
23
+ height: 32px;
24
+ line-height: 32px;
25
+ outline-color: rgb(255, 255, 255);
26
+ padding-bottom: 4px;
27
+ padding-left: 10px;
28
+ padding-right: 10px;
29
+ padding-top: 4px;
30
+ text-decoration: none;
31
+ text-shadow: rgba(0, 0, 0, 0.247059) 0px -1px 0px;
32
+ }
33
+
34
+ .inner {
35
+ width: 80%;
36
+ margin: 0 auto;
37
+ overflow: auto;
38
+ }
39
+
40
+ h1 {
41
+ margin: 10px 0;
42
+ font-size: 20px;
43
+ font-weight: normal;
44
+ color: #555;
45
+ text-shadow: 1px 1px 1px rgba(0,0,0,1.0);
46
+ }
47
+
48
+ ul.big-nums {
49
+ margin: 10px 0 20px 0;
50
+ list-style-type: none;
51
+
52
+ &>li {
53
+ margin: 0 20px 0 0;
54
+ display: inline-block;
55
+ color: #999;
56
+ font-size: 13px;
57
+ font-weight: 300;
58
+
59
+ strong {
60
+ font-size: 48px;
61
+ font-weight: bold;
62
+ color: #fff;
63
+ text-shadow: 1px 1px 4px rgba(0,0,0, 1.0);
64
+ }
65
+ }
66
+ }
67
+
68
+ .query-container {
69
+ margin: 45px 0 0 0;
70
+ background: #16191b;
71
+ border: 1px solid #1D2124;
72
+ border-radius: 5px;
73
+ }
74
+ ul.big-nums + .query-container {
75
+ margin-top: 25px;
76
+ }
77
+
78
+ h2 {
79
+ margin: 0;
80
+ padding: 5px 10px 8px 10px;
81
+ color: #ccc;
82
+ font-size: 24px;
83
+ font-weight: normal;
84
+ line-height: 32px;
85
+ background: #000;
86
+ border-top-left-radius: 5px;
87
+ border-top-right-radius: 5px;
88
+
89
+ .mega-icon {
90
+ position: relative;
91
+ top: 4px;
92
+ }
93
+
94
+ &.warning {
95
+ color: #edeaa7;
96
+ }
97
+
98
+ &.error {
99
+ color: #ff0000;
100
+ }
101
+ }
102
+
103
+ ul.queries {
104
+ &>li {
105
+ padding: 5px 10px;
106
+ border-top: 1px solid #1D2124;
107
+ }
108
+ }
109
+
110
+ table {
111
+ margin: 10px 0;
112
+ width: 100%;
113
+ border-collapse: collapse;
114
+ border: 1px solid #333;
115
+ border-radius: 3px;
116
+ font-size: 11px;
117
+
118
+ td {
119
+ padding: 4px;
120
+ border: 1px solid #333;
121
+ border-right: none;
122
+ border-bottom: none;
123
+ vertical-align: top;
124
+ }
125
+
126
+ th {
127
+ padding: 5px 10px;
128
+ text-transform: uppercase;
129
+ color: #fff;
130
+ background: #1C2022;
131
+ }
132
+ }
133
+
134
+ .sql {
135
+ padding: 4px;
136
+ font-family: 'Menlo', 'Monaco', 'monospace';
137
+ font-size: 12px;
138
+ color: #ccc;
139
+ background: #000;
140
+ border-radius: 3px;
141
+ }
142
+
143
+ p>b {
144
+ color: #fff;
145
+ }
146
+
147
+ p.disabled-warning {
148
+ margin: 20px 0 0 0;
149
+ }
150
+ }
151
+
152
+ ul.stats .query_reviewer-active{
153
+ font-size: 14px;
154
+ font-weight: bold;
155
+ color: #FFDA81;
156
+ }
File without changes
@@ -0,0 +1,13 @@
1
+ <% if query_reviewer_enabled? %>
2
+ <div id="query_reviewer_pane" class="peek_pane collapsed">
3
+ <div class="inner">
4
+ <p>MySQL profiling enabled. <a href="#" class="disable_query_reviewer_button minibutton blue">Disable analysis report</a></p>
5
+ </div>
6
+ </div>
7
+ <% else %>
8
+ <div id="query_reviewer_pane" class="peek_pane collapsed" style="display: none;">
9
+ <div class="inner">
10
+ <p class="disabled-warning">MySQL profiling disabled. <a href="#" class="enable_query_reviewer_button minibutton blue">Enable analysis report</a></p>
11
+ </div>
12
+ </div>
13
+ <% end %>
@@ -0,0 +1,2 @@
1
+ require "peek/views/query_reviewer"
2
+ require "peek-query_reviewer/railtie"
@@ -0,0 +1,6 @@
1
+ module Peek
2
+ module QueryReviewer
3
+ class Railtie < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Peek
2
+ module Views
3
+ class QueryReviewer < View
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,20 @@
1
+ # coding: utf-8
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "peek-query_reviewer"
5
+ spec.version = "0.0.1"
6
+ spec.authors = ["Will Farrington"]
7
+ spec.email = ["wfarr@github.com"]
8
+ spec.description = %q{Peek into your MySQL queries}
9
+ spec.summary = %q{Peek into your MySQL queries}
10
+ spec.homepage = "https://github.com/wfarr/peek-query_reviewer"
11
+ spec.license = "MIT"
12
+
13
+ spec.files = `git ls-files`.split($/)
14
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.require_paths = ["lib"]
17
+
18
+ spec.add_development_dependency "bundler", "~> 1.3"
19
+ spec.add_development_dependency "rake"
20
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: peek-query_reviewer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Will Farrington
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: Peek into your MySQL queries
47
+ email:
48
+ - wfarr@github.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - .gitignore
54
+ - Gemfile
55
+ - LICENSE.txt
56
+ - README.md
57
+ - Rakefile
58
+ - app/assets/javascripts/peek/views/query_reviewer.coffee
59
+ - app/assets/stylesheets/peek/views/query_reviewer.scss
60
+ - app/views/peek/views/_query_reviewer.html.erb
61
+ - app/views/peek/views/query_reviewer/_box.html.erb
62
+ - lib/peek-query_reviewer.rb
63
+ - lib/peek-query_reviewer/railtie.rb
64
+ - lib/peek/views/query_reviewer.rb
65
+ - peek-query_reviewer.gemspec
66
+ homepage: https://github.com/wfarr/peek-query_reviewer
67
+ licenses:
68
+ - MIT
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 1.8.23
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: Peek into your MySQL queries
91
+ test_files: []