wolfpack 1.0.3 → 1.0.4
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/examples/rails_specs.rb +3 -3
- data/lib/wolfpack.rb +8 -2
- data/lib/wolfpack/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af5095b20971b9865d429a28388e3686ff658be8
|
4
|
+
data.tar.gz: fdc140072db1bbbccc3ce4760db8128891fc09c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c236e6822e97d0bd5874613aacdf5d5d769516156450fc696c6d2e96abe1babd9208b6d2622e7a00a668c0ad51236092cd8e3f8b874dd05646b6b7ce8b43773
|
7
|
+
data.tar.gz: 902656ff26d463d9fb2f0e50f21ed4edf367746d51c1c5febc294bd36e030a72a98a15903520fd4a571d3578b931ad43bf21ecd4605619d5b8fd9a76584b2db5
|
data/examples/rails_specs.rb
CHANGED
@@ -14,7 +14,7 @@ after_fork do |n, args|
|
|
14
14
|
|
15
15
|
# We'll feed in a list of specs that we want to run from stdin,
|
16
16
|
# concat with a space, and output into an ENV var that rspec will pick up.
|
17
|
-
ENV['SPEC_FILES'] = args.join(
|
17
|
+
ENV['SPEC_FILES'] = args.map(&:chomp).join(" ")
|
18
18
|
|
19
19
|
# And whatever else you need to deal with...
|
20
20
|
end
|
@@ -23,7 +23,7 @@ __END__
|
|
23
23
|
|
24
24
|
Now you're ready to run this! Try something like this on your CLI:
|
25
25
|
|
26
|
-
$ bundle exec wolfpack exec "rake db:setup
|
26
|
+
$ bundle exec wolfpack exec "rake db:setup db:schema:load; rspec $SPEC_FILES;"
|
27
27
|
|
28
28
|
and you're off to the races! In practice its probably not that easy though because
|
29
|
-
specs are generally not developed initially with concurrency in mind.
|
29
|
+
specs are generally not developed initially with concurrency in mind.
|
data/lib/wolfpack.rb
CHANGED
@@ -55,10 +55,12 @@ module Wolfpack
|
|
55
55
|
partions = args ? partition(args, processes) : Array.new(processes){[]}
|
56
56
|
|
57
57
|
# Now run the command with the processes.
|
58
|
-
Parallel.
|
58
|
+
successes = Parallel.map_with_index(partions, :in_processes => processes) do |args, n|
|
59
59
|
after_fork.call(n, args) if after_fork
|
60
60
|
system @command
|
61
61
|
end
|
62
|
+
|
63
|
+
successes.all?
|
62
64
|
end
|
63
65
|
|
64
66
|
# Configures the runner's by reading a configuration file and eval-ing
|
@@ -85,12 +87,16 @@ module Wolfpack
|
|
85
87
|
method_options %w( config -c ) => :string
|
86
88
|
method_options %w( processes -n ) => :integer
|
87
89
|
method_options %w( args -a ) => :array
|
90
|
+
|
91
|
+
RETURN_CODE_SUCCESS = 0
|
92
|
+
RETURN_CODE_FAILURE = 1
|
88
93
|
def exec(command)
|
89
94
|
# Parse out an integer for the # of processors the user specifies since
|
90
95
|
# thor doesn't return an integer for its params.
|
91
96
|
processes = options[:processes].to_i if options[:processes]
|
92
97
|
|
93
|
-
Wolfpack::Runner.new(command, options[:args], options[:config]).run(processes)
|
98
|
+
success = Wolfpack::Runner.new(command, options[:args], options[:config]).run(processes)
|
99
|
+
exit(success ? RETURN_CODE_SUCCESS : RETURN_CODE_FAILURE)
|
94
100
|
end
|
95
101
|
|
96
102
|
desc "version", "Wolfpack version"
|
data/lib/wolfpack/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wolfpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brad Gessler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,10 +122,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.2.3
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: Run ruby tasks in parallel
|
129
129
|
test_files:
|
130
130
|
- spec/lib/wolfpack.rb
|
131
131
|
- spec/spec_helper.rb
|
132
|
+
has_rdoc:
|