Class: Nitra::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/nitra/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



8
9
10
11
12
13
14
# File 'lib/nitra/configuration.rb', line 8

def initialize
  self.environment = "nitra"
  self.slaves = []
  self.rake_tasks = {}
  self.frameworks = []
  calculate_default_process_count
end

Instance Attribute Details

#debugObject

Returns the value of attribute debug.



5
6
7
# File 'lib/nitra/configuration.rb', line 5

def debug
  @debug
end

#environmentObject

Returns the value of attribute environment.



6
7
8
# File 'lib/nitra/configuration.rb', line 6

def environment
  @environment
end

#frameworkObject

Returns the value of attribute framework.



6
7
8
# File 'lib/nitra/configuration.rb', line 6

def framework
  @framework
end

#frameworksObject

Returns the value of attribute frameworks.



6
7
8
# File 'lib/nitra/configuration.rb', line 6

def frameworks
  @frameworks
end

Returns the value of attribute print_failures.



5
6
7
# File 'lib/nitra/configuration.rb', line 5

def print_failures
  @print_failures
end

#process_countObject

Returns the value of attribute process_count.



6
7
8
# File 'lib/nitra/configuration.rb', line 6

def process_count
  @process_count
end

#quietObject

Returns the value of attribute quiet.



5
6
7
# File 'lib/nitra/configuration.rb', line 5

def quiet
  @quiet
end

#rake_tasksObject

Returns the value of attribute rake_tasks.



5
6
7
# File 'lib/nitra/configuration.rb', line 5

def rake_tasks
  @rake_tasks
end

#slave_modeObject

Returns the value of attribute slave_mode.



6
7
8
# File 'lib/nitra/configuration.rb', line 6

def slave_mode
  @slave_mode
end

#slavesObject

Returns the value of attribute slaves.



6
7
8
# File 'lib/nitra/configuration.rb', line 6

def slaves
  @slaves
end

Instance Method Details

#add_framework(framework) ⇒ Object



16
17
18
# File 'lib/nitra/configuration.rb', line 16

def add_framework(framework)
  frameworks << framework
end

#add_rake_task(name, list) ⇒ Object



20
21
22
# File 'lib/nitra/configuration.rb', line 20

def add_rake_task(name, list)
  rake_tasks[name] = list
end

#add_slave(command) ⇒ Object



24
25
26
# File 'lib/nitra/configuration.rb', line 24

def add_slave(command)
  slaves << {:command => command, :cpus => nil}
end

#calculate_default_process_countObject



32
33
34
# File 'lib/nitra/configuration.rb', line 32

def calculate_default_process_count
  self.process_count ||= Nitra::Utils.processor_count
end

#set_default_frameworkObject



28
29
30
# File 'lib/nitra/configuration.rb', line 28

def set_default_framework
  self.framework = frameworks.first if frameworks.any?
end

#set_process_count(n) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/nitra/configuration.rb', line 36

def set_process_count(n)
  if slaves.empty?
    self.process_count = n
  else
    slaves.last[:cpus] = n
  end
end