tailog 0.4.5 → 0.4.6

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: 9acfd30ad249643240d7556fd87843c9d081b266
4
- data.tar.gz: 4bd8e65ac5c0586045d561c440c499988177b6fe
3
+ metadata.gz: d53a856b16930a158220e417df007ecafd660a94
4
+ data.tar.gz: 92915c4153eaa26f10a556f14b2d89bab5db80bc
5
5
  SHA512:
6
- metadata.gz: df89cfa38ab849f609ba785bd08b67332018d9a0398907d4642c389114f648f45ff26a9d5c3f98826e96c8ff490fe87727d85eb80a7f5fbdcbc0d8b00623f5ff
7
- data.tar.gz: 962b6460a8a1b0c6c03048f84ca8083b3ab6fed07ac56cbaaddb7e4d3d7895fb9392064eee5d9c6f568d7fb8dcf2994e5887c238938e64e183aca32bf76da847
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.
@@ -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>
@@ -1,16 +1,38 @@
1
1
  <% begin %>
2
- <% b = binding %>
3
- <% script.each_line do |line| %>
4
- <% next if line.strip.empty? %>
5
- <p class="text-info">&gt; <%= h line %></p>
6
- <% begin %>
7
- <% result = b.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 %>
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">&gt; <%= 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 %>
@@ -1,3 +1,3 @@
1
1
  module Tailog
2
- VERSION = "0.4.5"
2
+ VERSION = "0.4.6"
3
3
  end
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.5
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-02 00:00:00.000000000 Z
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