process_bot 0.1.24 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '00099fd449ad79c57c052e10342f74b462ac806decd93e5989e0ad12620f42c3'
4
- data.tar.gz: 40f29096a018160dca9e7ed7e5e0f5513876271259fe5dc44a4cdee0b8f38013
3
+ metadata.gz: 6e46c5f20791400dfc63138936340fc46e514d52947d2d2ba78cb208c521f442
4
+ data.tar.gz: 0f3ec322eb916178092eb5e7b19cab1a92421a23767fea310bf4c69319e72ca9
5
5
  SHA512:
6
- metadata.gz: ec891a1ce47000bd291c9980baccfc42f8e35d0a39c53292759d2c4f810c223668a06c4d525690bdb230aef881cd36d34695c9ae73e33ed7c504dc16289715e4
7
- data.tar.gz: b51ee6883d7f5bcb338512153f0d40073b003011de87dd91c40a5e2201b4ee58999679379f696517804112791e54450ad80a73df8341c52a46f23737ed9f0438
6
+ metadata.gz: bd08e3680f9c436c00fed3c5ed760542cbbb4fba517021493f6d17de799ed4e781c86d652baa230f0433794a36f61861de8f52c846ff64dfda651b73ba42c3bc
7
+ data.tar.gz: 1b91173a14173732de83e7e00f47e95a10a0272768f5810f9ca789f12cb181fd3282bd4c0feab33a3c3f6b0074bcfac6bbb55ca753bb2e8df9c70f4cd7121464
data/CHANGELOG.md CHANGED
@@ -9,6 +9,8 @@
9
9
  - Guard stop-related process scanning when subprocess PID/PGID is unavailable and fail stop loudly.
10
10
  - Wait briefly for subprocess PID assignment during stop; raise if PID is still missing so stop cannot silently succeed.
11
11
 
12
+ - Require an active runner for custom stop commands to avoid constructing a fresh runner with no PID.
13
+
12
14
  ## [0.1.0] - 2022-04-03
13
15
 
14
16
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- process_bot (0.1.24)
4
+ process_bot (0.1.26)
5
5
  knjrbfw (>= 0.0.116)
6
6
  pry
7
7
  rake
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`. 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).
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
- require "rubocop/rake_task"
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
- RuboCop::RakeTask.new
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]
@@ -49,6 +49,6 @@ class ProcessBot::Process::Handlers::Custom
49
49
 
50
50
  def stop(**_args)
51
51
  logger.logs "Stop related processes"
52
- process.runner.stop_related_processes
52
+ process.active_runner!.stop_related_processes
53
53
  end
54
54
  end
@@ -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)}"
@@ -1,3 +1,3 @@
1
1
  module ProcessBot
2
- VERSION = "0.1.24".freeze
2
+ VERSION = "0.1.26".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: process_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.24
4
+ version: 0.1.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaspernj