-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb2mac.art
executable file
·82 lines (74 loc) · 2.67 KB
/
web2mac.art
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env arturo
createApp: function [name, url][
; the App we are going to create
dest: ~"|name|.app/Contents"
; let's create the main directory structure
write.directory ~"|dest|/MacOS" ø
write.directory ~"|dest|/Resources" ø
; let's move the Arturo binary into place
copy sys\binary ~"|dest|/MacOS/arturo"
; let's set up our "launcher" script
; this is a regular script that executes
; the bundled Arturo binary along with
; the main script
write ~"|dest|/MacOS/launcher" ~{
#!/bin/sh
"exec" "`dirname $0`/arturo" "`dirname $0`/../Resources/main.art"
}
; and make it executable (important!)
execute ~"sudo chmod +x |dest|/MacOS/launcher"
; the main Arturo script
; (not really much to it, just a webview
; pointing to the URL in question)
write ~"|dest|/Resources/main.art" ~{
webview.title:"|name|" "|url|"
}
; and the main Info.plist -
; so that the .app bundle is recognised
; as a valid application by macOS
write ~"|dest|/Info.plist" ~{
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>launcher</string>
<key>CFBundleSignature</key>
<string>MYAP</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleIdentifier</key>
<string>co.ensili.|name|</string>
<key>CFBundleDisplayName</key>
<string>|name|</string>
<key>CFBundleName</key>
<string>|name|</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key></key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
<key>NSCameraUsageDescription</key>
<string>Request camera access</string>
<key>NSMicrophoneUsageDescription</key>
<string>Request microphone access</string>
</dict>
</plist>
}
]
; the script is meant to be used like:
; ./web2mac.art MyAppName https://some.url.com
if standalone? ::
createApp arg\0 arg\1