peek 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -47,3 +47,8 @@
47
47
  # 0.1.4
48
48
 
49
49
  - Don't access xhr object when not present in pjax:end
50
+
51
+ # 0.1.5
52
+
53
+ - Don't trigger `peek:update` event when the peek bar isn't present - [#37](https://github.com/peek/peek/issues/37) [@dewski](https://github.com/dewski)
54
+ - Add `after_request` helper method for Peek::Views::View to help reset state
data/README.md CHANGED
@@ -151,7 +151,7 @@ It just works.
151
151
 
152
152
  It just works.
153
153
 
154
- ### Using Peek with Spork
154
+ ## Using Peek with Spork
155
155
 
156
156
  For best results with Spork, add this to your `prefork` block
157
157
  anytime before your environment is loaded:
@@ -178,6 +178,7 @@ end
178
178
  ## Available Peek views
179
179
 
180
180
  - [peek-dalli](https://github.com/peek/peek-dalli)
181
+ - [peek-gc](https://github.com/peek/peek-gc)
181
182
  - [peek-git](https://github.com/peek/peek-git)
182
183
  - [peek-mongo](https://github.com/peek/peek-mongo)
183
184
  - [peek-mysql2](https://github.com/peek/peek-mysql2)
@@ -5,8 +5,10 @@ requestId = null
5
5
  getRequestId = ->
6
6
  if requestId? then requestId else $('#peek').data('request-id')
7
7
 
8
+ peekEnabled = ->
9
+ $('#peek').length
10
+
8
11
  updatePerformanceBar = (results) ->
9
- peekResults = $('#peek-results')
10
12
  for key of results.data
11
13
  for label of results.data[key]
12
14
  $("[data-defer-to=#{key}-#{label}]").text results.data[key][label]
@@ -52,12 +54,16 @@ $(document).on 'peek:update', fetchRequestResults
52
54
  # Fire the event for our own listeners.
53
55
  $(document).on 'pjax:end', (event, xhr, options) ->
54
56
  if xhr?
55
- requestId = xhr.getResponseHeader('X-Request-Id')
56
- $(this).trigger 'peek:update'
57
+ requestId = xhr.getResponseHeader 'X-Request-Id'
58
+
59
+ if peekEnabled()
60
+ $(this).trigger 'peek:update'
57
61
 
58
62
  # Also listen to turbolinks page change event
59
63
  $(document).on 'page:change', ->
60
- $(this).trigger 'peek:update'
64
+ if peekEnabled()
65
+ $(this).trigger 'peek:update'
61
66
 
62
67
  $ ->
63
- $(this).trigger 'peek:update'
68
+ if peekEnabled()
69
+ $(this).trigger 'peek:update'
@@ -1,3 +1,3 @@
1
1
  module Peek
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
@@ -111,6 +111,14 @@ module Peek
111
111
  yield name, start, finish, id, payload
112
112
  end
113
113
  end
114
+
115
+ # Helper method for subscribing to the event that is fired when requests
116
+ # are finished.
117
+ def after_request
118
+ subscribe 'process_action.action_controller' do |name, start, finish, id, payload|
119
+ yield name, start, finish, id, payload
120
+ end
121
+ end
114
122
  end
115
123
  end
116
124
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peek
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
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: 2013-05-20 00:00:00.000000000 Z
12
+ date: 2013-07-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -65,7 +65,6 @@ files:
65
65
  - app/assets/stylesheets/peek/vendor/tipsy.scss
66
66
  - app/controllers/peek/results_controller.rb
67
67
  - app/views/peek/_bar.html.erb
68
- - app/views/peek/_results.html.erb
69
68
  - config/routes.rb
70
69
  - lib/peek.rb
71
70
  - lib/peek/adapters/base.rb
@@ -126,12 +125,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
125
  - - ! '>='
127
126
  - !ruby/object:Gem::Version
128
127
  version: '0'
128
+ segments:
129
+ - 0
130
+ hash: -1057251340179445027
129
131
  required_rubygems_version: !ruby/object:Gem::Requirement
130
132
  none: false
131
133
  requirements:
132
134
  - - ! '>='
133
135
  - !ruby/object:Gem::Version
134
136
  version: '0'
137
+ segments:
138
+ - 0
139
+ hash: -1057251340179445027
135
140
  requirements: []
136
141
  rubyforge_project:
137
142
  rubygems_version: 1.8.23
File without changes