rack-profiler 1.0.0 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ada3784e0444ea4df49d755fac6dc82e3ae30ee2
4
- data.tar.gz: 7611769984c985b48d7a49cfb36750a92c000da3
3
+ metadata.gz: fe1afedae470bb85742aeb3a12c0d254fe85dcae
4
+ data.tar.gz: 1e70fe3c574df047fecc89476c6ae25ac684ebb9
5
5
  SHA512:
6
- metadata.gz: c3d87464a4fdf2c46f2f236ff9633b042535ffdf5184fe03453d11706e77b2b2b27a9de0dfc76dfcf87308458a5d1e5aa9f11be2fc1e4ef19adf21fe721eda89
7
- data.tar.gz: 62c9a482614f8be5ddde9917ac96c0f36eb278b5d7e62d479682f574b5c677a90c4f704c4ca5414e4eec802574951f3ccd2d5bfe589fd28fb03016ede66e9b61
6
+ metadata.gz: 873f5b0416871e69754316871703e68ae47df70aab738192dc5d7867460abb755c46834a45cd58182406ec89187a9d07224709e4f7f48e55555bd45ee16fa1cb
7
+ data.tar.gz: da4315aba4b60ac6807de38c84fbe15ad83eeaedb1c8849b51f84f3c1c6d14aecda2802c8fb4af558d59aa90d18d707a5d17d8cb070ec9af21b5d3a72e015efd
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015 Luca Ongaro
1
+ Copyright (c) 2015 DaWanda GmbH
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Rack::Profiler
2
2
 
3
3
  [![Build Status](https://travis-ci.org/dawanda/rack-profiler.svg)](https://travis-ci.org/dawanda/rack-profiler) [![Code Climate](https://codeclimate.com/github/dawanda/rack-profiler/badges/gpa.svg)](https://codeclimate.com/github/dawanda/rack-profiler) [![Test Coverage](https://codeclimate.com/github/dawanda/rack-profiler/badges/coverage.svg)](https://codeclimate.com/github/dawanda/rack-profiler)
4
+ [![Gem Version](https://badge.fury.io/rb/rack-profiler.svg)](http://badge.fury.io/rb/rack-profiler)
4
5
 
5
6
  Simple profiler for Rack applications (Sinatra and Ruby on Rails for example).
6
7
  It helps providing an answer to common questions like:
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class Profiler
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -232,6 +232,9 @@
232
232
  type = $("#req-method").val() || "GET",
233
233
  data = $("#req-data").val()
234
234
 
235
+ path += path.indexOf("?") > -1 ? "&" : "?";
236
+ path += "rack-profiler";
237
+
235
238
  var exposeKeyValues = function( obj ) {
236
239
  return Object.keys( obj ).map( function( key ) {
237
240
  return { key: key, value: JSON.stringify( obj[key], null, 1 ) }
@@ -241,7 +244,7 @@
241
244
  $(".pr-queries tbody").html('')
242
245
  $(".pr-steps tbody").html('')
243
246
 
244
- $.ajax( path, { type: type, data: ["rack-profiler", data].join("&") } )
247
+ $.ajax( path, { type: type, data: data } )
245
248
  .done(function( data, status, xhr ) {
246
249
  $(".stats").show()
247
250
 
@@ -253,6 +256,13 @@
253
256
  headersKeyVal = exposeKeyValues( data.response.headers ),
254
257
  responseWrap = $.extend( {}, data.response, { headers: headersKeyVal } )
255
258
 
259
+ try {
260
+ // pretty-print a JSON response
261
+ responseWrap.body = JSON.stringify(JSON.parse(responseWrap.body), null, 2);
262
+ } catch(e) {
263
+ // can't parse it as JSON, nevermind
264
+ };
265
+
256
266
  $('#response').html( Mustache.render( responseTmpl, responseWrap ) )
257
267
  if (data.response.status < 400) {
258
268
  $('#response_panel').removeClass('panel-danger').addClass('panel-success')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-profiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Ongaro
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-29 00:00:00.000000000 Z
12
+ date: 2015-08-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  version: '0'
122
122
  requirements: []
123
123
  rubyforge_project:
124
- rubygems_version: 2.2.2
124
+ rubygems_version: 2.4.8
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: A simple profiler for Rack applications