Class: Device::Runtime

Inherits:
Object
  • Object
show all
Defined in:
lib/device/runtime.rb

Class Method Summary collapse

Class Method Details

.adapterObject



3
4
5
# File 'lib/device/runtime.rb', line 3

def self.adapter
  Device.adapter::Runtime
end

.execute(app, json = nil) ⇒ Object

Execute app in new context.

To execute the should exists a zip file cotain the app,
previously downloaded from CloudWalk.

Parameters:

  • app (String)

    App name, example “app”, should exists file app.zip

  • json (String) (defaults to: nil)

    Parameters to confifure new aplication.

Returns:

  • (Object)

    From the new runtime instance.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/device/runtime.rb', line 14

def self.execute(app, json = nil)
  unless app.include?(".")
    zip = "./#{app}.zip"
    Device::Display.clear
    raise File::FileError, zip unless File.exists?(zip)
    raise "Problem to unzip #{zip}" unless Zip.uncompress(zip, app)
  end
  execution_ret = mrb_eval("Context.start('#{app}', '#{Device.adapter}', '#{json}')")
  self.system_reaload
  return execution_ret
end

.system_realoadNilClass

Check if any change has happen to Network, Settings or ParamsDat

Returns:

  • (NilClass)

    From the new runtime instance.



28
29
30
31
32
33
# File 'lib/device/runtime.rb', line 28

def self.system_reaload
  Device::Setting.setup
  Device::ParamsDat.setup
  Device::Network.setup
  nil
end