Class: RhoDevelopment::PlatformPartialUpdateBuildingTask

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

Overview

Class builds partial update bundle for specified platform

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from LiveUpdateTask

descendants, #execute

Constructor Details

#initialize(aPlatform, aFilename) ⇒ PlatformPartialUpdateBuildingTask

Initialize instance with platform name

Parameters:

  • aPlatform (String)

    platform name.



154
155
156
157
# File 'lib/build/development/live_update_task.rb', line 154

def initialize(aPlatform, aFilename)
  @platform = aPlatform
  @filename = aFilename
end

Class Method Details

.fromHash(aHash) ⇒ Object

Creates instance of class and parametrises it with values from passed argument

Parameters:

  • aHash (Hash)

    It needs to contain key named as ‘platform’ with platform name.

Returns:

  • (Object)

    instance of PlatformPartialUpdateBuildingTask



148
149
150
# File 'lib/build/development/live_update_task.rb', line 148

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

.taskNameString

Returns unique task name

Returns:

  • (String)

    Unique task name



141
142
143
# File 'lib/build/development/live_update_task.rb', line 141

def self.taskName
  'BuildPlatformPartialUpdate'
end

Instance Method Details

#actionObject

Builds partial update bundle



160
161
162
163
# File 'lib/build/development/live_update_task.rb', line 160

def action
  server = BuildServer.new
  server.build_partial_bundle_for_platform(@platform, @filename)
end

#dispatchToUrl(anUri) ⇒ Object

Method serializes itself to a hash and sends post request with the hash to specified URI

Parameters:

  • anUri (URI)

    URI for post request



167
168
169
170
# File 'lib/build/development/live_update_task.rb', line 167

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