Class: Nitra::Configuration
- Inherits:
-
Object
- Object
- Nitra::Configuration
- Defined in:
- lib/nitra/configuration.rb
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#framework ⇒ Object
Returns the value of attribute framework.
-
#frameworks ⇒ Object
Returns the value of attribute frameworks.
-
#print_failures ⇒ Object
Returns the value of attribute print_failures.
-
#process_count ⇒ Object
Returns the value of attribute process_count.
-
#quiet ⇒ Object
Returns the value of attribute quiet.
-
#rake_tasks ⇒ Object
Returns the value of attribute rake_tasks.
-
#slave_mode ⇒ Object
Returns the value of attribute slave_mode.
-
#slaves ⇒ Object
Returns the value of attribute slaves.
Instance Method Summary collapse
- #add_framework(framework) ⇒ Object
- #add_rake_task(name, list) ⇒ Object
- #add_slave(command) ⇒ Object
- #calculate_default_process_count ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #set_default_framework ⇒ Object
- #set_process_count(n) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
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
#debug ⇒ Object
Returns the value of attribute debug.
5 6 7 |
# File 'lib/nitra/configuration.rb', line 5 def debug @debug end |
#environment ⇒ Object
Returns the value of attribute environment.
6 7 8 |
# File 'lib/nitra/configuration.rb', line 6 def environment @environment end |
#framework ⇒ Object
Returns the value of attribute framework.
6 7 8 |
# File 'lib/nitra/configuration.rb', line 6 def framework @framework end |
#frameworks ⇒ Object
Returns the value of attribute frameworks.
6 7 8 |
# File 'lib/nitra/configuration.rb', line 6 def frameworks @frameworks end |
#print_failures ⇒ Object
Returns the value of attribute print_failures.
5 6 7 |
# File 'lib/nitra/configuration.rb', line 5 def print_failures @print_failures end |
#process_count ⇒ Object
Returns the value of attribute process_count.
6 7 8 |
# File 'lib/nitra/configuration.rb', line 6 def process_count @process_count end |
#quiet ⇒ Object
Returns the value of attribute quiet.
5 6 7 |
# File 'lib/nitra/configuration.rb', line 5 def quiet @quiet end |
#rake_tasks ⇒ Object
Returns the value of attribute rake_tasks.
5 6 7 |
# File 'lib/nitra/configuration.rb', line 5 def rake_tasks @rake_tasks end |
#slave_mode ⇒ Object
Returns the value of attribute slave_mode.
6 7 8 |
# File 'lib/nitra/configuration.rb', line 6 def slave_mode @slave_mode end |
#slaves ⇒ Object
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_count ⇒ Object
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_framework ⇒ Object
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 |