Module: Pspec::Replicator

Defined in:
lib/pspec/replicator.rb

Class Method Summary collapse

Class Method Details

.optimal_processors_countObject



4
5
6
# File 'lib/pspec/replicator.rb', line 4

def optimal_processors_count
  [Parallel.processor_count - 1, 1].max
end

.replicateObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/pspec/replicator.rb', line 8

def replicate
  (optimal_processors_count - 1).times do |index|
    number = index + 2

    drop_database number
    create_database number

    Rails.logger.info "Database #{database number} was created"
  end
end