Module: Segue::Paths
- Defined in:
- lib/segue/paths.rb
Overview
Everything segue writes to disk lives under a single directory so that it can run alongside other players without fighting over state.
Class Method Summary collapse
- .history ⇒ Object
- .home ⇒ Object
- .preferences ⇒ Object
- .queue ⇒ Object
-
.socket(name) ⇒ Object
Sockets are scoped to the running player so a crashed one can't leave a stale path behind that the next player would try to talk to.
Class Method Details
.history ⇒ Object
22 23 24 |
# File 'lib/segue/paths.rb', line 22 def history File.join(home, "history") end |
.home ⇒ Object
12 13 14 15 16 |
# File 'lib/segue/paths.rb', line 12 def home File.(ENV.fetch("SEGUE_HOME", "~/.segue")).tap do |path| FileUtils.mkdir_p path end end |
.preferences ⇒ Object
18 19 20 |
# File 'lib/segue/paths.rb', line 18 def preferences File.join(home, "preferences.yml") end |
.queue ⇒ Object
26 27 28 |
# File 'lib/segue/paths.rb', line 26 def queue File.join(home, "queue").tap { |path| FileUtils.mkdir_p path } end |
.socket(name) ⇒ Object
Sockets are scoped to the running player so a crashed one can't leave a stale path behind that the next player would try to talk to.
32 33 34 |
# File 'lib/segue/paths.rb', line 32 def socket(name) File.join(Dir.tmpdir, "segue-#{name}-#{Process.pid}.sock") end |