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 +4 -4
- data/example/ex01/config.ru +0 -2
- data/lib/rack_console/ansi2html.rb +13 -8
- data/lib/rack_console/app_helpers.rb +10 -0
- data/lib/rack_console/template/css/rack_console.css +28 -0
- data/lib/rack_console/template/haml/console.haml +1 -0
- data/lib/rack_console/template/haml/console/file.haml +1 -0
- data/lib/rack_console/template/haml/console/method.haml +1 -0
- data/lib/rack_console/template/haml/console/methods.haml +1 -0
- data/lib/rack_console/template/haml/console/methods_table.haml +1 -0
- data/lib/rack_console/template/haml/console/module.haml +1 -0
- data/lib/rack_console/template/haml/console/server_info.haml +8 -0
- data/lib/rack_console/template/haml/layout.haml +2 -2
- data/lib/rack_console/version.rb +1 -1
- metadata +3 -4
- data/bin/console +0 -14
- data/bin/setup +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7120aad9356f5f31cf013d2adb6e3c0df0707358
|
4
|
+
data.tar.gz: 86fdf0c4a1d680d5c1dcad8c35716fb71e0778a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47c26a65af32882b275722bd22f7ad8a2b84d009b110b3505f19eaa4192624910a32262e2d86b64b778f31c1d029f6737a44e7469c6aeb1efa96482e19037063
|
7
|
+
data.tar.gz: 3a9795aa14d8a82c105778929a2a458c450893b027dcc626ee60a2f011f21f0c290fde5116e07229c55d6f0f7e51e40c36b367b9b6e79ed42c586c7129e24e73
|
data/example/ex01/config.ru
CHANGED
@@ -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
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
45
|
+
@@tag_b[[name, cls]] ||= %Q{<#{name} class="#{cls}">}.freeze
|
42
46
|
tag_e =
|
43
|
-
|
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
|
}
|
@@ -2,8 +2,8 @@
|
|
2
2
|
%html
|
3
3
|
%head
|
4
4
|
%title rack_console
|
5
|
-
%link(rel="stylesheet" href="#{url_root
|
6
|
-
%link(rel="stylesheet" href="#{url_root
|
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
|
data/lib/rack_console/version.rb
CHANGED
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.
|
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-
|
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
|