log_inspector 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c17973fc08834b55c04af08a66c9f379c09976b
4
- data.tar.gz: 958730387464176f2ec1903f0561f5d1f07a52b0
3
+ metadata.gz: 68db6d443970b094573a4d43bb7ec457199429ff
4
+ data.tar.gz: e634059956dff0dd3ebdfc2bb3282a0d4f7d9ad6
5
5
  SHA512:
6
- metadata.gz: 18bd615769344c0b5f268b1b810cb22542fee86bca8b29de6f840ece8c6f859c850fd04f8aae41c6ada0dc359e5901d76b1b1a48152b712284df09ab56217874
7
- data.tar.gz: dcf30e302a8ca7f809912fc67827eb43850798b5bb7abe5cc81d8166c2b17833f3ba3ad44709c4338f0bbf8ecbae2a93ac6b4f097b941bbc1feca48366bcfb0e
6
+ metadata.gz: d55920c3e0b88ef08d3a059d550cd603b33b32b818efac18a41cb33d7ca30463115b0ccfb9da3b60daaedd736a62fd2dee67e5abc8ba97c5b1f010ad5e40a1e3
7
+ data.tar.gz: 2aeac84bf59f48b092220e9932a029d0bb37a1fb861700b20775355b8024039fc3d2b769415da9ddb9e16f5cabce223755d498d84138e76c9dc1293b80f3acba
data/README.md ADDED
@@ -0,0 +1,127 @@
1
+ log_inspector
2
+ ==============
3
+
4
+ `log_inspector` is a mountable Rails engine with routes/views for displaying the contents of your Rails log directory (or any other directory).
5
+
6
+
7
+ Demo
8
+ -----------------------------
9
+
10
+ A live demo can be found at:
11
+
12
+ http://log-inspector.seanhuber.com
13
+
14
+ ![Screenshot](https://cdn.rawgit.com/seanhuber/log_inspector/master/screenshot.png)
15
+
16
+
17
+ Requirements and Dependencies
18
+ -----------------------------
19
+
20
+ Unix based operating system (Apple OSX or Linux).
21
+
22
+ > The unix commands `wc` and `tail` are used to get log file contents and line counts.
23
+
24
+ Rails ~> 4.0
25
+
26
+ > This engine was developed with Rails 4.2 but should work any 4.x variant of Rails.
27
+
28
+ jQuery and jQuery-ui.
29
+
30
+ > These are required by the `folder-tree` jQuery widget (which is used to display the contents of the log folder). For more information on `folder-tree`, see: https://github.com/seanhuber/folder-tree
31
+
32
+
33
+ Installation
34
+ -----------------------------
35
+
36
+ Add to your `Gemfile`:
37
+
38
+ ```ruby
39
+ gem 'log_inspector', '~> 1.0'
40
+ ```
41
+
42
+ Then, `bundle install`.
43
+
44
+
45
+ Configuration and Usage
46
+ -----------------------------
47
+
48
+ For basic usage, mount the engine in `config/routes.rb`, e.g.,
49
+
50
+ ```ruby
51
+ Rails.application.routes.draw do
52
+ mount LogInspector::Engine => '/log_inspector'
53
+ # ... your other application routes
54
+ end
55
+ ```
56
+
57
+ Restart your rails server and navigate to <http://localhost:3000/log_inspector>
58
+
59
+ Click on subfolders to expend them and click on text-based files to view their contents in the preview pane.
60
+
61
+ If your log directory is located somewhere that is not `<app root>/log`, you can set the path in an initializer:
62
+
63
+ ```ruby
64
+ LogInspector.log_path = '/path/to/log/directory'
65
+ ```
66
+
67
+ If you want to embed `log_inspector` inside of a custom view, you'll first need to add to `log_inspector`'s assets to the pipeline. In `app/assets/stylesheets/application.css`, add:
68
+
69
+ ```css
70
+ /*
71
+ *= require log_inspector/folder-tree
72
+ *= require log_inspector/log-inspector
73
+ */
74
+ ```
75
+
76
+ In `app/assets/javascripts/application.js`, add:
77
+
78
+ ```javascript
79
+ //= require log_inspector/folder-tree
80
+ //= require log_inspector/log_inspector
81
+ ```
82
+
83
+ Then in an `erb` view file, render `log_inspector`'s primary partial:
84
+
85
+ ```
86
+ <%= render partial: 'log_inspector/panes' %>
87
+ ```
88
+
89
+
90
+ ### Security
91
+
92
+ Generally you would not want to expose the contents of your log files in the production environment, but `log_inspector` does not have any restrictions built in. To add constraints it's advised that you add them yourself, see: http://guides.rubyonrails.org/routing.html#advanced-constraints
93
+
94
+ To simply disable all routes in the production environment you could modify your `config/routes.rb` to something like:
95
+
96
+ ```ruby
97
+ Rails.application.routes.draw do
98
+ mount LogInspector::Engine => '/log_inspector' unless Rails.env.production?
99
+ # ... your other application routes
100
+ end
101
+ ```
102
+
103
+ Or if you do want the engine enabled in production and wish to limit access to specific users, try a strategy like this:
104
+
105
+ ```ruby
106
+ Rails.application.routes.draw do
107
+ mount LogInspector::Engine => '/log_inspector', constraints: CustomConstraint.new
108
+ # ... your other application routes
109
+ end
110
+ ```
111
+
112
+ And define your `CustomConstraint` class in `lib/custom_constraint.rb`:
113
+
114
+ ```ruby
115
+ class CustomConstraint
116
+ # this class assumes you've set a session variable 'user_roles' which is an array of strings
117
+ def matches?(request)
118
+ request.session['user_roles'].is_a?(Array) && request.session['user_roles'].include?('admin')
119
+ end
120
+ end
121
+ ```
122
+
123
+
124
+ License
125
+ -----------------------------
126
+
127
+ MIT-LICENSE.
@@ -1,3 +1,3 @@
1
1
  module LogInspector
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
@@ -1150,3 +1150,108 @@ Started GET "/log_inspector/file?path=log%2Ftestfile.log&all_lines=false" for 12
1150
1150
  Processing by LogInspector::LogController#file_api as */*
1151
1151
  Parameters: {"path"=>"log/testfile.log", "all_lines"=>"false"}
1152
1152
  Completed 200 OK in 199ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1153
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1154
+  (1.8ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
1155
+  (0.1ms) select sqlite_version(*)
1156
+  (0.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1157
+  (0.1ms) SELECT version FROM "schema_migrations"
1158
+  (0.5ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
1159
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1160
+ Started GET "/log_inspector/" for 127.0.0.1 at 2016-07-18 15:49:20 -0500
1161
+ Processing by LogInspector::LogController#index as HTML
1162
+ Rendered /Users/seanhuber/Rails Apps/log_inspector/app/views/log_inspector/_panes.html.erb (176.3ms)
1163
+ Rendered /Users/seanhuber/Rails Apps/log_inspector/app/views/log_inspector/index.html.erb within layouts/log_inspector/application (181.2ms)
1164
+ Completed 200 OK in 407ms (Views: 406.6ms | ActiveRecord: 0.0ms)
1165
+ Started GET "/assets/log_inspector/application-0206718aaada0deb45a295ad938696b262e714721b8c60ccf6aed656fba86a24.css" for 127.0.0.1 at 2016-07-18 15:49:20 -0500
1166
+ Started GET "/assets/log_inspector/application-ddb00b9468788f18782fc887bbc9a299a63bc533385e4c21abb46f89b4224b31.js" for 127.0.0.1 at 2016-07-18 15:49:20 -0500
1167
+ Started GET "/log_inspector/folder?path=log" for 127.0.0.1 at 2016-07-18 15:49:21 -0500
1168
+ Processing by LogInspector::LogController#folder_api as */*
1169
+ Parameters: {"path"=>"log"}
1170
+ Completed 200 OK in 180ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1171
+ Started GET "/log_inspector/folder?path=log%2Flog_subfolder" for 127.0.0.1 at 2016-07-18 15:49:21 -0500
1172
+ Processing by LogInspector::LogController#folder_api as */*
1173
+ Parameters: {"path"=>"log/log_subfolder"}
1174
+ Completed 200 OK in 183ms (Views: 0.2ms | ActiveRecord: 0.0ms)
1175
+ Started GET "/log_inspector/" for 127.0.0.1 at 2016-07-18 15:49:21 -0500
1176
+ Processing by LogInspector::LogController#index as HTML
1177
+ Rendered /Users/seanhuber/Rails Apps/log_inspector/app/views/log_inspector/_panes.html.erb (178.7ms)
1178
+ Rendered /Users/seanhuber/Rails Apps/log_inspector/app/views/log_inspector/index.html.erb within layouts/log_inspector/application (178.8ms)
1179
+ Completed 200 OK in 180ms (Views: 180.1ms | ActiveRecord: 0.0ms)
1180
+ Started GET "/log_inspector/folder?path=log" for 127.0.0.1 at 2016-07-18 15:49:22 -0500
1181
+ Processing by LogInspector::LogController#folder_api as */*
1182
+ Parameters: {"path"=>"log"}
1183
+ Completed 200 OK in 183ms (Views: 0.2ms | ActiveRecord: 0.0ms)
1184
+ Started GET "/log_inspector/file?path=log%2Ftestfile.log&all_lines=false" for 127.0.0.1 at 2016-07-18 15:49:22 -0500
1185
+ Processing by LogInspector::LogController#file_api as */*
1186
+ Parameters: {"path"=>"log/testfile.log", "all_lines"=>"false"}
1187
+ Completed 200 OK in 185ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1188
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
1189
+  (1.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
1190
+  (0.1ms) select sqlite_version(*)
1191
+  (0.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1192
+  (0.1ms) SELECT version FROM "schema_migrations"
1193
+  (0.6ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
1194
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1195
+ Started GET "/log_inspector/" for 127.0.0.1 at 2016-08-03 09:14:30 -0500
1196
+ Processing by LogInspector::LogController#index as HTML
1197
+ Rendered /Users/seanhuber/Rails Apps/log_inspector/app/views/log_inspector/_panes.html.erb (189.0ms)
1198
+ Rendered /Users/seanhuber/Rails Apps/log_inspector/app/views/log_inspector/index.html.erb within layouts/log_inspector/application (195.6ms)
1199
+ Completed 200 OK in 413ms (Views: 412.7ms | ActiveRecord: 0.0ms)
1200
+ Started GET "/assets/log_inspector/application-0206718aaada0deb45a295ad938696b262e714721b8c60ccf6aed656fba86a24.css" for 127.0.0.1 at 2016-08-03 09:14:30 -0500
1201
+ Started GET "/assets/log_inspector/application-ddb00b9468788f18782fc887bbc9a299a63bc533385e4c21abb46f89b4224b31.js" for 127.0.0.1 at 2016-08-03 09:14:30 -0500
1202
+ Started GET "/log_inspector/folder?path=log" for 127.0.0.1 at 2016-08-03 09:14:30 -0500
1203
+ Processing by LogInspector::LogController#folder_api as */*
1204
+ Parameters: {"path"=>"log"}
1205
+ Completed 200 OK in 201ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1206
+ Started GET "/log_inspector/folder?path=log%2Flog_subfolder" for 127.0.0.1 at 2016-08-03 09:14:31 -0500
1207
+ Processing by LogInspector::LogController#folder_api as */*
1208
+ Parameters: {"path"=>"log/log_subfolder"}
1209
+ Completed 200 OK in 220ms (Views: 0.2ms | ActiveRecord: 0.0ms)
1210
+ Started GET "/log_inspector/" for 127.0.0.1 at 2016-08-03 09:14:31 -0500
1211
+ Processing by LogInspector::LogController#index as HTML
1212
+ Rendered /Users/seanhuber/Rails Apps/log_inspector/app/views/log_inspector/_panes.html.erb (189.0ms)
1213
+ Rendered /Users/seanhuber/Rails Apps/log_inspector/app/views/log_inspector/index.html.erb within layouts/log_inspector/application (189.1ms)
1214
+ Completed 200 OK in 191ms (Views: 190.5ms | ActiveRecord: 0.0ms)
1215
+ Started GET "/log_inspector/folder?path=log" for 127.0.0.1 at 2016-08-03 09:14:31 -0500
1216
+ Processing by LogInspector::LogController#folder_api as */*
1217
+ Parameters: {"path"=>"log"}
1218
+ Completed 200 OK in 187ms (Views: 0.2ms | ActiveRecord: 0.0ms)
1219
+ Started GET "/log_inspector/file?path=log%2Ftestfile.log&all_lines=false" for 127.0.0.1 at 2016-08-03 09:14:31 -0500
1220
+ Processing by LogInspector::LogController#file_api as */*
1221
+ Parameters: {"path"=>"log/testfile.log", "all_lines"=>"false"}
1222
+ Completed 200 OK in 202ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1223
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1224
+  (0.8ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
1225
+  (0.0ms) select sqlite_version(*)
1226
+  (0.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1227
+  (0.1ms) SELECT version FROM "schema_migrations"
1228
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
1229
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1230
+ Started GET "/log_inspector/" for 127.0.0.1 at 2016-08-03 09:17:40 -0500
1231
+ Processing by LogInspector::LogController#index as HTML
1232
+ Rendered /Users/seanhuber/Rails Apps/log_inspector/app/views/log_inspector/_panes.html.erb (169.8ms)
1233
+ Rendered /Users/seanhuber/Rails Apps/log_inspector/app/views/log_inspector/index.html.erb within layouts/log_inspector/application (174.1ms)
1234
+ Completed 200 OK in 308ms (Views: 307.5ms | ActiveRecord: 0.0ms)
1235
+ Started GET "/assets/log_inspector/application-0206718aaada0deb45a295ad938696b262e714721b8c60ccf6aed656fba86a24.css" for 127.0.0.1 at 2016-08-03 09:17:40 -0500
1236
+ Started GET "/assets/log_inspector/application-ddb00b9468788f18782fc887bbc9a299a63bc533385e4c21abb46f89b4224b31.js" for 127.0.0.1 at 2016-08-03 09:17:40 -0500
1237
+ Started GET "/log_inspector/folder?path=log" for 127.0.0.1 at 2016-08-03 09:17:40 -0500
1238
+ Processing by LogInspector::LogController#folder_api as */*
1239
+ Parameters: {"path"=>"log"}
1240
+ Completed 200 OK in 173ms (Views: 0.3ms | ActiveRecord: 0.0ms)
1241
+ Started GET "/log_inspector/folder?path=log%2Flog_subfolder" for 127.0.0.1 at 2016-08-03 09:17:40 -0500
1242
+ Processing by LogInspector::LogController#folder_api as */*
1243
+ Parameters: {"path"=>"log/log_subfolder"}
1244
+ Completed 200 OK in 180ms (Views: 0.1ms | ActiveRecord: 0.0ms)
1245
+ Started GET "/log_inspector/" for 127.0.0.1 at 2016-08-03 09:17:41 -0500
1246
+ Processing by LogInspector::LogController#index as HTML
1247
+ Rendered /Users/seanhuber/Rails Apps/log_inspector/app/views/log_inspector/_panes.html.erb (187.4ms)
1248
+ Rendered /Users/seanhuber/Rails Apps/log_inspector/app/views/log_inspector/index.html.erb within layouts/log_inspector/application (187.5ms)
1249
+ Completed 200 OK in 189ms (Views: 188.8ms | ActiveRecord: 0.0ms)
1250
+ Started GET "/log_inspector/folder?path=log" for 127.0.0.1 at 2016-08-03 09:17:41 -0500
1251
+ Processing by LogInspector::LogController#folder_api as */*
1252
+ Parameters: {"path"=>"log"}
1253
+ Completed 200 OK in 179ms (Views: 0.4ms | ActiveRecord: 0.0ms)
1254
+ Started GET "/log_inspector/file?path=log%2Ftestfile.log&all_lines=false" for 127.0.0.1 at 2016-08-03 09:17:41 -0500
1255
+ Processing by LogInspector::LogController#file_api as */*
1256
+ Parameters: {"path"=>"log/testfile.log", "all_lines"=>"false"}
1257
+ Completed 200 OK in 187ms (Views: 0.3ms | ActiveRecord: 0.0ms)
@@ -1 +1 @@
1
- e7c38919582defe770e8e062e408e27300933386608b65aa4e991af5a1d234af3d141a4400fbff5f1e8fa8688f07a472eab6
1
+ 82e3a078a6984cd59b190bf416492007ee1f03ec8b006779abccb95e87cc9fbce430e1001ef9dec1665e46c4b6664d3ef32b
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log_inspector
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Huber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-18 00:00:00.000000000 Z
11
+ date: 2016-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
@@ -116,6 +116,7 @@ extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
118
  - MIT-LICENSE
119
+ - README.md
119
120
  - Rakefile
120
121
  - app/assets/javascripts/log_inspector/application.js
121
122
  - app/assets/javascripts/log_inspector/folder-tree.js
@@ -1764,7 +1765,6 @@ files:
1764
1765
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/zp/zPLYlRx19UMHoIuNRi6IA1NUpzslcmNHVeCCRiSiHm8.cache
1765
1766
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/zp/zpUKzW2t8a51iZd1zCbzAdOs3vpKcwHJw7zIV_m1K3w.cache
1766
1767
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/zs/zspn5SOv5xZYOqeF55n5uqG4H8X0wWa6h7vXReY3YeI.cache
1767
- - spec/dummy/tmp/pids/server.pid
1768
1768
  - spec/features/log_inspector/folder_tree_spec.rb
1769
1769
  - spec/features/log_inspector/log_contents_spec.rb
1770
1770
  - spec/rails_helper.rb
@@ -1790,7 +1790,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1790
1790
  version: '0'
1791
1791
  requirements: []
1792
1792
  rubyforge_project:
1793
- rubygems_version: 2.4.8
1793
+ rubygems_version: 2.5.1
1794
1794
  signing_key:
1795
1795
  specification_version: 4
1796
1796
  summary: Rails Engine with routes for displaying logfile contents.
@@ -3424,7 +3424,6 @@ test_files:
3424
3424
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/zY/zyRn1kZCcbN4ITXhCzsPHBZ6zzBvFv3sHlpzlnk0BP8.cache
3425
3425
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/zY/zYv8tOEcys7mLcf63f52CeOWCRGwFL1GxdRTdFzriSc.cache
3426
3426
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/zY/ZyxasZ4jRwRbWmCnkEpMMq7VAkPFZOttji5e18T0ht8.cache
3427
- - spec/dummy/tmp/pids/server.pid
3428
3427
  - spec/features/log_inspector/folder_tree_spec.rb
3429
3428
  - spec/features/log_inspector/log_contents_spec.rb
3430
3429
  - spec/rails_helper.rb
@@ -1 +0,0 @@
1
- 23755