Hello community, here is the log from the commit of package rubygem-web-console for openSUSE:Factory checked in at 2018-09-20 11:41:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-web-console (Old) and /work/SRC/openSUSE:Factory/.rubygem-web-console.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-web-console" Thu Sep 20 11:41:48 2018 rev:17 rq:635255 version:3.7.0 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-web-console/rubygem-web-console.changes 2018-05-06 15:01:56.371988647 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-web-console.new/rubygem-web-console.changes 2018-09-20 11:41:50.756842928 +0200 @@ -1,0 +2,12 @@ +Wed Sep 5 10:47:25 UTC 2018 - co...@suse.com + +- updated to version 3.7.0 + see installed CHANGELOG.markdown + + ## 3.7.0 + + * [#263](https://github.com/rails/web-console/pull/263) Show binding changes ([@causztic]) + * [#258](https://github.com/rails/web-console/pull/258) Support Ctrl-A, Ctrl-W and Ctrl-U ([@gsamokovarov]) + * [#257](https://github.com/rails/web-console/pull/257) Always try to keep the console underneath the website content ([@gsamokovarov]) + +------------------------------------------------------------------- Old: ---- web-console-3.6.2.gem New: ---- web-console-3.7.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-web-console.spec ++++++ --- /var/tmp/diff_new_pack.O0Psws/_old 2018-09-20 11:41:51.412842543 +0200 +++ /var/tmp/diff_new_pack.O0Psws/_new 2018-09-20 11:41:51.416842540 +0200 @@ -24,7 +24,7 @@ # Name: rubygem-web-console -Version: 3.6.2 +Version: 3.7.0 Release: 0 %define mod_name web-console %define mod_full_name %{mod_name}-%{version} ++++++ web-console-3.6.2.gem -> web-console-3.7.0.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.markdown new/CHANGELOG.markdown --- old/CHANGELOG.markdown 2018-04-29 20:40:18.000000000 +0200 +++ new/CHANGELOG.markdown 2018-09-02 21:44:49.000000000 +0200 @@ -2,6 +2,12 @@ ## master (unreleased) +## 3.7.0 + +* [#263](https://github.com/rails/web-console/pull/263) Show binding changes ([@causztic]) +* [#258](https://github.com/rails/web-console/pull/258) Support Ctrl-A, Ctrl-W and Ctrl-U ([@gsamokovarov]) +* [#257](https://github.com/rails/web-console/pull/257) Always try to keep the console underneath the website content ([@gsamokovarov]) + ## 3.6.2 * [#255](https://github.com/rails/web-console/pull/255) Fix the truncated HTML body, because of wrong Content-Length header ([@timomeh]) @@ -131,3 +137,4 @@ [@ybart]: https://github.com/ybart [@fl0l0u]: https://github.com/fl0l0u [@timomeh]: https://github.com/timomeh +[@causztic]: https://github.com/causztic diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.markdown new/README.markdown --- old/README.markdown 2018-04-29 20:40:18.000000000 +0200 +++ new/README.markdown 2018-09-02 21:44:49.000000000 +0200 @@ -94,7 +94,7 @@ > Cannot render console from 192.168.1.133! Allowed networks: > 127.0.0.0/127.255.255.255, ::1 -If you don't wanna see this message anymore, set this option to `false`: +If you don't want to see this message anymore, set this option to `false`: ```ruby Rails.application.configure do @@ -104,7 +104,7 @@ ### config.web_console.template_paths -If you wanna style the console yourself, you can place `style.css` at a +If you want to style the console yourself, you can place `style.css` at a directory pointed by `config.web_console.template_paths`: ```ruby @@ -113,13 +113,13 @@ end ``` -You may wanna check the [templates] folder at the source tree for the files you +You may want to check the [templates] folder at the source tree for the files you may override. ### config.web_console.mount_point Usually the middleware of _Web Console_ is mounted at `/__web_console`. -If you wanna change the path for some reasons, you can specify it +If you want to change the path for some reasons, you can specify it by `config.web_console.mount_point`: ```ruby @@ -137,7 +137,7 @@ If you miss this feature, check out [rvt]. -### Why I constantly get unavailable session errors? +### Why do I constantly get unavailable session errors? All of _Web Console_ sessions are stored in memory. If you happen to run on a multi-process server (like Unicorn) you may get unavailable session errors @@ -146,12 +146,17 @@ To avoid that, if you use such servers in development, configure them so they server requests only out of one process. +#### Passenger + +Enable sticky sessions for [Passenger on Nginx] or [Passenger on Apache] to +prevent unavailable session errors. + ### How to inspect local and instance variables? The interactive console executes Ruby code. Invoking `instance_variables` and `local_variables` will give you what you want. -### Why does console only appear on error pages but not when I call it? +### Why does the console only appear on error pages but not when I call it? This can be happening if you are using `Rack::Deflater`. Be sure that `WebConsole::Middleware` is used after `Rack::Deflater`. The easiest way to do @@ -163,7 +168,7 @@ end ``` -### Why I'm getting an undefined method `web_console`? +### Why am I getting an undefined method `web_console`? Make sure your configuration lives in `config/environments/development.rb`. @@ -183,3 +188,5 @@ [templates]: https://github.com/rails/web-console/tree/master/lib/web_console/templates [rvt]: https://github.com/gsamokovarov/rvt [contributors]: https://github.com/rails/web-console/graphs/contributors +[Passenger on Nginx]: https://www.phusionpassenger.com/library/config/nginx/reference/#passengerstickysessions +[Passenger on Apache]: https://www.phusionpassenger.com/library/config/apache/reference/#passengerstickysessions Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/web_console/templates/console.js.erb new/lib/web_console/templates/console.js.erb --- old/lib/web_console/templates/console.js.erb 2018-04-29 20:40:18.000000000 +0200 +++ new/lib/web_console/templates/console.js.erb 2018-09-02 21:44:49.000000000 +0200 @@ -603,6 +603,12 @@ return consoleMessage; }; +REPLConsole.prototype.writeNotification = function(output) { + var consoleMessage = this.writeOutput(output); + addClass(consoleMessage, "notification-message"); + return consoleMessage; +}; + REPLConsole.prototype.onEnterKey = function() { var input = this._input; @@ -654,57 +660,85 @@ } switch (ev.keyCode) { - case 69: - // Ctrl-E + case 65: // Ctrl-A + if (ev.ctrlKey) { + this.setInput(this._input, 0); + ev.preventDefault(); + } + break; + + case 69: // Ctrl-E if (ev.ctrlKey) { this.onTabKey(); ev.preventDefault(); } break; - case 9: - // Tab + + case 87: // Ctrl-W + if (ev.ctrlKey) { + this.deleteWord(); + ev.preventDefault(); + } + break; + + case 85: // Ctrl-U + if (ev.ctrlKey) { + this.deleteLine(); + ev.preventDefault(); + } + break; + + case 69: // Ctrl-E + if (ev.ctrlKey) { + this.onTabKey(); + ev.preventDefault(); + } + break; + + case 80: // Ctrl-P + if (! ev.ctrlKey) break; + + case 78: // Ctrl-N + if (! ev.ctrlKey) break; + + case 9: // Tab this.onTabKey(); ev.preventDefault(); break; - case 13: - // Enter key + + case 13: // Enter key this.onEnterKey(); ev.preventDefault(); break; - case 80: - // Ctrl-P - if (! ev.ctrlKey) break; - case 38: - // Up arrow + + case 38: // Up arrow this.onNavigateHistory(-1); ev.preventDefault(); break; - case 78: - // Ctrl-N - if (! ev.ctrlKey) break; - case 40: - // Down arrow + + case 40: // Down arrow this.onNavigateHistory(1); ev.preventDefault(); break; - case 37: - // Left arrow + + case 37: // Left arrow var caretPos = this._caretPos > 0 ? this._caretPos - 1 : this._caretPos; this.setInput(this._input, caretPos); ev.preventDefault(); break; - case 39: - // Right arrow + + case 39: // Right arrow var length = this._input.length; var caretPos = this._caretPos < length ? this._caretPos + 1 : this._caretPos; this.setInput(this._input, caretPos); ev.preventDefault(); break; - case 8: - // Delete + + case 8: // Delete this.deleteAtCurrent(); ev.preventDefault(); break; + default: break; } @@ -758,6 +792,47 @@ }; /** + * Deletes the current line. + */ +REPLConsole.prototype.deleteLine = function() { + if (this._caretPos > 0) { + this.setInput("", 0); + + if (!this._input) { + this.autocomplete && this.autocomplete.cancel(); + this.autocomplete = false; + } + } +}; + +/** + * Deletes the current word. + */ +REPLConsole.prototype.deleteWord = function() { + if (this._caretPos > 0) { + var i = 1, current = this._caretPos; + while (this._input[current - i++] == " "); + + var deleteIndex = 0; + for (; current - i > 0; i++) { + if (this._input[current - i] == " ") { + deleteIndex = current - i; + break; + } + } + + var before = this._input.substring(0, deleteIndex); + var after = this._input.substring(current, this._input.length); + this.setInput(before + after, deleteIndex); + + if (!this._input) { + this.autocomplete && this.autocomplete.cancel(); + this.autocomplete = false; + } + } +}; + +/** * Insert a character at the current position. */ REPLConsole.prototype.insertAtCurrent = function(char) { @@ -795,11 +870,16 @@ this.outer.scrollTop = this.outer.scrollHeight; }; -// Change the binding of the console +// Change the binding of the console. REPLConsole.prototype.switchBindingTo = function(frameId, callback) { var url = this.getSessionUrl('trace'); var params = "frame_id=" + encodeURIComponent(frameId); - postRequest(url, params, callback); + + var _this = this; + postRequest(url, params, function() { + var text = "Context has changed to: " + callback(); + _this.writeNotification(text); + }); }; /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/web_console/templates/error_page.js.erb new/lib/web_console/templates/error_page.js.erb --- old/lib/web_console/templates/error_page.js.erb 2018-04-29 20:40:18.000000000 +0200 +++ new/lib/web_console/templates/error_page.js.erb 2018-09-02 21:44:49.000000000 +0200 @@ -11,12 +11,9 @@ // Change the binding of the console. changeBinding(frameId, function() { - if (selectedFrame) { - selectedFrame.className = selectedFrame.className.replace("selected", ""); - } - - target.className += " selected"; + // Rails already handles toggling the select class selectedFrame = target; + return target.innerHTML; }); // Change the extracted source code @@ -24,6 +21,7 @@ }); } +// Change the binding of the current session and prompt the user. function changeBinding(frameId, callback) { REPLConsole.currentSession.switchBindingTo(frameId, callback); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/web_console/templates/index.html.erb new/lib/web_console/templates/index.html.erb --- old/lib/web_console/templates/index.html.erb 2018-04-29 20:40:18.000000000 +0200 +++ new/lib/web_console/templates/index.html.erb 2018-09-02 21:44:49.000000000 +0200 @@ -6,3 +6,7 @@ <% only_on_error_page do %> <%= render_javascript 'error_page' %> <% end %> + +<% only_on_regular_page do %> + <%= render_javascript 'regular_page' %> +<% end %> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/web_console/templates/regular_page.js.erb new/lib/web_console/templates/regular_page.js.erb --- old/lib/web_console/templates/regular_page.js.erb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/web_console/templates/regular_page.js.erb 2018-09-02 21:44:49.000000000 +0200 @@ -0,0 +1,24 @@ +// Push the error page body upwards the size of the console. +document.addEventListener('DOMContentLoaded', function() { + var consoleElement = document.getElementById('console'); + var resizerElement = consoleElement.getElementsByClassName('resizer')[0]; + var bodyElement = document.body; + + function setBodyElementBottomMargin(pixels) { + bodyElement.style.marginBottom = pixels + 'px'; + } + + var currentConsoleElementHeight = consoleElement.offsetHeight; + setBodyElementBottomMargin(currentConsoleElementHeight); + + resizerElement.addEventListener('mousedown', function(event) { + function recordConsoleElementHeight(event) { + resizerElement.removeEventListener('mouseup', recordConsoleElementHeight); + + var currentConsoleElementHeight = consoleElement.offsetHeight; + setBodyElementBottomMargin(currentConsoleElementHeight); + } + + resizerElement.addEventListener('mouseup', recordConsoleElementHeight); + }); +}); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/web_console/templates/style.css.erb new/lib/web_console/templates/style.css.erb --- old/lib/web_console/templates/style.css.erb 2018-04-29 20:40:18.000000000 +0200 +++ new/lib/web_console/templates/style.css.erb 2018-09-02 21:44:49.000000000 +0200 @@ -10,7 +10,8 @@ .console .console-inner { font-family: monospace; font-size: 11px; width: 100%; height: 100%; overflow: none; background: #333; } .console .console-prompt-box { color: #FFF; } .console .console-message { color: #1AD027; margin: 0; border: 0; white-space: pre-wrap; background-color: #333; padding: 0; } -.console .console-message.error-message { color: #fc9; } +.console .console-message.error-message { color: #FC9; } +.console .console-message.notification-message { color: #99F; } .console .console-message.auto-complete { word-break: break-all; } .console .console-message.auto-complete .keyword { margin-right: 11px; } .console .console-message.auto-complete .keyword.selected { background: #FFF; color: #000; } @@ -21,8 +22,8 @@ .console .resizer { background: #333; width: 100%; height: 4px; cursor: ns-resize; } .console .console-actions { padding-right: 3px; } .console .console-actions .button { float: left; } -.console .button { cursor: pointer; border-radius: 1px; font-family: monospace; font-size: 13px; width: 14px; height: 14px; line-height: 14px; text-align: center; color: #ccc; } -.console .button:hover { background: #666; color: #fff; } +.console .button { cursor: pointer; border-radius: 1px; font-family: monospace; font-size: 13px; width: 14px; height: 14px; line-height: 14px; text-align: center; color: #CCC; } +.console .button:hover { background: #666; color: #FFF; } .console .button.close-button:hover { background: #966; } .console .clipboard { height: 0px; padding: 0px; margin: 0px; width: 0px; margin-left: -1000px; } .console .console-prompt-label { display: inline; color: #FFF; background: none repeat scroll 0% 0% #333; border: 0; padding: 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/web_console/version.rb new/lib/web_console/version.rb --- old/lib/web_console/version.rb 2018-04-29 20:40:18.000000000 +0200 +++ new/lib/web_console/version.rb 2018-09-02 21:44:49.000000000 +0200 @@ -1,5 +1,5 @@ # frozen_string_literal: true module WebConsole - VERSION = "3.6.2" + VERSION = "3.7.0" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/web_console/view.rb new/lib/web_console/view.rb --- old/lib/web_console/view.rb 2018-04-29 20:40:18.000000000 +0200 +++ new/lib/web_console/view.rb 2018-09-02 21:44:49.000000000 +0200 @@ -10,6 +10,11 @@ yield if Thread.current[:__web_console_exception].present? end + # Execute a block only on regular, non-error, pages. + def only_on_regular_page(*args) + yield if Thread.current[:__web_console_binding].present? + end + # Render JavaScript inside a script tag and a closure. # # This one lets write JavaScript that will automatically get wrapped in a diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2018-04-29 20:40:18.000000000 +0200 +++ new/metadata 2018-09-02 21:44:49.000000000 +0200 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: web-console version: !ruby/object:Gem::Version - version: 3.6.2 + version: 3.7.0 platform: ruby authors: - Charlie Somerville @@ -11,7 +11,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2018-04-29 00:00:00.000000000 Z +date: 2018-09-02 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: railties @@ -108,6 +108,7 @@ - lib/web_console/templates/layouts/inlined_string.erb - lib/web_console/templates/layouts/javascript.erb - lib/web_console/templates/main.js.erb +- lib/web_console/templates/regular_page.js.erb - lib/web_console/templates/style.css.erb - lib/web_console/testing/erb_precompiler.rb - lib/web_console/testing/fake_middleware.rb @@ -136,7 +137,7 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.7.3 +rubygems_version: 2.7.6 signing_key: specification_version: 4 summary: A debugging tool for your Ruby on Rails applications.