system_browser 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/VERSION +1 -1
- data/lib/system_browser/client.rb +19 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 338b936e004171055f0097b60e47397b721be26d
|
4
|
+
data.tar.gz: f55554b5c83afe3df64adeb92975a5a7f60de27f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4501536af64df037e517ed3bbfd353b8ba5afeff5833dba0ca412d8741740915448d9dec2875c8f6a0c0b5d64f0a925737bc6d19c213af05c433398657ca62b4
|
7
|
+
data.tar.gz: b4ad3de83662538418758dde97311ca1431389e536689925e242f4fdf6695ecab8a0341bc38c1d6619ec0746eaafcb5045b2d7153f99c97d6841478fea0cfc5e
|
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -7,7 +7,7 @@ module SystemBrowser
|
|
7
7
|
|
8
8
|
##
|
9
9
|
# The name of the executable of the client application.
|
10
|
-
|
10
|
+
CLIENT_NAME = 'system_browser'
|
11
11
|
|
12
12
|
##
|
13
13
|
# @return [SystemBrowser::Session]
|
@@ -32,11 +32,13 @@ module SystemBrowser
|
|
32
32
|
# @return [Integer] the process ID of the client application
|
33
33
|
# @raise [RuntimeError]
|
34
34
|
def start
|
35
|
-
|
36
|
-
|
35
|
+
executable = self.client_executable
|
36
|
+
|
37
|
+
unless system("which #{executable} > /dev/null 2>&1")
|
38
|
+
fail ClientNotFoundError, "executable '#{executable}' is not on your $PATH"
|
37
39
|
end
|
38
40
|
|
39
|
-
@init_pid = spawn(
|
41
|
+
@init_pid = spawn(executable, pgroup: true)
|
40
42
|
Process.wait(@init_pid)
|
41
43
|
|
42
44
|
@init_pid
|
@@ -59,5 +61,18 @@ module SystemBrowser
|
|
59
61
|
|
60
62
|
Process.kill(:INT, @window_pid)
|
61
63
|
end
|
64
|
+
|
65
|
+
protected
|
66
|
+
|
67
|
+
def client_executable
|
68
|
+
case RUBY_PLATFORM
|
69
|
+
when /linux/
|
70
|
+
CLIENT_NAME
|
71
|
+
when /darwin/
|
72
|
+
"/Applications/#{CLIENT_NAME}.app/Contents/MacOS/nwjs"
|
73
|
+
else
|
74
|
+
raise RuntimeError, "unsupported platform #{RUBY_PLATFORM}"
|
75
|
+
end
|
76
|
+
end
|
62
77
|
end
|
63
78
|
end
|