logs 0.1.0 → 0.2.0

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: 0b0a59c8f7f09ee1cb826e208a1c9a5c03c32efa
4
- data.tar.gz: ae96939a86a3f83da068d89fb82e3fe9a704fcbf
3
+ metadata.gz: 7121cb4c518d423dc7994245592395be950963d5
4
+ data.tar.gz: a913973d245b50124294e60be02a9561e8f84a63
5
5
  SHA512:
6
- metadata.gz: bcbba475720a5f4ddbdcd1fc35d96112371a479ffd7c411a2e20acdc58a77403c56bf7fa238248dde0f10b511c1069a298d790725f0df1990d1073cc33acafcb
7
- data.tar.gz: a83e431461013e1045f5b1c138a0b71ad2a093d4404cf728ef1d189477fc4619bc8131162eeaa54a7344028c65d353dcb1be879ce4d29c1d69d279934c151642
6
+ metadata.gz: f2fc3d12532e9844d6464996202d9d934c6bdbee5da223120a66bfd8d0c2d55e9c6bde47d70958a56c73e2ad8b9cb0a94a157ab16951904bceaaab83ade47d53
7
+ data.tar.gz: 1897bae2d3b4635f279255296433815f2744bb00614e83e337608cbce4f5fbc9e60163c773841bd1e867a4aa1792f7337a0f624d2bdfaac1b22e4b53616fc597
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Logs
2
- Mountable Rails Engine to see paginated logs with search from browser
2
+ Mountable Rails Engine for viewing paginated logs from a browser
3
3
 
4
4
  ## Installation
5
5
  Add this line to your application's Gemfile:
@@ -13,5 +13,18 @@ And then execute:
13
13
  $ bundle
14
14
  ```
15
15
 
16
+ Mount Engine:
17
+
18
+ `config/routes.rb`
19
+ ```ruby
20
+ Rails.application.routes.draw do
21
+ mount Logs::Engine => '/logs'
22
+ end
23
+ ```
24
+
25
+ Look up on `/logs` route.
26
+
27
+ ![Logs](https://github.com/kirillshevch/logs/blob/master/demo.jpg "Logs")
28
+
16
29
  ## License
17
30
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -14,15 +14,15 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
17
- APP_RAKEFILE = File.expand_path('../test/dummy/Rakefile', __FILE__)
17
+ APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
18
18
  load 'rails/tasks/engine.rake'
19
19
  load 'rails/tasks/statistics.rake'
20
20
  require 'bundler/gem_tasks'
21
21
  require 'rake/testtask'
22
22
 
23
23
  Rake::TestTask.new(:test) do |t|
24
- t.libs << 'test'
25
- t.pattern = 'test/**/*_test.rb'
24
+ t.libs << 'spec'
25
+ t.pattern = 'spec/**/*_spec.rb'
26
26
  t.verbose = false
27
27
  end
28
28
 
@@ -10,6 +10,7 @@
10
10
  * files in this directory. Styles in this file should be added after the last require_* statement.
11
11
  * It is generally better to create a new file per style scope.
12
12
  *
13
+ *= require wind
13
14
  *= require_tree .
14
15
  *= require_self
15
- */
16
+ */
@@ -0,0 +1,25 @@
1
+ body {
2
+ padding: 10px 50px 50px 50px;
3
+ }
4
+
5
+ .nav--inline {
6
+ display: inline-flex;
7
+ }
8
+
9
+ .all-pages {
10
+ margin-top: 17px;
11
+ }
12
+
13
+ @media (max-width: 1024px) {
14
+ .nav-logo p {
15
+ font-size: 30px;
16
+ }
17
+
18
+ .nav h5 {
19
+ font-size: 60px;
20
+ }
21
+
22
+ .nav-pagination {
23
+ font-size: 32px;
24
+ }
25
+ }
@@ -0,0 +1,23 @@
1
+ require 'active_support/concern'
2
+
3
+ module Logs
4
+ module Concerns
5
+ module LogsLoader
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ before_action :load_logs
10
+ before_action :load_logs_list
11
+
12
+ def load_logs
13
+ file_name = params[:name] || Rails.env
14
+ @logs = Logs::Viewer.call(file_name).read
15
+ end
16
+
17
+ def load_logs_list
18
+ @log_files = Logs::Files.all
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,33 @@
1
+ require 'active_support/concern'
2
+
3
+ module Logs
4
+ module Concerns
5
+ module Pagination
6
+ extend ActiveSupport::Concern
7
+
8
+ PER_PAGE = 50
9
+ PAGE = 1
10
+
11
+ included do
12
+ before_action :rendered_logs
13
+
14
+ def rendered_logs
15
+ @per_page = (params[:per_page] || PER_PAGE).to_i
16
+ @page = (params[:page] || PAGE).to_i
17
+ file_name = params[:name] || Rails.env
18
+
19
+ range = (@page - 1) * @per_page..@per_page * @page - 1
20
+
21
+ @rendered_logs = Logs::Viewer.call(file_name).readlines[range].join
22
+
23
+ @pages = calculate_pages.to_i
24
+ end
25
+
26
+ def calculate_pages
27
+ float_count = @logs.each_line.count.to_f / @per_page.to_f
28
+ float_count != float_count.round ? float_count + 1 : float_count
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,12 @@
1
+ require_dependency 'logs/application_controller'
2
+
3
+ module Logs
4
+ class LogsController < ApplicationController
5
+ include Logs::Concerns::LogsLoader
6
+ include Logs::Concerns::Pagination
7
+
8
+ def index; end
9
+
10
+ def show; end
11
+ end
12
+ end
@@ -1,4 +1,15 @@
1
1
  module Logs
2
2
  module ApplicationHelper
3
+ def log_file
4
+ (params[:name] || Rails.env) + '.log'
5
+ end
6
+
7
+ def log_file_path(log_name)
8
+ root_path + log_name
9
+ end
10
+
11
+ def lines(file)
12
+ file.each_line.count.to_s
13
+ end
3
14
  end
4
15
  end
@@ -0,0 +1,21 @@
1
+ module Logs
2
+ module NavPaginationHelper
3
+ def pages_range
4
+ if first_range.include? @page
5
+ @pages.times.map { |i| i + 1 }[first_range]
6
+ elsif last_range.include? @page
7
+ (@pages + 1).times.map { |i| i }[last_range]
8
+ else
9
+ (@pages).times.map { |i| i }[@page - 1..@page + 8]
10
+ end
11
+ end
12
+
13
+ def last_range
14
+ @pages - 9..@pages
15
+ end
16
+
17
+ def first_range
18
+ 0..9
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,8 @@
1
+ module Logs
2
+ class Files
3
+ def self.all
4
+ files = ::FileList.new('log/*') { |f| f }
5
+ files.map { |f| f.split('log/')[1] }
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ module Logs
2
+ class Viewer
3
+ LOG_PATH = Rails.root + 'log/'
4
+
5
+ def self.call(file_name)
6
+ File.open(LOG_PATH + (file_name + '.log'))
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta(content="text/html; charset=UTF-8" http-equiv="Content-Type")
5
+ %title Logs
6
+ = stylesheet_link_tag "logs/application", media: "all"
7
+ = javascript_include_tag "logs/application"
8
+ = csrf_meta_tags
9
+ %body
10
+ = yield
@@ -0,0 +1 @@
1
+ = render 'shared/layout'
@@ -0,0 +1 @@
1
+ = render 'shared/layout'
@@ -0,0 +1,8 @@
1
+ .nav
2
+ %h5.nav-logo
3
+ = I18n.t('logs.log_file') + log_file
4
+ .nav-logo
5
+ %p
6
+ = I18n.t('logs.lines') + lines(@logs)
7
+ %p
8
+ = I18n.t('logs.pages') + @pages.to_s
@@ -0,0 +1,6 @@
1
+ = render 'shared/header'
2
+ .row.nav-pagination
3
+ = render 'shared/navbar'
4
+ = render 'shared/nav_pagination'
5
+ = render 'shared/logs'
6
+ = render 'shared/pagination'
@@ -0,0 +1,4 @@
1
+ %div
2
+ - @rendered_logs.each_line do |log_line|
3
+ %div
4
+ = log_line
@@ -0,0 +1,15 @@
1
+ .nav.nav--inline
2
+ - if @page >= 10
3
+ .nav-item
4
+ = link_to I18n.t('logs.first'), log_file_path(log_file)
5
+
6
+ - pages_range.each do |page|
7
+ .nav-item
8
+ - if page != @page
9
+ = link_to page, log_file_path(log_file) + "?page=#{page}"
10
+ - else
11
+ = page
12
+
13
+ - if last_range != (pages_range[0]..pages_range.last) && @pages > 10
14
+ .nav-item
15
+ = link_to I18n.t('logs.last'), log_file_path(log_file) + "?page=#{@pages}"
@@ -0,0 +1,3 @@
1
+ .nav
2
+ - @log_files.each do |log_file|
3
+ = link_to log_file, log_file_path(log_file), class: 'nav-item'
@@ -0,0 +1,7 @@
1
+ .row.all-pages
2
+ %h6
3
+ = I18n.t('logs.all_pages')
4
+ %div
5
+ - @pages.times do |i|
6
+ - page = i + 1
7
+ = link_to page, log_file_path(log_file) + "?page=#{page}"
@@ -0,0 +1,8 @@
1
+ en:
2
+ logs:
3
+ log_file: 'Log file: '
4
+ lines: 'Lines: '
5
+ pages: 'Pages: '
6
+ last: 'last »'
7
+ first: '« first'
8
+ all_pages: 'All pages: '
@@ -1,2 +1,7 @@
1
1
  Logs::Engine.routes.draw do
2
+ root 'logs#index'
3
+
4
+ get ':name', to: 'logs#show'
5
+
6
+ resources :logs, only: %i[index show]
2
7
  end
@@ -1,5 +1 @@
1
1
  require 'logs/engine'
2
-
3
- module Logs
4
- # Your code goes here...
5
- end
@@ -1,5 +1,23 @@
1
1
  module Logs
2
2
  class Engine < ::Rails::Engine
3
+ %w[haml-rails rake].each { |f| require f }
4
+
3
5
  isolate_namespace Logs
6
+
7
+ config.to_prepare do
8
+ folders = ['app/services/logs/*', 'app/*/logs/concerns/*']
9
+ folders.each do |folder|
10
+ Dir.glob(Engine.root + folder).each do |c|
11
+ require_dependency(c)
12
+ end
13
+ end
14
+ end
15
+
16
+ config.generators do |g|
17
+ g.test_framework :rspec
18
+ g.stylesheets false
19
+ g.javascripts false
20
+ g.template_engine :haml
21
+ end
4
22
  end
5
23
  end
@@ -1,3 +1,3 @@
1
1
  module Logs
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -0,0 +1,531 @@
1
+ /**
2
+ * Wing v1.0.0-beta
3
+ * Copyright 2016-2017 Kabir Shah
4
+ * Released under the MIT License
5
+ * http://usewing.ml
6
+ */
7
+
8
+ /*=============================
9
+ Base Styles
10
+ =============================*/
11
+ * {
12
+ box-sizing: border-box;
13
+ }
14
+ html,
15
+ body {
16
+ margin: 0;
17
+ padding: 0;
18
+ }
19
+ body {
20
+ line-height: 1.6;
21
+ color: #111;
22
+ font-size: 1rem;
23
+ font-weight: 400;
24
+ font-family: -apple-system, BlinkMacSystemFont, Avenir, "Avenir Next", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
25
+ }
26
+ /*=============================
27
+ Grid
28
+ =============================*/
29
+ .container {
30
+ width: 80%;
31
+ max-width: 960px;
32
+ margin: 0 auto;
33
+ }
34
+ .row {
35
+ display: flex;
36
+ flex-flow: row wrap;
37
+ justify-content: space-between;
38
+ width: 100%;
39
+ margin-bottom: 10px;
40
+ }
41
+ .row:last-child {
42
+ margin-bottom: 0;
43
+ }
44
+ .row .col {
45
+ flex: 1 1 0px;
46
+ }
47
+ .row .col,
48
+ .row [class^="col-"],
49
+ .row [class*=" col-"] {
50
+ padding-right: 10px;
51
+ }
52
+ .row .col:last-child,
53
+ .row [class^="col-"]:last-child,
54
+ .row [class*=" col-"]:last-child {
55
+ padding-right: 0;
56
+ }
57
+ .row .col-1 {
58
+ width: 8.333333333333332%;
59
+ }
60
+ .row .col-2 {
61
+ width: 16.666666666666664%;
62
+ }
63
+ .row .col-3 {
64
+ width: 25%;
65
+ }
66
+ .row .col-4 {
67
+ width: 33.33333333333333%;
68
+ }
69
+ .row .col-5 {
70
+ width: 41.66666666666667%;
71
+ }
72
+ .row .col-6 {
73
+ width: 50%;
74
+ }
75
+ .row .col-7 {
76
+ width: 58.333333333333336%;
77
+ }
78
+ .row .col-8 {
79
+ width: 66.66666666666666%;
80
+ }
81
+ .row .col-9 {
82
+ width: 75%;
83
+ }
84
+ .row .col-10 {
85
+ width: 83.33333333333334%;
86
+ }
87
+ .row .col-11 {
88
+ width: 91.66666666666666%;
89
+ }
90
+ .row .col-12 {
91
+ width: 100%;
92
+ }
93
+ @media screen and (max-width: 768px) {
94
+ .row .col,
95
+ .row [class^='col-'],
96
+ .row [class*=" col-"] {
97
+ flex: 0 0 100%;
98
+ margin-bottom: 10px;
99
+ padding: 0;
100
+ }
101
+ .row .col:last-child,
102
+ .row [class^='col-']:last-child,
103
+ .row [class*=" col-"]:last-child {
104
+ margin-bottom: 0;
105
+ }
106
+ }
107
+ /*=============================
108
+ Typography
109
+ =============================*/
110
+ h1,
111
+ h2,
112
+ h3,
113
+ h4,
114
+ h5,
115
+ h6,
116
+ p {
117
+ margin-top: 0;
118
+ margin-bottom: 10px;
119
+ font-family: -apple-system, BlinkMacSystemFont, Avenir, "Avenir Next", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
120
+ }
121
+ h1,
122
+ h2,
123
+ h3,
124
+ h4,
125
+ h5,
126
+ h6 {
127
+ font-weight: 500;
128
+ }
129
+ h1 {
130
+ font-size: 2.986rem;
131
+ line-height: 1.2;
132
+ }
133
+ h2 {
134
+ font-size: 2.488rem;
135
+ line-height: 1.25;
136
+ }
137
+ h3 {
138
+ font-size: 2.074rem;
139
+ line-height: 1.3;
140
+ }
141
+ h4 {
142
+ font-size: 1.728rem;
143
+ line-height: 1.35;
144
+ }
145
+ h5 {
146
+ font-size: 1.44rem;
147
+ line-height: 1.5;
148
+ }
149
+ h6 {
150
+ font-size: 1.2rem;
151
+ line-height: 1.6;
152
+ }
153
+ p {
154
+ font-size: 1rem;
155
+ }
156
+ @media (max-width: 768px) {
157
+ h1 {
158
+ font-size: 2.027rem;
159
+ }
160
+ h2 {
161
+ font-size: 1.802rem;
162
+ }
163
+ h3 {
164
+ font-size: 1.602rem;
165
+ }
166
+ h4 {
167
+ font-size: 1.424rem;
168
+ }
169
+ h5 {
170
+ font-size: 1.266rem;
171
+ }
172
+ h6 {
173
+ font-size: 1.125rem;
174
+ }
175
+ }
176
+ /*=============================
177
+ Form
178
+ =============================*/
179
+ input[type=text],
180
+ input[type=password],
181
+ input[type=email],
182
+ input[type=search],
183
+ input[type=number],
184
+ input[type=file],
185
+ input[type=tel],
186
+ input[type=url],
187
+ select,
188
+ textarea {
189
+ height: 45px;
190
+ width: 100%;
191
+ margin-bottom: 10px;
192
+ padding: 10px;
193
+ font-size: 1rem;
194
+ background: #f5f5f5;
195
+ border: 1px solid #a7a7a7;
196
+ border-radius: 2px;
197
+ transition: all 0.2s ease;
198
+ }
199
+ input[type=text]:hover,
200
+ input[type=password]:hover,
201
+ input[type=email]:hover,
202
+ input[type=search]:hover,
203
+ input[type=number]:hover,
204
+ input[type=file]:hover,
205
+ input[type=tel]:hover,
206
+ input[type=url]:hover,
207
+ select:hover,
208
+ textarea:hover {
209
+ border-color: #111;
210
+ }
211
+ input[type=text]:focus,
212
+ input[type=password]:focus,
213
+ input[type=email]:focus,
214
+ input[type=search]:focus,
215
+ input[type=number]:focus,
216
+ input[type=file]:focus,
217
+ input[type=tel]:focus,
218
+ input[type=url]:focus,
219
+ select:focus,
220
+ textarea:focus {
221
+ outline: none;
222
+ border-color: #0062ff;
223
+ }
224
+ textarea {
225
+ min-height: 70px;
226
+ }
227
+ /*=============================
228
+ Button
229
+ =============================*/
230
+ button,
231
+ .button,
232
+ [type=submit] {
233
+ height: 45px;
234
+ margin-bottom: 10px;
235
+ padding: 10px 30px;
236
+ outline: none;
237
+ text-decoration: none;
238
+ color: #f5f5f5;
239
+ font-size: 1rem;
240
+ background: #111;
241
+ border: 1px solid #111;
242
+ border-radius: 2px;
243
+ transition: all 0.2s ease;
244
+ }
245
+ button:hover,
246
+ .button:hover,
247
+ [type=submit]:hover,
248
+ button:focus,
249
+ .button:focus,
250
+ [type=submit]:focus {
251
+ opacity: 0.9;
252
+ }
253
+ button:active,
254
+ .button:active,
255
+ [type=submit]:active {
256
+ opacity: 0.7;
257
+ }
258
+ button[disabled],
259
+ .button[disabled],
260
+ [type=submit][disabled] {
261
+ opacity: 0.8;
262
+ cursor: not-allowed;
263
+ }
264
+ button.outline,
265
+ .button.outline,
266
+ [type=submit].outline {
267
+ color: #111;
268
+ background: none;
269
+ }
270
+ button.outline:hover,
271
+ .button.outline:hover,
272
+ [type=submit].outline:hover,
273
+ button.outline:focus,
274
+ .button.outline:focus,
275
+ [type=submit].outline:focus {
276
+ color: #f5f5f5;
277
+ background: #111;
278
+ }
279
+ /*=============================
280
+ Link
281
+ =============================*/
282
+ a {
283
+ color: #0062ff;
284
+ transition: all 0.2s ease;
285
+ }
286
+ a:hover {
287
+ cursor: pointer;
288
+ color: #111;
289
+ }
290
+ /*=============================
291
+ List
292
+ =============================*/
293
+ ul,
294
+ ol {
295
+ margin-top: 0;
296
+ margin-bottom: 10px;
297
+ padding-left: 0;
298
+ list-style-position: inside;
299
+ }
300
+ ul li,
301
+ ol li {
302
+ margin-bottom: 10px;
303
+ }
304
+ ul li:last-child,
305
+ ol li:last-child {
306
+ margin-bottom: 0;
307
+ }
308
+ ul ul,
309
+ ol ul,
310
+ ul ol,
311
+ ol ol {
312
+ margin-left: 10px;
313
+ }
314
+ /*=============================
315
+ Image
316
+ =============================*/
317
+ img {
318
+ margin-top: 0;
319
+ margin-bottom: 10px;
320
+ }
321
+ /*=============================
322
+ Box
323
+ =============================*/
324
+ .box {
325
+ margin-bottom: 10px;
326
+ padding-top: 10px;
327
+ padding-right: 10px;
328
+ padding-left: 10px;
329
+ border: 1px solid #a7a7a7;
330
+ border-radius: 2px;
331
+ }
332
+ /*=============================
333
+ Navigation
334
+ =============================*/
335
+ .nav {
336
+ position: relative;
337
+ display: flex;
338
+ flex-wrap: wrap;
339
+ align-items: center;
340
+ justify-content: space-between;
341
+ padding-top: 10px;
342
+ padding-bottom: 10px;
343
+ }
344
+ .nav .nav-item {
345
+ margin-right: 10px;
346
+ }
347
+ .nav .nav-item:last-child {
348
+ margin-right: 0;
349
+ }
350
+ /*=============================
351
+ Card
352
+ =============================*/
353
+ .card {
354
+ display: flex;
355
+ flex-direction: column;
356
+ margin-bottom: 10px;
357
+ border: 1px solid #a7a7a7;
358
+ border-radius: 2px;
359
+ }
360
+ .card .card-content {
361
+ margin: 0;
362
+ padding: 10px;
363
+ }
364
+ .card .card-image {
365
+ display: block;
366
+ height: auto;
367
+ width: 100%;
368
+ }
369
+ /*=============================
370
+ Code
371
+ =============================*/
372
+ pre {
373
+ margin-top: 0;
374
+ margin-bottom: 10px;
375
+ }
376
+ pre code {
377
+ display: block;
378
+ padding: 10px 10px;
379
+ white-space: pre-wrap;
380
+ word-wrap: break-word;
381
+ }
382
+ code {
383
+ padding: 2px;
384
+ white-space: nowrap;
385
+ background: #e7e7e7;
386
+ border: 1px solid #d7d7d7;
387
+ border-radius: 2px;
388
+ font-family: "Consolas", "Monaco", "Menlo", monospace;
389
+ }
390
+ /*=============================
391
+ Divider
392
+ =============================*/
393
+ hr {
394
+ border-width: 0.5px;
395
+ border-color: #a7a7a7;
396
+ }
397
+ /*=============================
398
+ Utilities
399
+ =============================*/
400
+ .position-relative {
401
+ position: relative;
402
+ }
403
+ .position-absolute {
404
+ position: absolute;
405
+ }
406
+ .position-fixed {
407
+ position: fixed;
408
+ }
409
+ .text-left {
410
+ text-align: left;
411
+ }
412
+ .text-center {
413
+ text-align: center;
414
+ }
415
+ .text-right {
416
+ text-align: right;
417
+ }
418
+ .size-full-height {
419
+ min-height: 100vh;
420
+ }
421
+ .size-full-width {
422
+ width: 100%;
423
+ }
424
+ .size-full {
425
+ width: 100%;
426
+ min-height: 100vh;
427
+ }
428
+ .hidden {
429
+ display: none;
430
+ }
431
+ .flex {
432
+ display: flex;
433
+ }
434
+ .justify-start {
435
+ justify-content: flex-start;
436
+ }
437
+ .justify-center {
438
+ justify-content: center;
439
+ }
440
+ .justify-end {
441
+ justify-content: flex-end;
442
+ }
443
+ .align-start {
444
+ align-items: flex-start;
445
+ }
446
+ .align-center {
447
+ align-items: center;
448
+ }
449
+ .align-end {
450
+ align-items: flex-end;
451
+ }
452
+ .direction-vertical {
453
+ flex-direction: column;
454
+ }
455
+ .direction-horizontal {
456
+ flex-direction: row;
457
+ }
458
+ .center {
459
+ flex-direction: column;
460
+ justify-content: center;
461
+ align-items: center;
462
+ }
463
+ .border-black {
464
+ border: 1px solid #111;
465
+ }
466
+ .border-gray {
467
+ border: 1px solid #a7a7a7;
468
+ }
469
+ .border-white {
470
+ border: 1px solid #f5f5f5;
471
+ }
472
+ .border-blue {
473
+ border: 1px solid #0062ff;
474
+ }
475
+ .border-red {
476
+ border: 1px solid #ff1500;
477
+ }
478
+ .border-yellow {
479
+ border: 1px solid #ffbf00;
480
+ }
481
+ .border-green {
482
+ border: 1px solid #00b30f;
483
+ }
484
+ .border-rounded {
485
+ border-radius: 2px;
486
+ }
487
+ .border-circle {
488
+ border-radius: 2px;
489
+ }
490
+ .color-black {
491
+ color: #111;
492
+ }
493
+ .color-gray {
494
+ color: #a7a7a7;
495
+ }
496
+ .color-white {
497
+ color: #f5f5f5;
498
+ }
499
+ .color-blue {
500
+ color: #0062ff;
501
+ }
502
+ .color-red {
503
+ color: #ff1500;
504
+ }
505
+ .color-yellow {
506
+ color: #ffbf00;
507
+ }
508
+ .color-green {
509
+ color: #00b30f;
510
+ }
511
+ .background-black {
512
+ background-color: #111;
513
+ }
514
+ .background-gray {
515
+ background-color: #a7a7a7;
516
+ }
517
+ .background-white {
518
+ background-color: #f5f5f5;
519
+ }
520
+ .background-blue {
521
+ background-color: #0062ff;
522
+ }
523
+ .background-red {
524
+ background-color: #ff1500;
525
+ }
526
+ .background-yellow {
527
+ background-color: #ffbf00;
528
+ }
529
+ .background-green {
530
+ background-color: #00b30f;
531
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirill Shevchenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-15 00:00:00.000000000 Z
11
+ date: 2017-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: haml-rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: sqlite3
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -80,7 +94,35 @@ dependencies:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
96
  version: 3.7.1
83
- description: Mountable Rails Engine to see paginated logs with search from browser
97
+ - !ruby/object:Gem::Dependency
98
+ name: capybara
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.16'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '2.16'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '12.3'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '12.3'
125
+ description: Mountable Rails Engine for viewing paginated logs from a browser
84
126
  email:
85
127
  - hello@kirillshevch.com
86
128
  executables: []
@@ -93,17 +135,31 @@ files:
93
135
  - app/assets/config/logs_manifest.js
94
136
  - app/assets/javascripts/logs/application.js
95
137
  - app/assets/stylesheets/logs/application.css
138
+ - app/assets/stylesheets/logs/logs.css
96
139
  - app/controllers/logs/application_controller.rb
140
+ - app/controllers/logs/concerns/logs_loader.rb
141
+ - app/controllers/logs/concerns/pagination.rb
142
+ - app/controllers/logs/logs_controller.rb
97
143
  - app/helpers/logs/application_helper.rb
98
- - app/jobs/logs/application_job.rb
99
- - app/mailers/logs/application_mailer.rb
100
- - app/models/logs/application_record.rb
101
- - app/views/layouts/logs/application.html.erb
144
+ - app/helpers/logs/nav_pagination_helper.rb
145
+ - app/services/logs/log_files.rb
146
+ - app/services/logs/viewer.rb
147
+ - app/views/layouts/logs/application.html.haml
148
+ - app/views/logs/logs/index.html.haml
149
+ - app/views/logs/logs/show.html.haml
150
+ - app/views/shared/_header.html.haml
151
+ - app/views/shared/_layout.html.haml
152
+ - app/views/shared/_logs.html.haml
153
+ - app/views/shared/_nav_pagination.html.haml
154
+ - app/views/shared/_navbar.html.haml
155
+ - app/views/shared/_pagination.html.haml
156
+ - config/locales/en.yml
102
157
  - config/routes.rb
103
158
  - lib/logs.rb
104
159
  - lib/logs/engine.rb
105
160
  - lib/logs/version.rb
106
161
  - lib/tasks/logs_tasks.rake
162
+ - vendor/assets/stylesheets/wind.css
107
163
  homepage: https://github.com/kirillshevch/logs
108
164
  licenses:
109
165
  - MIT
@@ -127,5 +183,5 @@ rubyforge_project:
127
183
  rubygems_version: 2.5.2
128
184
  signing_key:
129
185
  specification_version: 4
130
- summary: Mountable Rails Engine to see paginated logs with search from browser
186
+ summary: Mountable Rails Engine for viewing paginated logs from a browser
131
187
  test_files: []
@@ -1,4 +0,0 @@
1
- module Logs
2
- class ApplicationJob < ActiveJob::Base
3
- end
4
- end
@@ -1,6 +0,0 @@
1
- module Logs
2
- class ApplicationMailer < ActionMailer::Base
3
- default from: 'from@example.com'
4
- layout 'mailer'
5
- end
6
- end
@@ -1,5 +0,0 @@
1
- module Logs
2
- class ApplicationRecord < ActiveRecord::Base
3
- self.abstract_class = true
4
- end
5
- end
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Logs</title>
5
- <%= stylesheet_link_tag "logs/application", media: "all" %>
6
- <%= javascript_include_tag "logs/application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>