Class: Device::Runtime

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

Class Method Summary collapse

Class Method Details

.adapterObject



5
6
7
# File 'lib/device/runtime.rb', line 5

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.



16
17
18
19
20
21
# File 'lib/device/runtime.rb', line 16

def self.execute(app, json = nil)
  buf = "#{json.dup}" if json.is_a?(String)
  mrb_eval("Context.execute('#{app.dup}', '#{Device.adapter}', '#{buf}')", "#{app.dup}")
ensure
  self.system_reload
end

.reloadObject



41
42
43
# File 'lib/device/runtime.rb', line 41

def self.reload
  self.adapter.reload
end

.start(app, json = nil) ⇒ Object



23
24
25
26
# File 'lib/device/runtime.rb', line 23

def self.start(app, json = nil)
  buf = "#{json.dup}" if json.is_a?(String)
  mrb_eval("Context.start('#{app.dup}', '#{Device.adapter}', '#{buf}')", "#{app.dup}")
end

.stop(app) ⇒ Object



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

def self.stop(app)
  mrb_stop(app)
end

.system_reloadNilClass

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

Returns:

  • (NilClass)

    From the new runtime instance.



34
35
36
37
38
39
# File 'lib/device/runtime.rb', line 34

def self.system_reload
  Device::Setting.setup
  DaFunk::ParamsDat.setup
  Device::Network.setup
  nil
end