masamune 0.18.2 → 0.18.3
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc35b976d3a3db9e1c607ed58c09e38dadbf2928
|
4
|
+
data.tar.gz: 79d7c83267acf6faed9ada08768f515dc927782a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee73bba553255b67aa74bf852cc36a1d7a345cf9d1f586f85c115ac384e044c7e658e4c40d4f32707647ab846030c4635ac8dab5aa962f6e7525a619cd8effca
|
7
|
+
data.tar.gz: a428ee198c1e77a39f8a3ea362fd525c09dbda6efba3ef9ac6d4688c8a7860d2584dc747485872e080224bf182b16ed44923f50af223410436ecbd785b32ca0e
|
@@ -31,16 +31,16 @@ module Masamune::Actions
|
|
31
31
|
include Masamune::Actions::Execute
|
32
32
|
|
33
33
|
included do |base|
|
34
|
-
base.class_option :max_tasks, aliases: '-p', type: :numeric, desc: 'Maximum number of tasks to execute in parallel', default:
|
34
|
+
base.class_option :max_tasks, aliases: '-p', type: :numeric, desc: 'Maximum number of tasks to execute in parallel', default: Parallel.processor_count
|
35
35
|
end
|
36
36
|
|
37
37
|
def invoke_parallel(*task_group)
|
38
|
-
per_task_opts = task_group.last.is_a?(Array) ? task_group.pop : [{}]
|
39
|
-
all_task_opts = task_group.last.is_a?(Hash) ? task_group.pop : {}
|
40
|
-
|
38
|
+
per_task_opts = task_group.last.is_a?(Array) ? task_group.pop.dup : [{}]
|
39
|
+
all_task_opts = task_group.last.is_a?(Hash) ? task_group.pop.dup : {}
|
40
|
+
task_group_by_task_opts = task_group.product(per_task_opts)
|
41
|
+
max_tasks = [all_task_opts.delete(:max_tasks), task_group_by_task_opts.count].min
|
41
42
|
console("Setting max_tasks to #{max_tasks}")
|
42
43
|
bail_fast task_group, all_task_opts if all_task_opts[:version]
|
43
|
-
task_group_by_task_opts = task_group.product(per_task_opts)
|
44
44
|
Parallel.each(task_group_by_task_opts, in_processes: max_tasks) do |task_name, task_opts|
|
45
45
|
task_env = task_opts[:env] || {}
|
46
46
|
begin
|
data/lib/masamune/version.rb
CHANGED
@@ -29,6 +29,7 @@ describe Masamune::Actions::InvokeParallel do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
let(:instance) { klass.new }
|
32
|
+
let(:task_opts) { { max_tasks: 0 }.freeze }
|
32
33
|
|
33
34
|
describe '.invoke_parallel' do
|
34
35
|
context 'with a single thor command' do
|
@@ -37,7 +38,7 @@ describe Masamune::Actions::InvokeParallel do
|
|
37
38
|
end
|
38
39
|
|
39
40
|
subject do
|
40
|
-
instance.invoke_parallel('list',
|
41
|
+
instance.invoke_parallel('list', task_opts)
|
41
42
|
end
|
42
43
|
|
43
44
|
it { expect { subject }.to_not raise_error }
|
@@ -50,7 +51,7 @@ describe Masamune::Actions::InvokeParallel do
|
|
50
51
|
end
|
51
52
|
|
52
53
|
subject do
|
53
|
-
instance.invoke_parallel('list',
|
54
|
+
instance.invoke_parallel('list', task_opts, [{ a: true, b: false }, { a: false, b: true }])
|
54
55
|
end
|
55
56
|
|
56
57
|
it { expect { subject }.to_not raise_error }
|
@@ -63,7 +64,7 @@ describe Masamune::Actions::InvokeParallel do
|
|
63
64
|
end
|
64
65
|
|
65
66
|
subject do
|
66
|
-
instance.invoke_parallel('list',
|
67
|
+
instance.invoke_parallel('list', task_opts, [{ env: { 'MASAMUNE_ENV' => 'test_1' } }, { env: { 'MASAMUNE_ENV' => 'test_2' } }])
|
67
68
|
end
|
68
69
|
|
69
70
|
it { expect { subject }.to_not raise_error }
|
@@ -78,7 +79,7 @@ describe Masamune::Actions::InvokeParallel do
|
|
78
79
|
end
|
79
80
|
|
80
81
|
subject do
|
81
|
-
instance.invoke_parallel('list', 'help',
|
82
|
+
instance.invoke_parallel('list', 'help', task_opts, [{ env: { 'MASAMUNE_ENV' => 'test_1' } }, { env: { 'MASAMUNE_ENV' => 'test_2' } }])
|
82
83
|
end
|
83
84
|
|
84
85
|
it { expect { subject }.to_not raise_error }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: masamune
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.18.
|
4
|
+
version: 0.18.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Andrews
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|