Class: Cerberus::BuildAllCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/cerberus/manager.rb

Instance Method Summary collapse

Constructor Details

#initialize(cli_options = {}) ⇒ BuildAllCommand

Returns a new instance of BuildAllCommand.



189
190
191
# File 'lib/cerberus/manager.rb', line 189

def initialize(cli_options = {})
  @cli_options = cli_options
end

Instance Method Details

#runObject



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/cerberus/manager.rb', line 193

def run
  threads = []
  Dir["#{HOME}/config/*.yml"].each do |fn|
    fn =~ %r{#{HOME}/config/(.*).yml}
    application_name = $1
    
    command = Cerberus::BuildCommand.new(application_name, @cli_options)
    threads << Thread.new { command.run } if command.run_time?(Time.now)
  end
  
  @already_waited = false
  threads.each do |t| 
    if @already_waited or not t.join(LOCK_WAIT)
      t.kill
      @already_waited = true
    end
  end
end