Class: Neutron::App
- Inherits:
-
Object
- Object
- Neutron::App
- Defined in:
- lib/neutron/app.rb
Instance Method Summary collapse
-
#initialize(controller:) ⇒ App
constructor
A new instance of App.
- #run ⇒ Object
Constructor Details
#initialize(controller:) ⇒ App
Returns a new instance of App.
7 8 9 10 |
# File 'lib/neutron/app.rb', line 7 def initialize(controller:) raise 'Controller must be inherit from Neutron::Controller' unless controller.is_a?(::Neutron::Controller) @controller = controller end |
Instance Method Details
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/neutron/app.rb', line 12 def run path = File.('..', caller[0].split(':').first) begin Thread.new { @controller.run } `cd '#{path}' && npm run boot` ensure process_path = File.join(path, 'node_modules/electron-prebuilt-compile/lib/es6-init.js') p = Sys::ProcTable.ps.select { |p| p.cmdline.include?(process_path) }.first Process.kill('HUP', p.pid) if p @controller.stop end end |