peek 0.2.0 → 1.0.1
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 +4 -4
- data/.travis.yml +12 -2
- data/CHANGELOG.md +8 -0
- data/Gemfile +4 -4
- data/Gemfile-rails42 +27 -0
- data/README.md +12 -11
- data/Rakefile +1 -1
- data/app/assets/javascripts/peek.js +86 -0
- data/app/assets/stylesheets/peek.scss +3 -6
- data/app/controllers/peek/results_controller.rb +3 -3
- data/app/views/peek/_bar.html.erb +1 -1
- data/config/routes.rb +1 -1
- data/lib/peek.rb +2 -2
- data/lib/peek/controller_helpers.rb +1 -1
- data/lib/peek/version.rb +1 -1
- data/peek.gemspec +1 -2
- data/test/dummy/app/assets/javascripts/application.js +2 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -1
- data/test/dummy/app/controllers/home_controller.rb +8 -1
- data/test/dummy/app/views/home/show.html.erb +3 -0
- data/test/dummy/app/views/peek/_test_view.html.erb +1 -0
- data/test/dummy/config/initializers/peek.rb +3 -0
- data/test/dummy/config/routes.rb +6 -1
- data/test/dummy/lib/test_view.rb +20 -0
- data/test/peek_test.rb +4 -4
- metadata +13 -22
- data/app/assets/images/peek/bar/development.gif +0 -0
- data/app/assets/images/peek/bar/production.gif +0 -0
- data/app/assets/images/peek/bar/staging.gif +0 -0
- data/app/assets/javascripts/peek.coffee +0 -71
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbed54bce4732314dfcdd567b7dc6a6e1a9239d8
|
4
|
+
data.tar.gz: 1f88f52c9afe97f73d1eed6b92146ee052d638f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8c62b3b22c484f9b9df0de921df6419f66b3aeb81cea9574cbb217776c5e0d6ed7db4753d33e9933cf6446232e717a48056272acedbde3fe5a9db4691408d7d
|
7
|
+
data.tar.gz: a68133cfbbc341dbb4fe1518df040748fb2882c8ff326ef14b786ea88db930a0ab0c13e5c48fcaa70560253d724732ce16d69ec0e553f18deca6f2a28945a97c
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -82,3 +82,11 @@
|
|
82
82
|
- Add dependency for coffee-rails for Rails. - [#80](https://github.com/peek/peek/pull/80) [@cllns](https://github.com/cllns)
|
83
83
|
- Fix deprecation warnings for `helper_method` for future versions of Rails past Rails v5. - [#85](https://github.com/peek/peek/pull/85) [@mgrachev](https://github.com/mgrachev)
|
84
84
|
- Listen to Turbolinks v5 `turbolinks:load` JS event to trigger peek updates. - [#88](https://github.com/peek/peek/pull/88) [@lucasmazza](https://github.com/lucasmazza)
|
85
|
+
|
86
|
+
# 1.0
|
87
|
+
|
88
|
+
- Rails 4+ compatibility
|
89
|
+
- Update `before_filter` to `before_action` @mkcode
|
90
|
+
- Replace GIFs with colors @tarebyte
|
91
|
+
- Remove CoffeeScript @dewski
|
92
|
+
- Use Ruby JSON syntax for hashes
|
data/Gemfile
CHANGED
@@ -4,18 +4,18 @@ source 'https://rubygems.org'
|
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
gem 'rake'
|
7
|
-
gem 'json', '~>
|
7
|
+
gem 'json', '~> 2.0', '>= 2.0.2'
|
8
8
|
|
9
|
-
gem 'rails', '~>
|
9
|
+
gem 'rails', '~> 5.0', '>= 5.0.0.1'
|
10
10
|
|
11
11
|
# Use SCSS for stylesheets
|
12
|
-
gem 'sass-rails', '~>
|
12
|
+
gem 'sass-rails', '~> 5.0'
|
13
13
|
|
14
14
|
# Use Uglifier as compressor for JavaScript assets
|
15
15
|
gem 'uglifier', '>= 1.3.0'
|
16
16
|
|
17
17
|
# Use CoffeeScript for .js.coffee assets and views
|
18
|
-
gem 'coffee-rails', '~> 4.
|
18
|
+
gem 'coffee-rails', '~> 4.2'
|
19
19
|
|
20
20
|
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
21
21
|
# gem 'therubyracer', platforms: :ruby
|
data/Gemfile-rails42
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in peek.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
gem 'rake'
|
7
|
+
gem 'json', '~> 1.8.3'
|
8
|
+
|
9
|
+
gem 'rails', '~> 4.2.7.1'
|
10
|
+
|
11
|
+
# Use SCSS for stylesheets
|
12
|
+
gem 'sass-rails', '~> 5.0.0'
|
13
|
+
|
14
|
+
# Use Uglifier as compressor for JavaScript assets
|
15
|
+
gem 'uglifier', '>= 1.3.0'
|
16
|
+
|
17
|
+
# Use CoffeeScript for .js.coffee assets and views
|
18
|
+
gem 'coffee-rails', '~> 4.1.0'
|
19
|
+
|
20
|
+
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
21
|
+
# gem 'therubyracer', platforms: :ruby
|
22
|
+
|
23
|
+
# Use jquery as the JavaScript library
|
24
|
+
gem 'jquery-rails'
|
25
|
+
|
26
|
+
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
27
|
+
gem 'turbolinks'
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Peek
|
2
2
|
|
3
|
-
[](https://travis-ci.org/peek/peek) [](http://badge.fury.io/rb/peek) [](http://inch-ci.org/github/peek/peek)
|
4
4
|
|
5
5
|
Take a peek into your Rails application.
|
6
6
|
|
@@ -34,7 +34,7 @@ file:
|
|
34
34
|
```ruby
|
35
35
|
Some::Application.routes.draw do
|
36
36
|
mount Peek::Railtie => '/peek'
|
37
|
-
root :
|
37
|
+
root to: 'home#show'
|
38
38
|
end
|
39
39
|
```
|
40
40
|
|
@@ -42,7 +42,7 @@ To pick which views you want to see in your Peek bar, just create a file at
|
|
42
42
|
`config/initializers/peek.rb` that has a list of the views you'd like to include:
|
43
43
|
|
44
44
|
```ruby
|
45
|
-
Peek.into Peek::Views::Git, :
|
45
|
+
Peek.into Peek::Views::Git, nwo: 'github/janky'
|
46
46
|
Peek.into Peek::Views::Mysql2
|
47
47
|
Peek.into Peek::Views::Redis
|
48
48
|
Peek.into Peek::Views::Dalli
|
@@ -125,8 +125,8 @@ Peeked::Application.configure do
|
|
125
125
|
|
126
126
|
# Redis with options
|
127
127
|
config.peek.adapter = :redis, {
|
128
|
-
:
|
129
|
-
:
|
128
|
+
client: Redis.new,
|
129
|
+
expires_in: 60 * 30 # => 30 minutes in seconds
|
130
130
|
}
|
131
131
|
|
132
132
|
# Memcache with no options
|
@@ -134,8 +134,8 @@ Peeked::Application.configure do
|
|
134
134
|
|
135
135
|
# Memcache with options
|
136
136
|
config.peek.adapter = :memcache, {
|
137
|
-
:
|
138
|
-
:
|
137
|
+
client: Dalli::Client.new,
|
138
|
+
expires_in: 60 * 30 # => 30 minutes in seconds
|
139
139
|
}
|
140
140
|
|
141
141
|
# Elasticsearch with no options
|
@@ -143,10 +143,10 @@ Peeked::Application.configure do
|
|
143
143
|
|
144
144
|
# Elasticsearch with options
|
145
145
|
config.peek.adapter = :elasticsearch, {
|
146
|
-
:
|
147
|
-
:
|
148
|
-
:
|
149
|
-
:
|
146
|
+
client: Elasticsearch::Client.new,
|
147
|
+
expires_in: 60 * 30, # => 30 minutes in seconds
|
148
|
+
index: 'peek_requests_index',
|
149
|
+
type: 'peek_request'
|
150
150
|
}
|
151
151
|
|
152
152
|
# ...
|
@@ -203,6 +203,7 @@ end
|
|
203
203
|
- [peek-dalli](https://github.com/peek/peek-dalli)
|
204
204
|
- [peek-delayed_job](https://github.com/18F/peek-delayed_job)
|
205
205
|
- [peek-faraday](https://github.com/grk/peek-faraday)
|
206
|
+
- [peek-flexirest](https://github.com/andyjeffries/peek-flexirest)
|
206
207
|
- [peek-gc](https://github.com/peek/peek-gc)
|
207
208
|
- [peek-git](https://github.com/peek/peek-git)
|
208
209
|
- [peek-host](https://github.com/jacobbednarz/peek-host)
|
data/Rakefile
CHANGED
@@ -0,0 +1,86 @@
|
|
1
|
+
//= require peek/vendor/jquery.tipsy
|
2
|
+
|
3
|
+
var requestId;
|
4
|
+
|
5
|
+
requestId = null;
|
6
|
+
|
7
|
+
(function($) {
|
8
|
+
var fetchRequestResults, getRequestId, initializeTipsy, peekEnabled, toggleBar, updatePerformanceBar;
|
9
|
+
getRequestId = function() {
|
10
|
+
if (requestId != null) {
|
11
|
+
return requestId;
|
12
|
+
} else {
|
13
|
+
return $('#peek').data('request-id');
|
14
|
+
}
|
15
|
+
};
|
16
|
+
peekEnabled = function() {
|
17
|
+
return $('#peek').length;
|
18
|
+
};
|
19
|
+
updatePerformanceBar = function(results) {
|
20
|
+
var key, label;
|
21
|
+
for (key in results.data) {
|
22
|
+
for (label in results.data[key]) {
|
23
|
+
$("[data-defer-to=" + key + "-" + label + "]").text(results.data[key][label]);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
return $(document).trigger('peek:render', [getRequestId(), results]);
|
27
|
+
};
|
28
|
+
initializeTipsy = function() {
|
29
|
+
return $('#peek .peek-tooltip, #peek .tooltip').each(function() {
|
30
|
+
var el, gravity;
|
31
|
+
el = $(this);
|
32
|
+
gravity = el.hasClass('rightwards') || el.hasClass('leftwards') ? $.fn.tipsy.autoWE : $.fn.tipsy.autoNS;
|
33
|
+
return el.tipsy({
|
34
|
+
gravity: gravity
|
35
|
+
});
|
36
|
+
});
|
37
|
+
};
|
38
|
+
toggleBar = function(event) {
|
39
|
+
var wrapper;
|
40
|
+
if ($(event.target).is(':input')) {
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
if (event.which === 96 && !event.metaKey) {
|
44
|
+
wrapper = $('#peek');
|
45
|
+
if (wrapper.hasClass('disabled')) {
|
46
|
+
wrapper.removeClass('disabled');
|
47
|
+
return document.cookie = "peek=true; path=/";
|
48
|
+
} else {
|
49
|
+
wrapper.addClass('disabled');
|
50
|
+
return document.cookie = "peek=false; path=/";
|
51
|
+
}
|
52
|
+
}
|
53
|
+
};
|
54
|
+
fetchRequestResults = function() {
|
55
|
+
return $.ajax('/peek/results', {
|
56
|
+
data: {
|
57
|
+
request_id: getRequestId()
|
58
|
+
},
|
59
|
+
success: function(data, textStatus, xhr) {
|
60
|
+
return updatePerformanceBar(data);
|
61
|
+
},
|
62
|
+
error: function(xhr, textStatus, error) {}
|
63
|
+
});
|
64
|
+
};
|
65
|
+
$(document).on('keypress', toggleBar);
|
66
|
+
$(document).on('peek:update', initializeTipsy);
|
67
|
+
$(document).on('peek:update', fetchRequestResults);
|
68
|
+
$(document).on('pjax:end', function(event, xhr, options) {
|
69
|
+
if (xhr != null) {
|
70
|
+
requestId = xhr.getResponseHeader('X-Request-Id');
|
71
|
+
}
|
72
|
+
if (peekEnabled()) {
|
73
|
+
return $(this).trigger('peek:update');
|
74
|
+
}
|
75
|
+
});
|
76
|
+
$(document).on('page:change turbolinks:load', function() {
|
77
|
+
if (peekEnabled()) {
|
78
|
+
return $(this).trigger('peek:update');
|
79
|
+
}
|
80
|
+
});
|
81
|
+
return $(function() {
|
82
|
+
if (peekEnabled()) {
|
83
|
+
return $(this).trigger('peek:update');
|
84
|
+
}
|
85
|
+
});
|
86
|
+
})(jQuery);
|
@@ -1,6 +1,3 @@
|
|
1
|
-
//= depend_on_asset 'peek/bar/production.gif'
|
2
|
-
//= depend_on_asset 'peek/bar/staging.gif'
|
3
|
-
//= depend_on_asset 'peek/bar/development.gif'
|
4
1
|
//= require peek/vendor/tipsy
|
5
2
|
|
6
3
|
#peek {
|
@@ -20,15 +17,15 @@
|
|
20
17
|
}
|
21
18
|
|
22
19
|
&.production {
|
23
|
-
background:
|
20
|
+
background-color: #222;
|
24
21
|
}
|
25
22
|
|
26
23
|
&.staging {
|
27
|
-
background:
|
24
|
+
background-color: #291430;
|
28
25
|
}
|
29
26
|
|
30
27
|
&.development {
|
31
|
-
background:
|
28
|
+
background-color: #4c1210;
|
32
29
|
}
|
33
30
|
|
34
31
|
.wrapper {
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module Peek
|
2
2
|
class ResultsController < ApplicationController
|
3
|
-
|
3
|
+
before_action :restrict_non_access
|
4
4
|
|
5
5
|
def show
|
6
6
|
respond_to do |format|
|
7
7
|
format.json do
|
8
8
|
if request.xhr?
|
9
|
-
render :
|
9
|
+
render json: Peek.adapter.get(params[:request_id])
|
10
10
|
else
|
11
|
-
render :
|
11
|
+
render nothing: true, status: :not_found
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
data/config/routes.rb
CHANGED
data/lib/peek.rb
CHANGED
data/lib/peek/version.rb
CHANGED
data/peek.gemspec
CHANGED
@@ -18,8 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ['lib']
|
20
20
|
|
21
|
-
gem.add_dependency 'railties', '>=
|
21
|
+
gem.add_dependency 'railties', '>= 4.0.0'
|
22
22
|
gem.add_dependency 'concurrent-ruby', '>= 0.9.0'
|
23
23
|
gem.add_dependency 'concurrent-ruby-ext', '>= 0.9.0'
|
24
|
-
gem.add_dependency 'coffee-rails'
|
25
24
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<strong><span data-defer-to="<%= view.defer_key %>-number">...</span></strong> number
|
data/test/dummy/config/routes.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'concurrent/atomics'
|
2
|
+
|
3
|
+
class TestView < Peek::Views::View
|
4
|
+
class << self
|
5
|
+
attr_accessor :counter
|
6
|
+
end
|
7
|
+
self.counter = Concurrent::AtomicReference.new(0)
|
8
|
+
|
9
|
+
def results
|
10
|
+
self.class.counter.update { |value| value + 1 }
|
11
|
+
|
12
|
+
{
|
13
|
+
number: self.class.counter.value
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
def partial_path
|
18
|
+
"peek/test_view"
|
19
|
+
end
|
20
|
+
end
|
data/test/peek_test.rb
CHANGED
@@ -37,19 +37,19 @@ describe Peek do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should be able to append views" do
|
40
|
-
Peek.into Staff, :
|
40
|
+
Peek.into Staff, username: 'dewski'
|
41
41
|
assert_kind_of Staff, Peek.views.first
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should be able to append views with options" do
|
45
|
-
Peek.into Staff, :
|
45
|
+
Peek.into Staff, username: 'dewski'
|
46
46
|
@staff = Peek.views.first
|
47
47
|
assert_kind_of Staff, @staff
|
48
48
|
assert_equal 'dewski', @staff.username
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should only return enabled views" do
|
52
|
-
Peek.into Staff, :
|
52
|
+
Peek.into Staff, username: false
|
53
53
|
assert_equal [], Peek.views
|
54
54
|
end
|
55
55
|
end
|
@@ -60,7 +60,7 @@ describe Peek do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should clear any current views" do
|
63
|
-
Peek.into Staff, :
|
63
|
+
Peek.into Staff, username: 'dewski'
|
64
64
|
assert_kind_of Staff, Peek.views.first
|
65
65
|
Peek.reset
|
66
66
|
assert_equal [], Peek.views
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garrett Bjerkhoel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 4.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: concurrent-ruby
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.9.0
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: coffee-rails
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
description: Take a peek into your Rails application.
|
70
56
|
email:
|
71
57
|
- me@garrettbjerkhoel.com
|
@@ -77,13 +63,11 @@ files:
|
|
77
63
|
- ".travis.yml"
|
78
64
|
- CHANGELOG.md
|
79
65
|
- Gemfile
|
66
|
+
- Gemfile-rails42
|
80
67
|
- LICENSE.txt
|
81
68
|
- README.md
|
82
69
|
- Rakefile
|
83
|
-
- app/assets/
|
84
|
-
- app/assets/images/peek/bar/production.gif
|
85
|
-
- app/assets/images/peek/bar/staging.gif
|
86
|
-
- app/assets/javascripts/peek.coffee
|
70
|
+
- app/assets/javascripts/peek.js
|
87
71
|
- app/assets/javascripts/peek/vendor/jquery.tipsy.js
|
88
72
|
- app/assets/stylesheets/peek.scss
|
89
73
|
- app/assets/stylesheets/peek/vendor/tipsy.scss
|
@@ -111,6 +95,7 @@ files:
|
|
111
95
|
- test/dummy/app/helpers/application_helper.rb
|
112
96
|
- test/dummy/app/views/home/show.html.erb
|
113
97
|
- test/dummy/app/views/layouts/application.html.erb
|
98
|
+
- test/dummy/app/views/peek/_test_view.html.erb
|
114
99
|
- test/dummy/bin/bundle
|
115
100
|
- test/dummy/bin/rails
|
116
101
|
- test/dummy/bin/rake
|
@@ -124,11 +109,13 @@ files:
|
|
124
109
|
- test/dummy/config/initializers/filter_parameter_logging.rb
|
125
110
|
- test/dummy/config/initializers/inflections.rb
|
126
111
|
- test/dummy/config/initializers/mime_types.rb
|
112
|
+
- test/dummy/config/initializers/peek.rb
|
127
113
|
- test/dummy/config/initializers/secret_token.rb
|
128
114
|
- test/dummy/config/initializers/session_store.rb
|
129
115
|
- test/dummy/config/initializers/wrap_parameters.rb
|
130
116
|
- test/dummy/config/locales/en.yml
|
131
117
|
- test/dummy/config/routes.rb
|
118
|
+
- test/dummy/lib/test_view.rb
|
132
119
|
- test/dummy/log/.keep
|
133
120
|
- test/dummy/public/404.html
|
134
121
|
- test/dummy/public/422.html
|
@@ -172,6 +159,7 @@ test_files:
|
|
172
159
|
- test/dummy/app/helpers/application_helper.rb
|
173
160
|
- test/dummy/app/views/home/show.html.erb
|
174
161
|
- test/dummy/app/views/layouts/application.html.erb
|
162
|
+
- test/dummy/app/views/peek/_test_view.html.erb
|
175
163
|
- test/dummy/bin/bundle
|
176
164
|
- test/dummy/bin/rails
|
177
165
|
- test/dummy/bin/rake
|
@@ -185,11 +173,13 @@ test_files:
|
|
185
173
|
- test/dummy/config/initializers/filter_parameter_logging.rb
|
186
174
|
- test/dummy/config/initializers/inflections.rb
|
187
175
|
- test/dummy/config/initializers/mime_types.rb
|
176
|
+
- test/dummy/config/initializers/peek.rb
|
188
177
|
- test/dummy/config/initializers/secret_token.rb
|
189
178
|
- test/dummy/config/initializers/session_store.rb
|
190
179
|
- test/dummy/config/initializers/wrap_parameters.rb
|
191
180
|
- test/dummy/config/locales/en.yml
|
192
181
|
- test/dummy/config/routes.rb
|
182
|
+
- test/dummy/lib/test_view.rb
|
193
183
|
- test/dummy/log/.keep
|
194
184
|
- test/dummy/public/404.html
|
195
185
|
- test/dummy/public/422.html
|
@@ -198,3 +188,4 @@ test_files:
|
|
198
188
|
- test/peek/views/view_test.rb
|
199
189
|
- test/peek_test.rb
|
200
190
|
- test/test_helper.rb
|
191
|
+
has_rdoc:
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,71 +0,0 @@
|
|
1
|
-
#= require peek/vendor/jquery.tipsy
|
2
|
-
|
3
|
-
requestId = null
|
4
|
-
|
5
|
-
do ($ = jQuery) ->
|
6
|
-
|
7
|
-
getRequestId = ->
|
8
|
-
if requestId? then requestId else $('#peek').data('request-id')
|
9
|
-
|
10
|
-
peekEnabled = ->
|
11
|
-
$('#peek').length
|
12
|
-
|
13
|
-
updatePerformanceBar = (results) ->
|
14
|
-
for key of results.data
|
15
|
-
for label of results.data[key]
|
16
|
-
$("[data-defer-to=#{key}-#{label}]").text results.data[key][label]
|
17
|
-
$(document).trigger 'peek:render', [getRequestId(), results]
|
18
|
-
|
19
|
-
initializeTipsy = ->
|
20
|
-
$('#peek .peek-tooltip, #peek .tooltip').each ->
|
21
|
-
el = $(this)
|
22
|
-
gravity = if el.hasClass('rightwards') || el.hasClass('leftwards')
|
23
|
-
$.fn.tipsy.autoWE
|
24
|
-
else
|
25
|
-
$.fn.tipsy.autoNS
|
26
|
-
|
27
|
-
el.tipsy
|
28
|
-
gravity: gravity
|
29
|
-
|
30
|
-
toggleBar = (event) ->
|
31
|
-
return if $(event.target).is ':input'
|
32
|
-
|
33
|
-
if event.which == 96 && !event.metaKey
|
34
|
-
wrapper = $('#peek')
|
35
|
-
if wrapper.hasClass 'disabled'
|
36
|
-
wrapper.removeClass 'disabled'
|
37
|
-
document.cookie = "peek=true; path=/";
|
38
|
-
else
|
39
|
-
wrapper.addClass 'disabled'
|
40
|
-
document.cookie = "peek=false; path=/";
|
41
|
-
|
42
|
-
fetchRequestResults = ->
|
43
|
-
$.ajax '/peek/results',
|
44
|
-
data:
|
45
|
-
request_id: getRequestId()
|
46
|
-
success: (data, textStatus, xhr) ->
|
47
|
-
updatePerformanceBar data
|
48
|
-
error: (xhr, textStatus, error) ->
|
49
|
-
# Swallow the error
|
50
|
-
|
51
|
-
$(document).on 'keypress', toggleBar
|
52
|
-
|
53
|
-
$(document).on 'peek:update', initializeTipsy
|
54
|
-
$(document).on 'peek:update', fetchRequestResults
|
55
|
-
|
56
|
-
# Fire the event for our own listeners.
|
57
|
-
$(document).on 'pjax:end', (event, xhr, options) ->
|
58
|
-
if xhr?
|
59
|
-
requestId = xhr.getResponseHeader 'X-Request-Id'
|
60
|
-
|
61
|
-
if peekEnabled()
|
62
|
-
$(this).trigger 'peek:update'
|
63
|
-
|
64
|
-
# Also listen to turbolinks page change event
|
65
|
-
$(document).on 'page:change turbolinks:load', ->
|
66
|
-
if peekEnabled()
|
67
|
-
$(this).trigger 'peek:update'
|
68
|
-
|
69
|
-
$ ->
|
70
|
-
if peekEnabled()
|
71
|
-
$(this).trigger 'peek:update'
|