lanaya 0.0.1.dev

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,126 @@
1
+ class Lanaya
2
+ constructor: ->
3
+ @initFoundation()
4
+ @bindEvents()
5
+ @refresh()
6
+ @subscribe()
7
+
8
+ initFoundation: ->
9
+ $(window.document).foundation()
10
+
11
+ bindEvents: ->
12
+ _this = this
13
+ $(window.document).on 'click', '.interaction', (event) ->
14
+ interaction = $(this).data()
15
+ _this.displayInterationDetail(interaction)
16
+ $('#interaction-detail').data('session-id', interaction.session_id).show()
17
+ $content = $('#interaction-detail .content')
18
+ $content.css('height', $content.outerHeight())
19
+
20
+ $('#interaction-detail .close').on 'click', (event) ->
21
+ $('#interaction-detail').hide()
22
+
23
+ $(window).on 'resize', ->
24
+ $content = $('#interaction-detail .content')
25
+ $content.css('height', $content.outerHeight())
26
+
27
+ displayInterationDetail: (interaction) ->
28
+ @displayInteractionHeaders(interaction)
29
+ $.get("/#{interaction.session_id}/response_body", (response) =>
30
+ @displayInteractionPreview(response)
31
+ @displayInteractionResponse(response)
32
+ )
33
+
34
+ displayInteractionHeaders: (interaction) ->
35
+ tpl = """
36
+ <div id="interation-summary">
37
+ <ul>
38
+ <li><b>Request URL:</b> <%= interaction.request.uri %></li>
39
+ <li><b>Request Method:</b> <%= interaction.request.method %></li>
40
+ <li><b>Status Code:</b> <%= interaction.response.status_code %></li>
41
+ <li>
42
+ <b>Request Headers</b>
43
+ <ul>
44
+ <% _.each(interaction.request.headers, function(value, key) { %>
45
+ <li><b><%= key %>:</b> <%= value %></li>
46
+ <% }); %>
47
+ </ul>
48
+ </li>
49
+ <li>
50
+ <b>Reponse Headers</b>
51
+ <ul>
52
+ <% _.each(interaction.response.headers, function(value, key) { %>
53
+ <li><b><%= key %>:</b> <%= value %></li>
54
+ <% }); %>
55
+ </ul>
56
+ </li>
57
+ </ul>
58
+ </div>
59
+ """
60
+ html = _.template(tpl)({ interaction: interaction })
61
+ $('#interaction-detail #headers').html(html)
62
+
63
+ displayInteractionResponse: (response) ->
64
+ response = 'This request has no response data available.' if response == ''
65
+ $('#response').text(response)
66
+
67
+ displayInteractionPreview: (response) ->
68
+ if response == ''
69
+ response = 'This request has no response data available.'
70
+ $('#preview').html(response)
71
+ else
72
+ $iframe = $("<iframe></iframe>")
73
+ $iframe.css({width: '100%', height: '100%'})
74
+ $('#preview').html($iframe)
75
+ iframe = $iframe[0]
76
+ frameDoc = iframe.document
77
+ # IE
78
+ frameDoc = iframe.contentWindow.document if iframe.contentWindow
79
+ frameDoc.open()
80
+ frameDoc.writeln(response)
81
+ frameDoc.close()
82
+
83
+ subscribe: ->
84
+ if WebSocket?
85
+ @subscribeWebSocket()
86
+ else
87
+ @subscribePoll()
88
+
89
+ subscribeWebSocket: ->
90
+ secure = window.location.scheme == 'https'
91
+ uri = "#{if secure then 'wss' else 'ws'}://#{window.location.host}/interactions"
92
+ @websocket = new WebSocket(uri)
93
+ @websocket.onmessage = (event) =>
94
+ @addInteraction $.parseJSON(event.data)
95
+
96
+ subscribePoll: ->
97
+ unless @refreshInterval?
98
+ @refreshInterval = setInterval (=> @refresh()), 1000
99
+
100
+ refresh: ->
101
+ $.getJSON '/interactions', (interactions) =>
102
+ $.each(interactions, (i, interaction) =>
103
+ unless @haveInteraction(interaction)
104
+ @addInteraction interaction
105
+ )
106
+
107
+ haveInteraction: (interaction) ->
108
+ $("#interaction-#{interaction.session_id}").length > 0
109
+
110
+ addInteraction: (interaction) ->
111
+ console.log(interaction)
112
+ html = """
113
+ <tr id="interaction-#{interaction.session_id}" class="interaction" >
114
+ <td>#{interaction.request.uri}</td>
115
+ <td>#{interaction.request.method}</td>
116
+ <td>#{interaction.response.status_code}</td>
117
+ <td>#{interaction.response.content_type}</td>
118
+ <td>#{interaction.response.content_length}</td>
119
+ <td>#{interaction.requested_at }</td>
120
+ </tr>
121
+ """
122
+ $html = $(html).data(interaction)
123
+ $('#interactions table tbody').append($html)
124
+
125
+ jQuery ->
126
+ window.Lanaya = new Lanaya
@@ -0,0 +1,145 @@
1
+ // Generated by CoffeeScript 1.6.3
2
+ (function() {
3
+ var Lanaya;
4
+
5
+ Lanaya = (function() {
6
+ function Lanaya() {
7
+ this.initFoundation();
8
+ this.bindEvents();
9
+ this.refresh();
10
+ this.subscribe();
11
+ }
12
+
13
+ Lanaya.prototype.initFoundation = function() {
14
+ return $(window.document).foundation();
15
+ };
16
+
17
+ Lanaya.prototype.bindEvents = function() {
18
+ var _this;
19
+ _this = this;
20
+ $(window.document).on('click', '.interaction', function(event) {
21
+ var $content, interaction;
22
+ interaction = $(this).data();
23
+ _this.displayInterationDetail(interaction);
24
+ $('#interaction-detail').data('session-id', interaction.session_id).show();
25
+ $content = $('#interaction-detail .content');
26
+ return $content.css('height', $content.outerHeight());
27
+ });
28
+ $('#interaction-detail .close').on('click', function(event) {
29
+ return $('#interaction-detail').hide();
30
+ });
31
+ return $(window).on('resize', function() {
32
+ var $content;
33
+ $content = $('#interaction-detail .content');
34
+ return $content.css('height', $content.outerHeight());
35
+ });
36
+ };
37
+
38
+ Lanaya.prototype.displayInterationDetail = function(interaction) {
39
+ var _this = this;
40
+ this.displayInteractionHeaders(interaction);
41
+ return $.get("/" + interaction.session_id + "/response_body", function(response) {
42
+ _this.displayInteractionPreview(response);
43
+ return _this.displayInteractionResponse(response);
44
+ });
45
+ };
46
+
47
+ Lanaya.prototype.displayInteractionHeaders = function(interaction) {
48
+ var html, tpl;
49
+ tpl = "<div id=\"interation-summary\">\n <ul>\n <li><b>Request URL:</b> <%= interaction.request.uri %></li>\n <li><b>Request Method:</b> <%= interaction.request.method %></li>\n <li><b>Status Code:</b> <%= interaction.response.status_code %></li>\n <li>\n <b>Request Headers</b>\n <ul>\n <% _.each(interaction.request.headers, function(value, key) { %>\n <li><b><%= key %>:</b> <%= value %></li>\n <% }); %>\n </ul>\n </li>\n <li>\n <b>Reponse Headers</b>\n <ul>\n <% _.each(interaction.response.headers, function(value, key) { %>\n <li><b><%= key %>:</b> <%= value %></li>\n <% }); %>\n </ul>\n </li>\n </ul>\n</div>";
50
+ html = _.template(tpl)({
51
+ interaction: interaction
52
+ });
53
+ return $('#interaction-detail #headers').html(html);
54
+ };
55
+
56
+ Lanaya.prototype.displayInteractionResponse = function(response) {
57
+ if (response === '') {
58
+ response = 'This request has no response data available.';
59
+ }
60
+ return $('#response').text(response);
61
+ };
62
+
63
+ Lanaya.prototype.displayInteractionPreview = function(response) {
64
+ var $iframe, frameDoc, iframe;
65
+ if (response === '') {
66
+ response = 'This request has no response data available.';
67
+ return $('#preview').html(response);
68
+ } else {
69
+ $iframe = $("<iframe></iframe>");
70
+ $iframe.css({
71
+ width: '100%',
72
+ height: '100%'
73
+ });
74
+ $('#preview').html($iframe);
75
+ iframe = $iframe[0];
76
+ frameDoc = iframe.document;
77
+ if (iframe.contentWindow) {
78
+ frameDoc = iframe.contentWindow.document;
79
+ }
80
+ frameDoc.open();
81
+ frameDoc.writeln(response);
82
+ return frameDoc.close();
83
+ }
84
+ };
85
+
86
+ Lanaya.prototype.subscribe = function() {
87
+ if (typeof WebSocket !== "undefined" && WebSocket !== null) {
88
+ return this.subscribeWebSocket();
89
+ } else {
90
+ return this.subscribePoll();
91
+ }
92
+ };
93
+
94
+ Lanaya.prototype.subscribeWebSocket = function() {
95
+ var secure, uri,
96
+ _this = this;
97
+ secure = window.location.scheme === 'https';
98
+ uri = "" + (secure ? 'wss' : 'ws') + "://" + window.location.host + "/interactions";
99
+ this.websocket = new WebSocket(uri);
100
+ return this.websocket.onmessage = function(event) {
101
+ return _this.addInteraction($.parseJSON(event.data));
102
+ };
103
+ };
104
+
105
+ Lanaya.prototype.subscribePoll = function() {
106
+ var _this = this;
107
+ if (this.refreshInterval == null) {
108
+ return this.refreshInterval = setInterval((function() {
109
+ return _this.refresh();
110
+ }), 1000);
111
+ }
112
+ };
113
+
114
+ Lanaya.prototype.refresh = function() {
115
+ var _this = this;
116
+ return $.getJSON('/interactions', function(interactions) {
117
+ return $.each(interactions, function(i, interaction) {
118
+ if (!_this.haveInteraction(interaction)) {
119
+ return _this.addInteraction(interaction);
120
+ }
121
+ });
122
+ });
123
+ };
124
+
125
+ Lanaya.prototype.haveInteraction = function(interaction) {
126
+ return $("#interaction-" + interaction.session_id).length > 0;
127
+ };
128
+
129
+ Lanaya.prototype.addInteraction = function(interaction) {
130
+ var $html, html;
131
+ console.log(interaction);
132
+ html = "<tr id=\"interaction-" + interaction.session_id + "\" class=\"interaction\" >\n <td>" + interaction.request.uri + "</td>\n <td>" + interaction.request.method + "</td>\n <td>" + interaction.response.status_code + "</td>\n <td>" + interaction.response.content_type + "</td>\n <td>" + interaction.response.content_length + "</td>\n <td>" + interaction.requested_at + "</td>\n</tr>";
133
+ $html = $(html).data(interaction);
134
+ return $('#interactions table tbody').append($html);
135
+ };
136
+
137
+ return Lanaya;
138
+
139
+ })();
140
+
141
+ jQuery(function() {
142
+ return window.Lanaya = new Lanaya;
143
+ });
144
+
145
+ }).call(this);
@@ -0,0 +1,6 @@
1
+ // Underscore.js 1.5.2
2
+ // http://underscorejs.org
3
+ // (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
4
+ // Underscore may be freely distributed under the MIT license.
5
+ (function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,w=Object.keys,_=i.bind,j=function(n){return n instanceof j?n:this instanceof j?(this._wrapped=n,void 0):new j(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,j.VERSION="1.5.2";var A=j.each=j.forEach=function(n,t,e){if(null!=n)if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a=j.keys(n),u=0,i=a.length;i>u;u++)if(t.call(e,n[a[u]],a[u],n)===r)return};j.map=j.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var E="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(E);return r},j.reduceRight=j.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(E);return r},j.find=j.detect=function(n,t,r){var e;return O(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},j.filter=j.select=function(n,t,r){var e=[];return null==n?e:g&&n.filter===g?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},j.reject=function(n,t,r){return j.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},j.every=j.all=function(n,t,e){t||(t=j.identity);var u=!0;return null==n?u:d&&n.every===d?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var O=j.some=j.any=function(n,t,e){t||(t=j.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};j.contains=j.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:O(n,function(n){return n===t})},j.invoke=function(n,t){var r=o.call(arguments,2),e=j.isFunction(t);return j.map(n,function(n){return(e?t:n[t]).apply(n,r)})},j.pluck=function(n,t){return j.map(n,function(n){return n[t]})},j.where=function(n,t,r){return j.isEmpty(t)?r?void 0:[]:j[r?"find":"filter"](n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},j.findWhere=function(n,t){return j.where(n,t,!0)},j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);if(!t&&j.isEmpty(n))return-1/0;var e={computed:-1/0,value:-1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a>e.computed&&(e={value:n,computed:a})}),e.value},j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);if(!t&&j.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a<e.computed&&(e={value:n,computed:a})}),e.value},j.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=j.random(r++),e[r-1]=e[t],e[t]=n}),e},j.sample=function(n,t,r){return arguments.length<2||r?n[j.random(n.length-1)]:j.shuffle(n).slice(0,Math.max(0,t))};var k=function(n){return j.isFunction(n)?n:function(t){return t[n]}};j.sortBy=function(n,t,r){var e=k(t);return j.pluck(j.map(n,function(n,t,u){return{value:n,index:t,criteria:e.call(r,n,t,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var F=function(n){return function(t,r,e){var u={},i=null==r?j.identity:k(r);return A(t,function(r,a){var o=i.call(e,r,a,t);n(u,o,r)}),u}};j.groupBy=F(function(n,t,r){(j.has(n,t)?n[t]:n[t]=[]).push(r)}),j.indexBy=F(function(n,t,r){n[t]=r}),j.countBy=F(function(n,t){j.has(n,t)?n[t]++:n[t]=1}),j.sortedIndex=function(n,t,r,e){r=null==r?j.identity:k(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;r.call(e,n[o])<u?i=o+1:a=o}return i},j.toArray=function(n){return n?j.isArray(n)?o.call(n):n.length===+n.length?j.map(n,j.identity):j.values(n):[]},j.size=function(n){return null==n?0:n.length===+n.length?n.length:j.keys(n).length},j.first=j.head=j.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:o.call(n,0,t)},j.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},j.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},j.rest=j.tail=j.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},j.compact=function(n){return j.filter(n,j.identity)};var M=function(n,t,r){return t&&j.every(n,j.isArray)?c.apply(r,n):(A(n,function(n){j.isArray(n)||j.isArguments(n)?t?a.apply(r,n):M(n,t,r):r.push(n)}),r)};j.flatten=function(n,t){return M(n,t,[])},j.without=function(n){return j.difference(n,o.call(arguments,1))},j.uniq=j.unique=function(n,t,r,e){j.isFunction(t)&&(e=r,r=t,t=!1);var u=r?j.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:j.contains(a,r))||(a.push(r),i.push(n[e]))}),i},j.union=function(){return j.uniq(j.flatten(arguments,!0))},j.intersection=function(n){var t=o.call(arguments,1);return j.filter(j.uniq(n),function(n){return j.every(t,function(t){return j.indexOf(t,n)>=0})})},j.difference=function(n){var t=c.apply(e,o.call(arguments,1));return j.filter(n,function(n){return!j.contains(t,n)})},j.zip=function(){for(var n=j.max(j.pluck(arguments,"length").concat(0)),t=new Array(n),r=0;n>r;r++)t[r]=j.pluck(arguments,""+r);return t},j.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},j.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=j.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},j.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},j.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=new Array(e);e>u;)i[u++]=n,n+=r;return i};var R=function(){};j.bind=function(n,t){var r,e;if(_&&n.bind===_)return _.apply(n,o.call(arguments,1));if(!j.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));R.prototype=n.prototype;var u=new R;R.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},j.partial=function(n){var t=o.call(arguments,1);return function(){return n.apply(this,t.concat(o.call(arguments)))}},j.bindAll=function(n){var t=o.call(arguments,1);if(0===t.length)throw new Error("bindAll must be passed function names");return A(t,function(t){n[t]=j.bind(n[t],n)}),n},j.memoize=function(n,t){var r={};return t||(t=j.identity),function(){var e=t.apply(this,arguments);return j.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},j.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},j.defer=function(n){return j.delay.apply(j,[n,1].concat(o.call(arguments,1)))},j.throttle=function(n,t,r){var e,u,i,a=null,o=0;r||(r={});var c=function(){o=r.leading===!1?0:new Date,a=null,i=n.apply(e,u)};return function(){var l=new Date;o||r.leading!==!1||(o=l);var f=t-(l-o);return e=this,u=arguments,0>=f?(clearTimeout(a),a=null,o=l,i=n.apply(e,u)):a||r.trailing===!1||(a=setTimeout(c,f)),i}},j.debounce=function(n,t,r){var e,u,i,a,o;return function(){i=this,u=arguments,a=new Date;var c=function(){var l=new Date-a;t>l?e=setTimeout(c,t-l):(e=null,r||(o=n.apply(i,u)))},l=r&&!e;return e||(e=setTimeout(c,t)),l&&(o=n.apply(i,u)),o}},j.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},j.wrap=function(n,t){return function(){var r=[n];return a.apply(r,arguments),t.apply(this,r)}},j.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},j.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},j.keys=w||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)j.has(n,r)&&t.push(r);return t},j.values=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},j.pairs=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},j.invert=function(n){for(var t={},r=j.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},j.functions=j.methods=function(n){var t=[];for(var r in n)j.isFunction(n[r])&&t.push(r);return t.sort()},j.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},j.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},j.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)j.contains(r,u)||(t[u]=n[u]);return t},j.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]===void 0&&(n[r]=t[r])}),n},j.clone=function(n){return j.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},j.tap=function(n,t){return t(n),n};var S=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof j&&(n=n._wrapped),t instanceof j&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;var a=n.constructor,o=t.constructor;if(a!==o&&!(j.isFunction(a)&&a instanceof a&&j.isFunction(o)&&o instanceof o))return!1;r.push(n),e.push(t);var c=0,f=!0;if("[object Array]"==u){if(c=n.length,f=c==t.length)for(;c--&&(f=S(n[c],t[c],r,e)););}else{for(var s in n)if(j.has(n,s)&&(c++,!(f=j.has(t,s)&&S(n[s],t[s],r,e))))break;if(f){for(s in t)if(j.has(t,s)&&!c--)break;f=!c}}return r.pop(),e.pop(),f};j.isEqual=function(n,t){return S(n,t,[],[])},j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return 0===n.length;for(var t in n)if(j.has(n,t))return!1;return!0},j.isElement=function(n){return!(!n||1!==n.nodeType)},j.isArray=x||function(n){return"[object Array]"==l.call(n)},j.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeof n}),j.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},j.isNaN=function(n){return j.isNumber(n)&&n!=+n},j.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},j.isNull=function(n){return null===n},j.isUndefined=function(n){return n===void 0},j.has=function(n,t){return f.call(n,t)},j.noConflict=function(){return n._=t,this},j.identity=function(n){return n},j.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},j.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};var I={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}};I.unescape=j.invert(I.escape);var T={escape:new RegExp("["+j.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(I.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(n){j[n]=function(t){return null==t?"":(""+t).replace(T[n],function(t){return I[n][t]})}}),j.result=function(n,t){if(null==n)return void 0;var r=n[t];return j.isFunction(r)?r.call(n):r},j.mixin=function(n){A(j.functions(n),function(t){var r=j[t]=n[t];j.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),z.call(this,r.apply(j,n))}})};var N=0;j.uniqueId=function(n){var t=++N+"";return n?n+t:t},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(n,t,r){var e;r=j.defaults({},r,j.templateSettings);var u=new RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(D,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=new Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,j);var c=function(n){return e.call(this,n,j)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},j.chain=function(n){return j(n).chain()};var z=function(n){return this._chain?j(n).chain():n};j.mixin(j),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];j.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],z.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];j.prototype[n]=function(){return z.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this);
6
+ //# sourceMappingURL=underscore-min.map
@@ -0,0 +1,38 @@
1
+ <div class="large-12 columns">
2
+ <div id="interactions" class="row">
3
+ <div class="large-12 columns">
4
+ <table>
5
+ <thead>
6
+ <tr>
7
+ <th>Name</th>
8
+ <th>Method</th>
9
+ <th>Status</th>
10
+ <th>Type</th>
11
+ <th>Size</th>
12
+ <th>Requested At</th>
13
+ </tr>
14
+ </thead>
15
+ <tbody>
16
+ </tbody>
17
+ </table>
18
+ </div>
19
+ </div>
20
+ </div>
21
+
22
+ <div id="interaction-detail" class="row">
23
+ <div class="large-12 columns">
24
+ <a class="close" href="#">x</a>
25
+ <dl class="tabs" data-tab>
26
+ <dd class="active"><a href="#headers">Headers</a></dd>
27
+ <dd><a href="#preview">Preview</a></dd>
28
+ <dd><a href="#response">Response</a></dd>
29
+ </dl>
30
+ <div class="tabs-content">
31
+ <div class="content active" id="headers"></div>
32
+ <div class="content" id="preview"></div>
33
+ <div class="content" id="response"></div>
34
+ </div>
35
+ </div>
36
+ </div>
37
+
38
+
@@ -0,0 +1,32 @@
1
+ <!doctype html>
2
+ <!--[if IE 9]><html class="lt-ie10" lang="en" > <![endif]-->
3
+ <html class="no-js" lang="en" data-useragent="Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)">
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Lanaya</title>
8
+ <link rel="stylesheet" href="/css/normalize.css" />
9
+ <link rel="stylesheet" href="/css/foundation.min.css" />
10
+ <link rel="stylesheet" href="/css/lanaya.css" />
11
+ </head>
12
+ <body>
13
+ <nav class="top-bar" data-topbar>
14
+ <ul class="title-area">
15
+ <li class="name">
16
+ <h1>
17
+ <a href="/">Lanaya</a>
18
+ </h1>
19
+ </li>
20
+ </ul>
21
+ </nav>
22
+
23
+ <div id="container" class="row">
24
+ <%= yield %>
25
+ </div>
26
+
27
+ <script src="/js/jquery.js"></script>
28
+ <script src="/js/foundation.min.js"></script>
29
+ <script src="/js/underscore-min.js"></script>
30
+ <script src="/js/lanaya.js"></script>
31
+ </body>
32
+ </html>
metadata ADDED
@@ -0,0 +1,225 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lanaya
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.dev
5
+ platform: ruby
6
+ authors:
7
+ - Meck
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: em-proxy
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.8
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.8
27
+ - !ruby/object:Gem::Dependency
28
+ name: http_parser.rb
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.6.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 0.6.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: uuid
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 2.3.7
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 2.3.7
55
+ - !ruby/object:Gem::Dependency
56
+ name: sinatra
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.4.4
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 1.4.4
69
+ - !ruby/object:Gem::Dependency
70
+ name: sinatra-contrib
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 1.4.2
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 1.4.2
83
+ - !ruby/object:Gem::Dependency
84
+ name: thin
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 1.5.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: 1.5.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: skinny
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 0.2.3
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 0.2.3
111
+ - !ruby/object:Gem::Dependency
112
+ name: activesupport
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 4.0.2
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: 4.0.2
125
+ - !ruby/object:Gem::Dependency
126
+ name: bundler
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ version: '1.5'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ~>
137
+ - !ruby/object:Gem::Version
138
+ version: '1.5'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rake
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: pry-nav
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ description: Lanaya provide a easy way to let you debug HTTP requests.
168
+ email:
169
+ - yesmeck@gmail.com
170
+ executables:
171
+ - lanaya
172
+ extensions: []
173
+ extra_rdoc_files: []
174
+ files:
175
+ - .gitignore
176
+ - Gemfile
177
+ - LICENSE.txt
178
+ - README.md
179
+ - Rakefile
180
+ - bin/lanaya
181
+ - lanaya.gemspec
182
+ - lib/lanaya.rb
183
+ - lib/lanaya/events.rb
184
+ - lib/lanaya/http/interaction.rb
185
+ - lib/lanaya/http/interaction_list.rb
186
+ - lib/lanaya/http/request.rb
187
+ - lib/lanaya/http/response.rb
188
+ - lib/lanaya/proxy.rb
189
+ - lib/lanaya/version.rb
190
+ - lib/lanaya/web.rb
191
+ - lib/lanaya/web/public/css/foundation.min.css
192
+ - lib/lanaya/web/public/css/lanaya.css
193
+ - lib/lanaya/web/public/css/normalize.css
194
+ - lib/lanaya/web/public/js/foundation.min.js
195
+ - lib/lanaya/web/public/js/jquery.js
196
+ - lib/lanaya/web/public/js/lanaya.coffee
197
+ - lib/lanaya/web/public/js/lanaya.js
198
+ - lib/lanaya/web/public/js/underscore-min.js
199
+ - lib/lanaya/web/views/index.erb
200
+ - lib/lanaya/web/views/layout.erb
201
+ homepage: ''
202
+ licenses:
203
+ - MIT
204
+ metadata: {}
205
+ post_install_message:
206
+ rdoc_options: []
207
+ require_paths:
208
+ - lib
209
+ required_ruby_version: !ruby/object:Gem::Requirement
210
+ requirements:
211
+ - - '>='
212
+ - !ruby/object:Gem::Version
213
+ version: '0'
214
+ required_rubygems_version: !ruby/object:Gem::Requirement
215
+ requirements:
216
+ - - '>'
217
+ - !ruby/object:Gem::Version
218
+ version: 1.3.1
219
+ requirements: []
220
+ rubyforge_project:
221
+ rubygems_version: 2.2.1
222
+ signing_key:
223
+ specification_version: 4
224
+ summary: A HTTP Debuger.
225
+ test_files: []