trainspotter 0.3.0 → 0.4.0
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/lib/tasks/trainspotter.rake +24 -0
- data/lib/trainspotter/engine.rb +7 -1
- data/lib/trainspotter/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8bf3ea3b21e064cc87b3ee076c7fa57704db98f8c25d874269c4b47b9b8fe0fc
|
|
4
|
+
data.tar.gz: 89141b44fa96f80c63d5d7ac0ee4d621ee5ae5986dacfe7172f2c465ac1d55ef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7894aa0d077bb58730587c82f65ea8be194f3f70d8fde75726c4df558fed839ea7b9294b6e67db4f59b92f0c3cf9bdbef2d749f7e24e80675d719c56727ade7e
|
|
7
|
+
data.tar.gz: 76a8263d7dae1425cf6e2014a2b46669302c6039e14a2429023bc950456e7960be52f98908c0065e6215dab19a9840eaab01d5c92eeab317a23a5d88b082d560
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
namespace :trainspotter do
|
|
2
|
+
desc "Watch and ingest Rails logs (run alongside your development server)"
|
|
3
|
+
task :watch, [:interval] => :environment do |_t, args|
|
|
4
|
+
interval = (args[:interval] || 2).to_i
|
|
5
|
+
|
|
6
|
+
puts "Trainspotter watching logs (interval: #{interval}s, Ctrl+C to stop)..."
|
|
7
|
+
|
|
8
|
+
Trainspotter::BackgroundWorker.start(
|
|
9
|
+
interval: interval,
|
|
10
|
+
lock_path: Rails.root.join("tmp", "trainspotter.lock"),
|
|
11
|
+
logger: Logger.new($stdout)
|
|
12
|
+
) do
|
|
13
|
+
Trainspotter::IngestJob.new.perform
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
trap("INT") do
|
|
17
|
+
puts "\nStopping..."
|
|
18
|
+
Trainspotter::BackgroundWorker.stop
|
|
19
|
+
exit
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
sleep
|
|
23
|
+
end
|
|
24
|
+
end
|
data/lib/trainspotter/engine.rb
CHANGED
|
@@ -3,13 +3,19 @@ module Trainspotter
|
|
|
3
3
|
isolate_namespace Trainspotter
|
|
4
4
|
isolate_assets
|
|
5
5
|
|
|
6
|
+
rake_tasks do
|
|
7
|
+
load "tasks/trainspotter.rake"
|
|
8
|
+
end
|
|
9
|
+
|
|
6
10
|
initializer "trainspotter.silence_requests" do
|
|
7
11
|
config.after_initialize { Engine.silence_engine_requests }
|
|
8
12
|
end
|
|
9
13
|
|
|
10
14
|
initializer "trainspotter.background_worker" do
|
|
11
15
|
config.after_initialize do
|
|
12
|
-
|
|
16
|
+
if defined?(Rails::Server) && Rails.env.production?
|
|
17
|
+
Engine.start_background_worker
|
|
18
|
+
end
|
|
13
19
|
end
|
|
14
20
|
|
|
15
21
|
at_exit { Trainspotter::BackgroundWorker.stop }
|
data/lib/trainspotter/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: trainspotter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Micah Geisel
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-01-
|
|
10
|
+
date: 2026-01-15 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rails
|
|
@@ -118,6 +118,7 @@ files:
|
|
|
118
118
|
- app/views/trainspotter/sessions/index.html.erb
|
|
119
119
|
- config/cucumber.yml
|
|
120
120
|
- config/routes.rb
|
|
121
|
+
- lib/tasks/trainspotter.rake
|
|
121
122
|
- lib/trainspotter.rb
|
|
122
123
|
- lib/trainspotter/background_worker.rb
|
|
123
124
|
- lib/trainspotter/configuration.rb
|