Class: OpalWebpackCompileServer::Exe

Inherits:
Object
  • Object
show all
Defined in:
lib/opal-webpack-compile-server/exe.rb

Class Method Summary collapse

Class Method Details



110
111
112
# File 'lib/opal-webpack-compile-server/exe.rb', line 110

def self.dont_unlink_on_exit
  @unlink = false
end

.killObject



114
115
116
117
118
119
120
121
122
# File 'lib/opal-webpack-compile-server/exe.rb', line 114

def self.kill
  if File.exist?(OWCS_SOCKET_PATH)
    dont_unlink_on_exit
    s = UNIXSocket.new(OWCS_SOCKET_PATH)
    s.send("command:kill\n", 0)
    s.close
    exit(0)
  end
end

.runObject



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/opal-webpack-compile-server/exe.rb', line 124

def self.run
  if File.exist?(OWCS_SOCKET_PATH) # OWCS already running
    puts "Another Compile Server already running, exiting"
    dont_unlink_on_exit
    exit(1)
  else
    unlink_on_exit
    load_paths = OpalWebpackCompileServer::LoadPathManager.get_load_paths
    if load_paths
      Opal.append_paths(*load_paths)
      Process.daemon(true)
      EventMachine.run do
        EventMachine.start_unix_domain_server(OWCS_SOCKET_PATH, OpalWebpackCompileServer::Compiler)
      end
    end
  end
end


106
107
108
# File 'lib/opal-webpack-compile-server/exe.rb', line 106

def self.unlink_on_exit
  @unlink = true
end

Returns:

  • (Boolean)


102
103
104
# File 'lib/opal-webpack-compile-server/exe.rb', line 102

def self.unlink_socket?
  @unlink
end