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
# 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
  return mrb_eval "Context.start('#{app}', '#{Device.adapter}', '#{json}')"
end