tailog 0.4.5 → 0.4.6
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 +4 -4
- data/README.md +15 -0
- data/app/views/script/index.erb +1 -0
- data/app/views/script/ruby.erb +32 -10
- data/app/views/script/ruby_debug.erb +16 -0
- data/lib/tailog/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d53a856b16930a158220e417df007ecafd660a94
|
4
|
+
data.tar.gz: 92915c4153eaa26f10a556f14b2d89bab5db80bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b99e4df406c9ba6924d503a96867ac323b4dd1b4df6a3fe458cdb9bbed0aa6670f18f6780dc269f5161583bbcef32f5856c78ca61326d8e64135fe86107872b2
|
7
|
+
data.tar.gz: 54b793acaf5746cb7d86ab03fe5ed8f1127796ba60166ff00692da777083073f535ae29f7848c8e0389d26a96b2bb961925312f78285363727d48e020de92f7f
|
data/README.md
CHANGED
@@ -35,6 +35,21 @@ run Rack::URLMap.new(
|
|
35
35
|
)
|
36
36
|
```
|
37
37
|
|
38
|
+
You can turn on authentication by adding:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
require 'tailog'
|
42
|
+
|
43
|
+
Tailog::App.use Rack::Auth::Basic do |username, password|
|
44
|
+
username == 'username' && password == 'password'
|
45
|
+
end
|
46
|
+
|
47
|
+
run Rack::URLMap.new(
|
48
|
+
'/' => Your::App,
|
49
|
+
'/tailog' => Tailog::App
|
50
|
+
)
|
51
|
+
```
|
52
|
+
|
38
53
|
## Development
|
39
54
|
|
40
55
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/app/views/script/index.erb
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
<div class="pull-right">
|
6
6
|
<select name="type" class="form-control">
|
7
7
|
<option value="ruby">Ruby</option>
|
8
|
+
<option value="ruby_debug">Ruby (Debug Mode)</option>
|
8
9
|
<option value="bash">Bash</option>
|
9
10
|
</select>
|
10
11
|
<button type="submit" class="btn btn-primary">Submit</button>
|
data/app/views/script/ruby.erb
CHANGED
@@ -1,16 +1,38 @@
|
|
1
1
|
<% begin %>
|
2
|
-
|
3
|
-
<%
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
2
|
+
|
3
|
+
<% # redefine print, puts & p
|
4
|
+
|
5
|
+
OUTPUT = StringIO.new
|
6
|
+
|
7
|
+
def print *args
|
8
|
+
OUTPUT.print *args
|
9
|
+
end
|
10
|
+
|
11
|
+
def puts *args
|
12
|
+
OUTPUT.puts *args
|
13
|
+
end
|
14
|
+
|
15
|
+
def p *args
|
16
|
+
OUTPUT.puts *args.map(&:inspect)
|
17
|
+
end
|
18
|
+
|
19
|
+
%>
|
20
|
+
|
21
|
+
<% begin %>
|
22
|
+
<% binding = Object.new.send :binding %>
|
23
|
+
<% binding.eval(script, "(script)", 1) %>
|
24
|
+
<% OUTPUT.string.each_line do |line| %>
|
25
|
+
<p><%= h line %></p>
|
26
|
+
<% end %>
|
27
|
+
<% rescue => error %>
|
28
|
+
<p class="text-danger"><%= h error.class %>: <%= h error.message %></p>
|
29
|
+
<% error.backtrace.each do |backtrace| %>
|
30
|
+
<% next unless backtrace.start_with? "(script)" %>
|
31
|
+
<p class="text-danger"> <%= h backtrace %></p>
|
12
32
|
<% end %>
|
13
33
|
<% end %>
|
34
|
+
|
14
35
|
<% rescue => error %>
|
15
36
|
<%= erb :error, locals: { error: error }, layout: false %>
|
16
37
|
<% end %>
|
38
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% begin %>
|
2
|
+
<% binding = Object.new.send :binding %>
|
3
|
+
<% script.each_line do |line| %>
|
4
|
+
<% next if line.strip.empty? %>
|
5
|
+
<p class="text-info">> <%= h line %></p>
|
6
|
+
<% begin %>
|
7
|
+
<% result = binding.eval(line).inspect %>
|
8
|
+
<p>=> <%= h result %></p>
|
9
|
+
<% rescue => error %>
|
10
|
+
<p class="text-danger"><%= h error.class %>: <%= h error.message %></p>
|
11
|
+
<% break %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
14
|
+
<% rescue => error %>
|
15
|
+
<%= erb :error, locals: { error: error }, layout: false %>
|
16
|
+
<% end %>
|
data/lib/tailog/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tailog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bbtfr
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- app/views/script/bash.erb
|
85
85
|
- app/views/script/index.erb
|
86
86
|
- app/views/script/ruby.erb
|
87
|
+
- app/views/script/ruby_debug.erb
|
87
88
|
- bin/console
|
88
89
|
- bin/setup
|
89
90
|
- lib/tailog.rb
|