multi_process 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dddbd3442f480abb21f2e64ce86365471a4f04e6832e385f07e9d52a45038e95
4
- data.tar.gz: fb7b5bcb5f053cacac6d3c2cbe2ff84ef200622fa06b8c045db6105051807ab2
3
+ metadata.gz: 5d62d4ef2d14471f23abcd7c7015d4370acffba45c77007df13505dd96e9fd16
4
+ data.tar.gz: 479e3d12ed873435fcdebe1d8d1d37bab3fbd276f5db85bdb079fa0264bbae27
5
5
  SHA512:
6
- metadata.gz: 92843a792257de7057e597f062ac53c690ccddd223dfdcfae94e42917a74cf0b299def05a691b880737cb7e51670ca6b343bf788e743201b312c8a32ce2fb0df
7
- data.tar.gz: c3db19666a44e40c06d4f321079bddf8182e5c2169cd616cc4855fbb3a0e90818bbbd27b180f2d3791e1927df7899bcdd5f83dcc0c323a60b4230ebb9c61a222
6
+ metadata.gz: 5865c7397ca0cfcdc7b91c4d1e02f573b85dd63e1b1876074c49d1e5e3595926e6ef9d04d49b0cf0863be3e7c7bdbef814f7fb04a0f389308484847442b699e6
7
+ data.tar.gz: c15f75913b1b3824386430e90202700ff2ac261f3ec09e4db46a52b9d2d639c3eda54102c00e3058bcdca01d1ffde87b4b79febe4d59474d99a86d889ba534e2
@@ -5,15 +5,15 @@ on: push
5
5
  jobs:
6
6
  rspec:
7
7
  name: ruby-${{ matrix.ruby }}
8
- runs-on: ubuntu-20.04
8
+ runs-on: ubuntu-22.04
9
9
 
10
10
  strategy:
11
11
  fail-fast: false
12
12
  matrix:
13
- ruby: ["3.1", "3.0", "2.7"]
13
+ ruby: ["3.2", "3.1", "3.0", "2.7"]
14
14
 
15
15
  steps:
16
- - uses: actions/checkout@v2
16
+ - uses: actions/checkout@v4
17
17
  - uses: ruby/setup-ruby@v1
18
18
  with:
19
19
  ruby-version: ${{ matrix.ruby }}
@@ -23,13 +23,13 @@ jobs:
23
23
 
24
24
  rubocop:
25
25
  name: rubocop
26
- runs-on: ubuntu-20.04
26
+ runs-on: ubuntu-22.04
27
27
 
28
28
  steps:
29
- - uses: actions/checkout@v2
29
+ - uses: actions/checkout@v4
30
30
  - uses: ruby/setup-ruby@v1
31
31
  with:
32
- ruby-version: 3.1
32
+ ruby-version: "3.2"
33
33
  bundler-cache: True
34
34
  env:
35
35
  BUNDLE_JOBS: 4
data/CHANGELOG.md CHANGED
@@ -6,6 +6,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ### Changed
10
+
11
+ - Use unbundled environment for child processes to support nested bundler invokations by @tylerhunt (#10)
12
+
13
+ ### Fixed
14
+
15
+ - Fix adding a process after the group has been started by @tylerhunt (#11)
16
+
17
+ ## [1.2.1] - 2024-01-11
18
+
19
+ ### Fixed
20
+
21
+ - Remove dependency on ActiveSupport by @tylerhunt (#9)
22
+ - Ruby 3.2
23
+
9
24
  ## [1.2.0] - 2022-06-03
10
25
 
11
26
  ### Added
@@ -30,7 +45,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
30
45
 
31
46
  - Possible concurrent hash modification while iterating (#1)
32
47
 
33
- [unreleased]: https://github.com/jgraichen/multi_process/compare/v1.2.0...HEAD
48
+ [Unreleased]: https://github.com/jgraichen/multi_process/compare/v1.2.1...HEAD
49
+ [1.2.1]: https://github.com/jgraichen/multi_process/compare/v1.2.0...v1.2.1
34
50
  [1.2.0]: https://github.com/jgraichen/multi_process/compare/v1.1.1...v1.2.0
35
51
  [1.1.1]: https://github.com/jgraichen/multi_process/compare/v1.1.0...v1.1.1
36
52
  [1.1.0]: https://github.com/jgraichen/multi_process/compare/v1.0.0...v1.1.0
data/Gemfile CHANGED
@@ -8,4 +8,4 @@ gemspec
8
8
  gem 'rake'
9
9
  gem 'rake-release', '~> 1.3'
10
10
  gem 'rspec', '~> 3.11'
11
- gem 'rubocop-config', github: 'jgraichen/rubocop-config', ref: 'v9', require: false
11
+ gem 'rubocop-config', github: 'jgraichen/rubocop-config', ref: 'v11', require: false
data/README.md CHANGED
@@ -12,14 +12,14 @@ gem 'multi_process'
12
12
 
13
13
  And then execute:
14
14
 
15
- ```
16
- $ bundle
15
+ ```console
16
+ bundle
17
17
  ```
18
18
 
19
19
  Or install it yourself as:
20
20
 
21
- ```
22
- $ gem install multi_process
21
+ ```console
22
+ gem install multi_process
23
23
  ```
24
24
 
25
25
  ## Usage
@@ -36,7 +36,7 @@ group.wait # Wait until finished
36
36
  group.stop # Stop processes
37
37
  ```
38
38
 
39
- ```
39
+ ```text
40
40
  (23311) rubyB | Output from B
41
41
  (23308) rubyA | Output from A
42
42
  (23314) rubyC | Output from C
@@ -55,7 +55,7 @@ group.stop # Stop processes
55
55
 
56
56
  ## License
57
57
 
58
- Copyright © 2019 Jan Graichen
58
+ Copyright © 2019-2023 Jan Graichen
59
59
 
60
60
  This program is free software: you can redistribute it and/or modify
61
61
  it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ module MultiProcess
42
42
  processes << process
43
43
  process.receiver = receiver
44
44
 
45
- start process if started?
45
+ process.start if started?
46
46
  end
47
47
  end
48
48
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support/core_ext/module/delegation'
3
+ require 'forwardable'
4
4
 
5
5
  module MultiProcess
6
6
  #
@@ -9,6 +9,8 @@ module MultiProcess
9
9
  # {Process} basically is just a thin wrapper around {ChildProcess}.
10
10
  #
11
11
  class Process
12
+ extend Forwardable
13
+
12
14
  # @!group Process
13
15
 
14
16
  # Process title used in e.g. logger
@@ -39,7 +41,7 @@ module MultiProcess
39
41
 
40
42
  # Delegate some methods to ChildProcess.
41
43
  #
42
- delegate :exited?, :alive?, :crashed?, :exit_code, :pid, to: :childprocess
44
+ delegate %i[exited? alive? crashed? exit_code pid] => :childprocess
43
45
 
44
46
  # Wait until process finished.
45
47
  #
@@ -159,7 +161,7 @@ module MultiProcess
159
161
  # Check if environment will be cleaned up for process.
160
162
  #
161
163
  # Currently that includes wrapping the process start in
162
- # `Bundler.with_clean_env` to remove bundler environment
164
+ # `Bundler.with_unbundled_env` to remove bundler environment
163
165
  # variables.
164
166
  #
165
167
  def clean_env?
@@ -216,7 +218,7 @@ module MultiProcess
216
218
  childprocess.cwd = dir
217
219
 
218
220
  if clean_env?
219
- Bundler.with_original_env { childprocess.start }
221
+ Bundler.with_unbundled_env { childprocess.start }
220
222
  else
221
223
  childprocess.start
222
224
  end
@@ -3,7 +3,7 @@
3
3
  module MultiProcess
4
4
  module VERSION
5
5
  MAJOR = 1
6
- MINOR = 2
6
+ MINOR = 3
7
7
  PATCH = 0
8
8
  STAGE = nil
9
9
  STRING = [MAJOR, MINOR, PATCH, STAGE].compact.join('.')
@@ -19,12 +19,8 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.files = `git ls-files -z`.split("\x0")
21
21
  spec.executables = spec.files.grep(%r{^bin/}) {|f| File.basename(f) }
22
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
22
  spec.require_paths = ['lib']
24
23
 
25
- spec.add_runtime_dependency 'activesupport', '>= 3.1'
26
24
  spec.add_runtime_dependency 'childprocess'
27
25
  spec.add_runtime_dependency 'nio4r', '~> 2.0'
28
-
29
- spec.add_development_dependency 'bundler'
30
26
  end
@@ -40,6 +40,25 @@ describe MultiProcess do
40
40
  expect(Time.now - start).to be < 2
41
41
  end
42
42
 
43
+ it 'starts a process added after the group has been started' do
44
+ reader, writer = IO.pipe
45
+
46
+ logger = MultiProcess::Logger.new writer, collapse: false
47
+ group = MultiProcess::Group.new receiver: logger
48
+ group << MultiProcess::Process.new(%w[ruby spec/files/test.rb 1], title: 'ruby1')
49
+ group.start
50
+ group << MultiProcess::Process.new(%w[ruby spec/files/test.rb 2], title: 'ruby2')
51
+ sleep 1
52
+ group.stop
53
+
54
+ expect(reader.read_nonblock(4096).split("\n")).to match_array <<-OUTPUT.gsub(/^\s+\./, '').split("\n")
55
+ . ruby1 | Output from 1
56
+ . ruby1 | Output from 1
57
+ . ruby2 | Output from 2
58
+ . ruby2 | Output from 2
59
+ OUTPUT
60
+ end
61
+
43
62
  it 'partitions processes' do
44
63
  group = MultiProcess::Group.new partition: 4, receiver: MultiProcess::NilReceiver.new
45
64
  group << MultiProcess::Process.new(%w[ruby sleep.rb 1], dir: 'spec/files', title: 'rubyA')
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi_process
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-03 00:00:00.000000000 Z
11
+ date: 2024-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: activesupport
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '3.1'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '3.1'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: childprocess
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -52,20 +38,6 @@ dependencies:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
40
  version: '2.0'
55
- - !ruby/object:Gem::Dependency
56
- name: bundler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
41
  description: Handle multiple child processes.
70
42
  email:
71
43
  - jg@altimos.de
@@ -124,16 +96,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
96
  - !ruby/object:Gem::Version
125
97
  version: '0'
126
98
  requirements: []
127
- rubygems_version: 3.3.7
99
+ rubygems_version: 3.4.22
128
100
  signing_key:
129
101
  specification_version: 4
130
102
  summary: Handle multiple child processes.
131
- test_files:
132
- - spec/files/env.rb
133
- - spec/files/fail.rb
134
- - spec/files/sleep.rb
135
- - spec/files/test.rb
136
- - spec/multi_process/group_spec.rb
137
- - spec/multi_process/process_spec.rb
138
- - spec/multi_process_spec.rb
139
- - spec/spec_helper.rb
103
+ test_files: []