tailog 0.2.2 → 0.2.3

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: 5ae968f41b69c5a08e5031228fb669f9e1562e1b
4
- data.tar.gz: a5db50f873a1f8bb9ebd92f2c254d466013cd49b
3
+ metadata.gz: 416d865f7f5f53cb6df3b7b7ebca932defe1fdf2
4
+ data.tar.gz: 7351b02573c0371d02f2d0fe87500e51ca9f4f10
5
5
  SHA512:
6
- metadata.gz: ec5f240daa46a439c932cd6dcaf1a596541fd3f0c172010bbad6871cc2f36d8daed61a62c8fcbad63788a4fd9c1edd9de671748fdd6f068444a5d203836028c8
7
- data.tar.gz: 3cc3e3f60881c2c4330f419d5e6f1983af8e163afc0fbdb6db9b9b7237f00c4f5c4d98f61fac0598001068b4c3a9d364eb6e470df3294860ab207c3f1714df47
6
+ metadata.gz: 44327da397ae3ad9df7b8698832df1702b48f89364a9297409ef1132876fcea875700c9aeceab1a0fcbf644b7afe2d7a664fb99a993fc443a6a85264d468bcc5
7
+ data.tar.gz: e2a43294cc467fb187a57729134ed45eae92d7cf7255539dab12ed09cd88ca87e1558f42c7330aeb45d5fe5f9da6c2c30c99f63ceaaa21c8ee7ae90b37331de3
@@ -7,9 +7,7 @@
7
7
  <h3 class="page-header"><%= file_path %></h3>
8
8
 
9
9
  <% File.open file_path do |file| %>
10
- <div id="content">
11
- <%= erb :'logs/list', locals: { file: file.tail(100).join("\n") } %>
12
- </div>
10
+ <div id="content"></div>
13
11
  <% end %>
14
12
 
15
13
  <script type="text/javascript">
@@ -31,7 +29,9 @@
31
29
 
32
30
  if (!data.content) return;
33
31
  var shouldScrollToBottom = $window.scrollTop() + $window.height() == $document.height();
34
- $(data.content).appendTo($content);
32
+ $content
33
+ .append('<p class="text-info">' + data.server_uuid + '</p>')
34
+ .append(data.content);
35
35
 
36
36
  if (shouldScrollToBottom) {
37
37
  $window.scrollTop($document.height() - $window.height());
@@ -1,4 +1,3 @@
1
- <p class="text-info"><%= Tailog.server_uuid %></p>
2
1
  <% file.each_line do |line| %>
3
2
  <p><%= h line %></p>
4
3
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module Tailog
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
data/lib/tailog.rb CHANGED
@@ -40,9 +40,13 @@ module Tailog
40
40
  file_path = File.join Tailog.log_path, params[:file]
41
41
  file = File.open file_path
42
42
  file_size = file.size
43
- seek = params[:seek] && params[:seek][Tailog.server_uuid] || file_size
44
- file.seek seek.to_i
45
- content = erb :'logs/list', locals: { file: file }, layout: false
43
+ tail = if seek = params[:seek] && params[:seek][Tailog.server_uuid]
44
+ file.seek seek.to_i
45
+ file
46
+ else
47
+ file.tail(100).join("\n")
48
+ end
49
+ content = erb :'logs/list', locals: { file: tail }, layout: false
46
50
  file.close
47
51
  rescue => error
48
52
  content = erb :error, locals: { error: error }, layout: false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tailog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - bbtfr