Class: RhoDevelopment::PartialUpdateTask

Inherits:
LiveUpdateTask show all
Defined in:
lib/build/development/live_update_task.rb

Overview

Checks is source code for each subscriber platform changed and starts building and notifying process for platform

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from LiveUpdateTask

descendants, #execute

Constructor Details

#initialize(aFilename) ⇒ PartialUpdateTask

Returns a new instance of PartialUpdateTask.



308
309
310
# File 'lib/build/development/live_update_task.rb', line 308

def initialize(aFilename)
  @filename = aFilename
end

Class Method Details

.fromHash(aHash) ⇒ Object



317
318
319
320
# File 'lib/build/development/live_update_task.rb', line 317

def self.fromHash(aHash)
  filename = aHash['filename']
  self.new(filename)
end

.taskNameObject



323
324
325
# File 'lib/build/development/live_update_task.rb', line 323

def self.taskName
  'PartialUpdateTask'
end

Instance Method Details

#actionObject

Checks has source code changes for each platform



328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/build/development/live_update_task.rb', line 328

def action
  updated_list_filename = File.join(Configuration::application_root, 'upgrade_package_add_files.txt')
  removed_list_filename = File.join(Configuration::application_root, 'upgrade_package_remove_files.txt')
  mkdir_p Configuration::development_directory
  Configuration::enabled_subscriber_platforms.each { |each|
    RhoDevelopment.setup(Configuration::development_directory, each)
    puts "Check changes for #{each}".warning
    changed = RhoDevelopment.check_changes_from_last_build(updated_list_filename, removed_list_filename)
    if changed
      puts "Source code for platform #{each} was changed".primary
      WebServer.dispatch_task(PlatformPartialUpdateBuildingTask.new(each, @filename));
      Configuration::enabled_subscribers_by_platform(each).each { |subscriber|
        WebServer.dispatch_task(SubscriberPartialUpdateNotifyingTask.new(subscriber, @filename));
      }
    else
      puts "Source code for platform #{each} wasn't changed".primary
    end
  }
end

#dispatchToUrl(anUri) ⇒ Object



312
313
314
315
# File 'lib/build/development/live_update_task.rb', line 312

def dispatchToUrl(anUri)
  uri = URI.join(anUri, 'tasks/new')
  Net::HTTP.post_form(uri, {'taskName' => self.class.taskName, 'filename' => @filename})
end