Skip to content

Commit

Permalink
Add a -c and --concurrency switch.
Browse files Browse the repository at this point in the history
The switch sets the concurrency level for the suite.
  • Loading branch information
Manfred committed Sep 3, 2013
1 parent ca93aff commit 1ba2c59
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions bin/peck
Expand Up @@ -10,6 +10,7 @@ if options.first.has_key?('h') || options.first.has_key?('help')
puts <<-EOF
Usage: peck [options] [files]
-c, --concurrency set the number of threads used to run the suite
-e, --match-regexp run tests that match a given regular expression
-t, --match-text run tests that match a given string
-a, --recently-accessed run tests that have been updated in the last 15 minutes
Expand All @@ -24,6 +25,10 @@ unless (%w(v version) & options.first.keys).empty?
exit 1
end

if concurrency = options.first['c'] || options.first['concurrency']
Peck.concurrency = concurrency.to_i
end

if match_regexp = options.first['e'] || options.first['match-regexp']
Peck.spec_selector = Regexp.new(match_regexp)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/peck.rb
Expand Up @@ -88,7 +88,7 @@ def self.run_serial
end

def self.run_concurrent
Peck.log("Running specs concurrently")
Peck.log("Running specs concurrently (#{Peck.concurrency} threads)")
current_spec = -1
specs = all_specs
threaded do |nr|
Expand Down

0 comments on commit 1ba2c59

Please sign in to comment.