process_bot 0.1.23 → 0.1.26
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/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +3 -1
- data/Rakefile +36 -2
- data/lib/process_bot/process/handlers/custom.rb +1 -1
- data/lib/process_bot/process/runner.rb +13 -1
- data/lib/process_bot/process.rb +11 -0
- data/lib/process_bot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6e46c5f20791400dfc63138936340fc46e514d52947d2d2ba78cb208c521f442
|
|
4
|
+
data.tar.gz: 0f3ec322eb916178092eb5e7b19cab1a92421a23767fea310bf4c69319e72ca9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bd08e3680f9c436c00fed3c5ed760542cbbb4fba517021493f6d17de799ed4e781c86d652baa230f0433794a36f61861de8f52c846ff64dfda651b73ba42c3bc
|
|
7
|
+
data.tar.gz: 1b91173a14173732de83e7e00f47e95a10a0272768f5810f9ca789f12cb181fd3282bd4c0feab33a3c3f6b0074bcfac6bbb55ca753bb2e8df9c70f4cd7121464
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
- Bump version to 0.1.21.
|
|
8
8
|
- Add optional Sidekiq restart overlap and a new ProcessBot restart command.
|
|
9
9
|
- Guard stop-related process scanning when subprocess PID/PGID is unavailable and fail stop loudly.
|
|
10
|
+
- Wait briefly for subprocess PID assignment during stop; raise if PID is still missing so stop cannot silently succeed.
|
|
11
|
+
|
|
12
|
+
- Require an active runner for custom stop commands to avoid constructing a fresh runner with no PID.
|
|
10
13
|
|
|
11
14
|
## [0.1.0] - 2022-04-03
|
|
12
15
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -113,7 +113,9 @@ bundle exec process_bot --command start --log-file-path /var/log/process_bot.log
|
|
|
113
113
|
|
|
114
114
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
115
115
|
|
|
116
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
|
116
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
|
117
|
+
|
|
118
|
+
To bump the patch version, run bundle, commit the version bump, build, and push the gem, run `bundle exec rake release:patch`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
117
119
|
|
|
118
120
|
## Contributing
|
|
119
121
|
|
data/Rakefile
CHANGED
|
@@ -2,11 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
require "bundler/gem_tasks"
|
|
4
4
|
require "rspec/core/rake_task"
|
|
5
|
+
require "rubocop/rake_task"
|
|
5
6
|
|
|
6
7
|
RSpec::Core::RakeTask.new(:spec)
|
|
8
|
+
RuboCop::RakeTask.new
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
def bump_patch_version(version_path)
|
|
11
|
+
version_content = File.read(version_path)
|
|
12
|
+
version_match = version_content.match(/VERSION = "(\d+)\.(\d+)\.(\d+)"\.freeze/)
|
|
13
|
+
raise "Could not find current version in #{version_path}" unless version_match
|
|
9
14
|
|
|
10
|
-
|
|
15
|
+
major = version_match[1].to_i
|
|
16
|
+
minor = version_match[2].to_i
|
|
17
|
+
patch = version_match[3].to_i + 1
|
|
18
|
+
|
|
19
|
+
new_version = "#{major}.#{minor}.#{patch}"
|
|
20
|
+
new_content = version_content.sub(version_match[0], "VERSION = \"#{new_version}\".freeze")
|
|
21
|
+
File.write(version_path, new_content)
|
|
22
|
+
|
|
23
|
+
new_version
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
namespace :release do
|
|
27
|
+
desc "Bump patch version, run bundle, commit version bump, build gem, and push gem"
|
|
28
|
+
task :patch do
|
|
29
|
+
version_path = "lib/process_bot/version.rb"
|
|
30
|
+
new_version = bump_patch_version(version_path)
|
|
31
|
+
|
|
32
|
+
puts "Bumped version to #{new_version}"
|
|
33
|
+
|
|
34
|
+
sh "bundle install"
|
|
35
|
+
sh "git add #{version_path}"
|
|
36
|
+
sh "git commit -m \"Bump version to #{new_version}\""
|
|
37
|
+
sh "bundle exec rake build"
|
|
38
|
+
|
|
39
|
+
gem_path = "pkg/process_bot-#{new_version}.gem"
|
|
40
|
+
raise "Expected gem file was not built: #{gem_path}" unless File.exist?(gem_path)
|
|
41
|
+
|
|
42
|
+
sh "gem push #{gem_path}"
|
|
43
|
+
end
|
|
44
|
+
end
|
|
11
45
|
|
|
12
46
|
task default: %i[spec rubocop]
|
|
@@ -139,11 +139,23 @@ class ProcessBot::Process::Runner
|
|
|
139
139
|
end
|
|
140
140
|
|
|
141
141
|
def ensure_subprocess_pgid_for_stop!
|
|
142
|
-
|
|
142
|
+
wait_for_subprocess_pid_for_stop! if subprocess_pid.nil?
|
|
143
|
+
|
|
144
|
+
return true if subprocess_pgid
|
|
143
145
|
|
|
144
146
|
raise "Unable to stop related processes because subprocess PGID could not be resolved (subprocess PID: #{subprocess_pid.inspect})"
|
|
145
147
|
end
|
|
146
148
|
|
|
149
|
+
def wait_for_subprocess_pid_for_stop!
|
|
150
|
+
deadline = Process.clock_gettime(Process::CLOCK_MONOTONIC) + 1
|
|
151
|
+
|
|
152
|
+
sleep 0.05 while subprocess_pid.nil? && Process.clock_gettime(Process::CLOCK_MONOTONIC) < deadline
|
|
153
|
+
|
|
154
|
+
return unless subprocess_pid.nil?
|
|
155
|
+
|
|
156
|
+
raise "Unable to stop related processes because subprocess PID has not been recorded yet"
|
|
157
|
+
end
|
|
158
|
+
|
|
147
159
|
def find_sidekiq_pid
|
|
148
160
|
Thread.new do
|
|
149
161
|
wait_for_sidekiq_pid
|
data/lib/process_bot/process.rb
CHANGED
|
@@ -140,6 +140,17 @@ class ProcessBot::Process
|
|
|
140
140
|
current_runner_instance&.runner || @runner ||= build_runner
|
|
141
141
|
end
|
|
142
142
|
|
|
143
|
+
def active_runner
|
|
144
|
+
current_runner_instance&.runner
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def active_runner!
|
|
148
|
+
runner_instance = active_runner
|
|
149
|
+
return runner_instance if runner_instance
|
|
150
|
+
|
|
151
|
+
raise "Unable to stop custom process because no active runner is available. Ensure the custom command runs in foreground."
|
|
152
|
+
end
|
|
153
|
+
|
|
143
154
|
def update_process_title
|
|
144
155
|
process_args = {application: options[:application], handler: handler_name, id: options[:id], pid: current_pid, port: port}
|
|
145
156
|
@current_process_title = "ProcessBot #{JSON.generate(process_args)}"
|
data/lib/process_bot/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: process_bot
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.26
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- kaspernj
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-02-
|
|
11
|
+
date: 2026-02-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: knjrbfw
|