rack_console 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 52ea8e7199b864ee9eb5771258dcdba1b64181e5
4
- data.tar.gz: 42b0d1681e6d1fd6e679d8ed97f161f4e4b057f9
3
+ metadata.gz: 7120aad9356f5f31cf013d2adb6e3c0df0707358
4
+ data.tar.gz: 86fdf0c4a1d680d5c1dcad8c35716fb71e0778a2
5
5
  SHA512:
6
- metadata.gz: 887920281e5e9507852fc055805ee8185ae52f3fee4a2ad918312ea39cee800236e6f4f04a3ea3f5763c6b911d44a9921093b8a984994d60cf0d2531c3406a38
7
- data.tar.gz: f5160c4bbfdba16cecea4bd74ff0d097cc8e22f653f29553fc20c503c0d8ac66862f5f51d398ef9df2b782de5334aa8a3a680c2cbd8f0425c06bbc7316dde659
6
+ metadata.gz: 47c26a65af32882b275722bd22f7ad8a2b84d009b110b3505f19eaa4192624910a32262e2d86b64b778f31c1d029f6737a44e7469c6aeb1efa96482e19037063
7
+ data.tar.gz: 3a9795aa14d8a82c105778929a2a458c450893b027dcc626ee60a2f011f21f0c290fde5116e07229c55d6f0f7e51e40c36b367b9b6e79ed42c586c7129e24e73
@@ -1,10 +1,8 @@
1
1
  $:.unshift "../../lib"
2
2
  $:.unshift "."
3
3
  require 'rack_console/app'
4
- require 'pry'
5
4
  require 'app'
6
5
  use Rack::Reloader
7
- use Rack::Static, :urls => ["/css", "/img"], :root => "public"
8
6
  run Rack::URLMap.new(
9
7
  "/console" => RackConsole::App.new(
10
8
  awesome_print: true,
@@ -1,8 +1,12 @@
1
+ require 'rack/utils'
2
+
1
3
  module RackConsole
2
4
  class Ansi2Html
3
- def initialize
4
- @tag_b = { }
5
- @tag_e = { }
5
+ @@tag_b = { }
6
+ @@tag_e = { }
7
+
8
+ def self.convert str, out = nil
9
+ new.convert(str, out)
6
10
  end
7
11
 
8
12
  def convert str, out = nil
@@ -27,7 +31,7 @@ module RackConsole
27
31
  cls = CLASS_FOR_CODE[code]
28
32
  tag(:span, cls) unless cls.nil?
29
33
  end
30
- when /\A.*/
34
+ when /\A.+/
31
35
  text($&)
32
36
  end
33
37
  @str = $'
@@ -38,9 +42,9 @@ module RackConsole
38
42
  def tag name, cls
39
43
  if cls
40
44
  tag_b =
41
- @tag_b[[name, cls]] ||= %Q{<#{name} class="#{cls}">}.freeze
45
+ @@tag_b[[name, cls]] ||= %Q{<#{name} class="#{cls}">}.freeze
42
46
  tag_e =
43
- @tag_e[name] ||= %Q{</#{name}>}.freeze
47
+ @@tag_e[name] ||= %Q{</#{name}>}.freeze
44
48
  @tags << [ tag_b, tag_e ]
45
49
  @out << tag_b
46
50
  else
@@ -55,13 +59,14 @@ module RackConsole
55
59
  end
56
60
 
57
61
  def text str
62
+ return if str.empty?
58
63
  lines = str.split("\n", 99999)
59
64
  last = lines.pop
60
65
  lines.each do | line |
61
- @out << h(line)
66
+ @out << h(line) unless line.empty?
62
67
  @out << BR
63
68
  end
64
- @out << h(last)
69
+ @out << h(last) unless last.empty?
65
70
  end
66
71
 
67
72
  def h(text)
@@ -139,6 +139,16 @@ module RackConsole
139
139
  @result_class = @result.class.name
140
140
  end
141
141
 
142
+ def server_info
143
+ thr = Thread.current
144
+ (config[:server_info] || { }).merge(
145
+ host: Socket.gethostname,
146
+ pid: Process.pid,
147
+ ppid: Process.ppid,
148
+ thread: thr[:name] || thr.object_id,
149
+ )
150
+ end
151
+
142
152
  def format_object obj, inline = false
143
153
  case obj
144
154
  when Module
@@ -29,6 +29,34 @@
29
29
  color: #fff;
30
30
  }
31
31
 
32
+ .rack_console .server_info {
33
+ font-size: 80%;
34
+ float: right;
35
+ color: #888;
36
+ }
37
+
38
+ .rack_console .server_info .key {
39
+ font-style: italic;
40
+ }
41
+
42
+ .rack_console .server_info .value {
43
+ }
44
+
45
+ /* Hover to show */
46
+ .rack_console a.hover_show {
47
+ text-decoration: none;
48
+ }
49
+
50
+ .rack_console a.hover_show:hover span {
51
+ color: #000;
52
+ display: initial;
53
+ font-style: bold;
54
+ }
55
+
56
+ .rack_console span.display_on_hover {
57
+ display: none;
58
+ }
59
+
32
60
  .rack_console .result {
33
61
  margin: 0px;
34
62
  }
@@ -1,4 +1,5 @@
1
1
  .rack_console
2
+ =haml :'console/server_info', locals: locals
2
3
  .eval
3
4
  - evaluate_expr!
4
5
  %form{action: url_root("/"), method: "post"}
@@ -1,4 +1,5 @@
1
1
  .rack_console
2
+ =haml :'console/server_info', locals: locals
2
3
  .result
3
4
  .file
4
5
  %dl
@@ -1,4 +1,5 @@
1
1
  .rack_console
2
+ =haml :'console/server_info', locals: locals
2
3
  - evaluate_method!
3
4
  .result
4
5
  .method
@@ -1,4 +1,5 @@
1
1
  .rack_console
2
+ =haml :'console/server_info', locals: locals
2
3
  .result
3
4
  =haml :'console/methods_table', locals: locals.merge(methods: @methods)
4
5
  =haml :'console/error', locals: locals
@@ -1,4 +1,5 @@
1
1
  .methods
2
+ =haml :'console/server_info', locals: locals
2
3
  - if methods = locals[:methods]
3
4
  %table
4
5
  - @methods.each do | meth |
@@ -1,4 +1,5 @@
1
1
  .rack_console
2
+ =haml :'console/server_info', locals: locals
2
3
  - evaluate_module!
3
4
  .result
4
5
  .module
@@ -0,0 +1,8 @@
1
+ %span.server_info
2
+ - k_last = nil; server_info.each do | k, v |
3
+ = k_last ? " | " : ""
4
+ - k_last = k
5
+ %a.hover_show
6
+ %span.value= h v
7
+ %span.key
8
+ %span.display_on_hover= h " : #{k}"
@@ -2,8 +2,8 @@
2
2
  %html
3
3
  %head
4
4
  %title rack_console
5
- %link(rel="stylesheet" href="#{url_root}/css/rack_console.css")
6
- %link(rel="stylesheet" href="#{url_root}/css/ansi.css")
5
+ %link(rel="stylesheet" href="#{url_root "/css/rack_console.css"})
6
+ %link(rel="stylesheet" href="#{url_root "/css/ansi.css"})
7
7
  %body
8
8
  .wrapper
9
9
  .header
@@ -1,3 +1,3 @@
1
1
  module RackConsole
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack_console
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kurt Stephens
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-20 00:00:00.000000000 Z
11
+ date: 2015-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -165,8 +165,6 @@ files:
165
165
  - LICENSE.txt
166
166
  - README.md
167
167
  - Rakefile
168
- - bin/console
169
- - bin/setup
170
168
  - example/ex01/app.rb
171
169
  - example/ex01/config.ru
172
170
  - example/ex01/template/haml/index.haml
@@ -185,6 +183,7 @@ files:
185
183
  - lib/rack_console/template/haml/console/methods.haml
186
184
  - lib/rack_console/template/haml/console/methods_table.haml
187
185
  - lib/rack_console/template/haml/console/module.haml
186
+ - lib/rack_console/template/haml/console/server_info.haml
188
187
  - lib/rack_console/template/haml/layout.haml
189
188
  - lib/rack_console/version.rb
190
189
  - rack_console.gemspec
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "rack_console"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start
data/bin/setup DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here