Class: Flatware::CLI
- Inherits:
-
Thor
- Object
- Thor
- Flatware::CLI
- Defined in:
- lib/flatware/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.processors ⇒ Object
7 8 9 |
# File 'lib/flatware/cli.rb', line 7 def self.processors @processors ||= ProcessorInfo.count end |
.worker_option ⇒ Object
11 12 13 |
# File 'lib/flatware/cli.rb', line 11 def self.worker_option method_option :workers, aliases: '-w', type: :numeric, default: processors, desc: 'Number of concurent processes to run' end |
Instance Method Details
#clear ⇒ Object
34 35 36 37 38 |
# File 'lib/flatware/cli.rb', line 34 def clear (Flatware.pids - [$PROCESS_ID]).each do |pid| Process.kill 6, pid end end |
#fan(*command) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/flatware/cli.rb', line 19 def fan(*command) Flatware.verbose = [:log] command = command.join(' ') puts "Running '#{command}' on #{workers} workers" workers.times do |i| fork do exec({ 'TEST_ENV_NUMBER' => i.to_s }, command) end end Process.waitall end |