peek 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +32 -2
- data/app/assets/stylesheets/peek.scss +17 -0
- data/lib/peek/adapters/elasticsearch.rb +33 -0
- data/lib/peek/adapters/memcache.rb +4 -0
- data/lib/peek/version.rb +1 -1
- data/peek.gemspec +3 -3
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96092aef1cec4542a1dedd705660372a1ebde965
|
4
|
+
data.tar.gz: 5e3c7b2bf2da0857c5ac59ad4f2eb5cf09e30000
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fe0fabed862bb1e022bdf8a1dea6c2522ab24708c181dd85b0d28fc282fa1d300af61c73ad8cb88635e5123d6b5da2af86a5c817181d1a9cfdf0645ebb686c0
|
7
|
+
data.tar.gz: 2e02d8c4074330f2dd0b6163cc64513b6e50c1d43fbe00233c4d702dbf0b1934be3a212ad2df484e9c67de8dab47cd5b2ab33af360ca694dbd4c98d153c6f1dc
|
data/CHANGELOG.md
CHANGED
@@ -64,3 +64,7 @@
|
|
64
64
|
# 0.1.8
|
65
65
|
|
66
66
|
- Include the ControllerHelpers directly into `ActionController::Base` - [#41](https://github.com/peek/peek/pull/41) [@lucasmazza](https://github.com/lucasmazza)
|
67
|
+
|
68
|
+
# 0.1.9
|
69
|
+
|
70
|
+
- Rescue & log Dalli exceptions instead of crashing - [#50](https://github.com/peek/peek/pull/50) [@barunio](https://github.com/barunio)
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Peek
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/peek/peek.png?branch=master)](https://travis-ci.org/peek/peek) [![Gem Version](https://badge.fury.io/rb/peek.png)](http://badge.fury.io/rb/peek)
|
3
|
+
[![Build Status](https://travis-ci.org/peek/peek.png?branch=master)](https://travis-ci.org/peek/peek) [![Gem Version](https://badge.fury.io/rb/peek.png)](http://badge.fury.io/rb/peek) [![Inline docs](http://inch-ci.org/github/peek/peek.png)](http://inch-ci.org/github/peek/peek)
|
4
4
|
|
5
5
|
Take a peek into your Rails application.
|
6
6
|
|
@@ -45,7 +45,7 @@ Peek.into Peek::Views::Redis
|
|
45
45
|
Peek.into Peek::Views::Dalli
|
46
46
|
```
|
47
47
|
|
48
|
-
Feel free to pick and
|
48
|
+
Feel free to pick and install from the [list](https://github.com/peek/peek#available-peek-views) or create your own. The order they
|
49
49
|
are added to Peek, the order they will appear in your bar.
|
50
50
|
|
51
51
|
Next, to render the Peek bar in your application just add the following snippet
|
@@ -111,6 +111,7 @@ adapters be sure to include their dependencies in your application.
|
|
111
111
|
|
112
112
|
- Redis - The [redis](https://github.com/redis/redis-rb) gem
|
113
113
|
- Dalli - The [dalli](https://github.com/mperham/dalli) gem
|
114
|
+
- Elasticsearch - The [elasticsearch](https://github.com/elasticsearch/elasticsearch-ruby) gem
|
114
115
|
|
115
116
|
```ruby
|
116
117
|
Peeked::Application.configure do
|
@@ -134,6 +135,17 @@ Peeked::Application.configure do
|
|
134
135
|
:expires_in => 60 * 30 # => 30 minutes in seconds
|
135
136
|
}
|
136
137
|
|
138
|
+
# Elasticsearch with no options
|
139
|
+
config.peek.adapter = :elasticsearch
|
140
|
+
|
141
|
+
# Elasticsearch with options
|
142
|
+
config.peek.adapter = :elasticsearch, {
|
143
|
+
:client => Elasticsearch::Client.new,
|
144
|
+
:expires_in => 60 * 30, # => 30 minutes in seconds
|
145
|
+
:index => 'peek_requests_index',
|
146
|
+
:type => 'peek_request'
|
147
|
+
}
|
148
|
+
|
137
149
|
# ...
|
138
150
|
end
|
139
151
|
```
|
@@ -143,6 +155,22 @@ cache length that way data will be available if you'd like to aggregate it or
|
|
143
155
|
use it for other Peek views. You can update this to be 30 seconds if you don't
|
144
156
|
want the data to be available to stick around.
|
145
157
|
|
158
|
+
### Customizing the bar
|
159
|
+
|
160
|
+
You can customize the appearance of the bar by customizing it in your own application's CSS.
|
161
|
+
|
162
|
+
One common example is fixing the peek bar to the bottom, rather than top, of a page, for use with [Bootstrap](http://getbootstrap.com/):
|
163
|
+
|
164
|
+
```css
|
165
|
+
#peek {
|
166
|
+
position: fixed;
|
167
|
+
bottom: 0;
|
168
|
+
left: 0;
|
169
|
+
right: 0;
|
170
|
+
z-index: 999;
|
171
|
+
}
|
172
|
+
```
|
173
|
+
|
146
174
|
## Using Peek with PJAX
|
147
175
|
|
148
176
|
It just works.
|
@@ -167,10 +195,12 @@ end
|
|
167
195
|
|
168
196
|
## Available Peek views
|
169
197
|
|
198
|
+
- [peek-active_resource](https://github.com/gotmayonase/peek-active_resource)
|
170
199
|
- [peek-dalli](https://github.com/peek/peek-dalli)
|
171
200
|
- [peek-gc](https://github.com/peek/peek-gc)
|
172
201
|
- [peek-git](https://github.com/peek/peek-git)
|
173
202
|
- [peek-mongo](https://github.com/peek/peek-mongo)
|
203
|
+
- [peek-moped](https://github.com/nodkz/peek-moped)
|
174
204
|
- [peek-mysql2](https://github.com/peek/peek-mysql2)
|
175
205
|
- [peek-performance_bar](https://github.com/peek/peek-performance_bar)
|
176
206
|
- [peek-pg](https://github.com/peek/peek-pg)
|
@@ -65,4 +65,21 @@
|
|
65
65
|
margin-right: 0;
|
66
66
|
}
|
67
67
|
}
|
68
|
+
|
69
|
+
.css-truncate {
|
70
|
+
&.css-truncate-target,
|
71
|
+
.css-truncate-target {
|
72
|
+
display: inline-block;
|
73
|
+
max-width: 125px;
|
74
|
+
overflow: hidden;
|
75
|
+
text-overflow: ellipsis;
|
76
|
+
white-space: nowrap;
|
77
|
+
vertical-align: top;
|
78
|
+
}
|
79
|
+
|
80
|
+
&.expandable:hover .css-truncate-target,
|
81
|
+
&.expandable:hover.css-truncate-target {
|
82
|
+
max-width: 10000px !important;
|
83
|
+
}
|
84
|
+
}
|
68
85
|
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'peek/adapters/base'
|
2
|
+
require 'elasticsearch'
|
3
|
+
|
4
|
+
module Peek
|
5
|
+
module Adapters
|
6
|
+
class Elasticsearch < Base
|
7
|
+
def initialize(options = {})
|
8
|
+
@client = options.fetch(:client, ::Elasticsearch::Client.new)
|
9
|
+
@expires_in = Integer(options.fetch(:expires_in, 60 * 30) * 1000)
|
10
|
+
@index = options.fetch(:index, 'peek_requests_index')
|
11
|
+
@type = options.fetch(:type, 'peek_request')
|
12
|
+
end
|
13
|
+
|
14
|
+
def get(request_id)
|
15
|
+
result = @client.get_source index: @index, type: @type, id: "#{request_id}"
|
16
|
+
result.to_json
|
17
|
+
rescue ::Elasticsearch::Transport::Transport::Errors::NotFound
|
18
|
+
# pass
|
19
|
+
end
|
20
|
+
|
21
|
+
def save
|
22
|
+
@client.index index: @index,
|
23
|
+
type: @type,
|
24
|
+
id: "#{Peek.request_id}",
|
25
|
+
body: Peek.results.to_json,
|
26
|
+
ttl: @expires_in
|
27
|
+
rescue ::Elasticsearch::Transport::Transport::Errors::BadRequest
|
28
|
+
false
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -11,10 +11,14 @@ module Peek
|
|
11
11
|
|
12
12
|
def get(request_id)
|
13
13
|
@client.get("peek:requests:#{request_id}")
|
14
|
+
rescue ::Dalli::DalliError => e
|
15
|
+
Rails.logger.error "#{e.class.name}: #{e.message}"
|
14
16
|
end
|
15
17
|
|
16
18
|
def save
|
17
19
|
@client.add("peek:requests:#{Peek.request_id}", Peek.results.to_json, @expires_in)
|
20
|
+
rescue ::Dalli::DalliError => e
|
21
|
+
Rails.logger.error "#{e.class.name}: #{e.message}"
|
18
22
|
end
|
19
23
|
end
|
20
24
|
end
|
data/lib/peek/version.rb
CHANGED
data/peek.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.email = ['me@garrettbjerkhoel.com']
|
11
11
|
gem.description = %q{Take a peek into your Rails application.}
|
12
12
|
gem.summary = %q{Take a peek into your Rails application.}
|
13
|
-
gem.homepage = 'https://github.com/
|
13
|
+
gem.homepage = 'https://github.com/peek/peek'
|
14
14
|
gem.license = 'MIT'
|
15
15
|
|
16
16
|
gem.files = `git ls-files`.split($/)
|
@@ -18,6 +18,6 @@ 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 '
|
22
|
-
gem.add_dependency 'atomic',
|
21
|
+
gem.add_dependency 'railties', '>= 3.0.0'
|
22
|
+
gem.add_dependency 'atomic', '>= 1.0.0'
|
23
23
|
end
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
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: 2014-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: railties
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 3.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
26
|
version: 3.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: atomic
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.0.0
|
41
41
|
description: Take a peek into your Rails application.
|
@@ -45,7 +45,7 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- .gitignore
|
48
|
+
- ".gitignore"
|
49
49
|
- CHANGELOG.md
|
50
50
|
- Gemfile
|
51
51
|
- LICENSE.txt
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- config/routes.rb
|
64
64
|
- lib/peek.rb
|
65
65
|
- lib/peek/adapters/base.rb
|
66
|
+
- lib/peek/adapters/elasticsearch.rb
|
66
67
|
- lib/peek/adapters/memcache.rb
|
67
68
|
- lib/peek/adapters/memory.rb
|
68
69
|
- lib/peek/adapters/redis.rb
|
@@ -107,7 +108,7 @@ files:
|
|
107
108
|
- test/peek/views/view_test.rb
|
108
109
|
- test/peek_test.rb
|
109
110
|
- test/test_helper.rb
|
110
|
-
homepage: https://github.com/
|
111
|
+
homepage: https://github.com/peek/peek
|
111
112
|
licenses:
|
112
113
|
- MIT
|
113
114
|
metadata: {}
|
@@ -117,17 +118,17 @@ require_paths:
|
|
117
118
|
- lib
|
118
119
|
required_ruby_version: !ruby/object:Gem::Requirement
|
119
120
|
requirements:
|
120
|
-
- -
|
121
|
+
- - ">="
|
121
122
|
- !ruby/object:Gem::Version
|
122
123
|
version: '0'
|
123
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
125
|
requirements:
|
125
|
-
- -
|
126
|
+
- - ">="
|
126
127
|
- !ruby/object:Gem::Version
|
127
128
|
version: '0'
|
128
129
|
requirements: []
|
129
130
|
rubyforge_project:
|
130
|
-
rubygems_version: 2.
|
131
|
+
rubygems_version: 2.2.2
|
131
132
|
signing_key:
|
132
133
|
specification_version: 4
|
133
134
|
summary: Take a peek into your Rails application.
|