diff --git a/bin/peck b/bin/peck index fbf46f0..f758ebc 100755 --- a/bin/peck +++ b/bin/peck @@ -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 @@ -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 diff --git a/lib/peck.rb b/lib/peck.rb index 60bed1a..cd12021 100644 --- a/lib/peck.rb +++ b/lib/peck.rb @@ -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|