gemkeeper 0.6.4 → 0.6.5

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
  SHA256:
3
- metadata.gz: 4cf7b65729b5846211f8e44608b822f658be02c0c9b793357818de209584a17e
4
- data.tar.gz: 85252b12623ec17209ccd145f72f7ee17962e7dc5a9102f77770086fa554a309
3
+ metadata.gz: 4e0e64e8fc036beb28568ee4a95b1936a4a8a011ae23b1cb4b36f6eef6beede0
4
+ data.tar.gz: 183ef89b7eebda5e29340ddc44b331fc530c4e2a88b6a7a59cce457b809f8437
5
5
  SHA512:
6
- metadata.gz: 9548771a4c6a650021e4171412be4266b50a04d3330aeb3e823ed41d6b2abaa70cc337bb006fa29ba83de45c78184add34c716d95aab5092824f7c347fb23008
7
- data.tar.gz: e860fcd9b300a5b74b9c87753e395336f5e6f67dca1017e9b69f587d06e26b53d15478391dec9e8566e6e839f772dbaae35ee5cbc0353df76ec6f95e6a40b33f
6
+ metadata.gz: 83aba6cdfc3fa99ea9ee6f247b40696bf327a0d0cc07a23506b2f84951e6e8184ba84af4705925cff390255ef3c648d8c3219b65464fe0fc88698a14b19a8a3f
7
+ data.tar.gz: 4ad0d62d40545d988723cd5534f7cf3cc45a706add49c426fbe9f6a7743bd78b47fccc3fbb5f460521e5a5ee027be3bef97ecb28eedb080c0425df034123c4c4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.6.5] - 2026-05-28
4
+
5
+ ### Fixed
6
+
7
+ - `gemkeeper server status` now correctly detects a running server even when no PID file exists (e.g., when started via `brew services start`).
8
+ Previously, status relied solely on a PID file that foreground mode never writes.
9
+ It now falls back to a TCP port check, and the PID line is omitted from the output when the process is not managed directly by gemkeeper.
10
+ - `gemkeeper server stop` now gives a clear error when the server is running but not managed by gemkeeper (no PID file), directing the user to `brew services stop gemkeeper` instead of failing silently.
11
+
3
12
  ## [0.6.4] - 2026-05-28
4
13
 
5
14
  ### Fixed
@@ -114,7 +123,8 @@
114
123
 
115
124
  - Initial release
116
125
 
117
- [Unreleased]: https://github.com/danhorst/gemkeeper/compare/v0.6.4...HEAD
126
+ [Unreleased]: https://github.com/danhorst/gemkeeper/compare/v0.6.5...HEAD
127
+ [0.6.5]: https://github.com/danhorst/gemkeeper/compare/0.6.4...0.6.5
118
128
  [0.6.4]: https://github.com/danhorst/gemkeeper/compare/0.6.3...0.6.4
119
129
  [0.6.3]: https://github.com/danhorst/gemkeeper/compare/0.6.2...0.6.3
120
130
  [0.6.2]: https://github.com/danhorst/gemkeeper/compare/0.6.1...0.6.2
@@ -16,7 +16,7 @@ module Gemkeeper
16
16
 
17
17
  if status[:running]
18
18
  puts "Geminabox server is running"
19
- puts " PID: #{status[:pid]}"
19
+ puts " PID: #{status[:pid]}" if status[:pid]
20
20
  puts " URL: #{status[:url]}"
21
21
  else
22
22
  puts "Geminabox server is not running"
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "fileutils"
4
+ require "socket"
4
5
 
5
6
  module Gemkeeper
6
7
  # Owns the rackup/puma lifecycle so CLI commands delegate process management here.
@@ -25,6 +26,10 @@ module Gemkeeper
25
26
  raise ServerNotRunningError, "Server is not running" unless running?
26
27
 
27
28
  pid = read_pid
29
+ unless pid
30
+ raise ServerError, "Server is running but not managed by gemkeeper — use 'brew services stop gemkeeper'"
31
+ end
32
+
28
33
  Process.kill("TERM", pid)
29
34
  wait_for_process_exit(pid)
30
35
  cleanup_pid_file
@@ -43,18 +48,21 @@ module Gemkeeper
43
48
  end
44
49
 
45
50
  def running?
46
- return false unless File.exist?(config.pid_file)
47
-
48
- pid = read_pid
49
- return false unless pid
50
-
51
- process_alive?(pid)
51
+ if File.exist?(config.pid_file)
52
+ pid = read_pid
53
+ return process_alive?(pid) if pid
54
+ end
55
+ port_open?
52
56
  end
53
57
 
54
58
  private
55
59
 
56
60
  def ensure_not_running!
57
- raise ServerAlreadyRunningError, "Server is already running (PID: #{read_pid})" if running?
61
+ return unless running?
62
+
63
+ pid = read_pid
64
+ msg = pid ? "Server is already running (PID: #{pid})" : "Server is already running"
65
+ raise ServerAlreadyRunningError, msg
58
66
  end
59
67
 
60
68
  def wait_for_process_exit(pid)
@@ -81,6 +89,13 @@ module Gemkeeper
81
89
  false
82
90
  end
83
91
 
92
+ def port_open?
93
+ TCPSocket.new("127.0.0.1", config.port).close
94
+ true
95
+ rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT, Errno::EADDRNOTAVAIL
96
+ false
97
+ end
98
+
84
99
  def cleanup_pid_file
85
100
  FileUtils.rm_f(config.pid_file)
86
101
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gemkeeper
4
- VERSION = "0.6.4"
4
+ VERSION = "0.6.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemkeeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Brubaker Horst