mirror of
https://github.com/Airr/nim-cocoa.git
synced 2024-11-24 09:45:30 +00:00
Configured nimble to build/install the bundle binary
This commit is contained in:
parent
e7be67686a
commit
a0e6248333
@ -5,8 +5,9 @@ author = "Armando Rivera"
|
|||||||
description = "macOS Cocoa GUI package"
|
description = "macOS Cocoa GUI package"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
srcDir = "src"
|
srcDir = "src"
|
||||||
|
bin = @["bundle"]
|
||||||
|
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|
||||||
requires "nim >= 1.4.8"
|
requires "nim >= 1.4.8, plists"
|
||||||
|
55
src/bundle.nim
Normal file
55
src/bundle.nim
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
import json, os, plists, times
|
||||||
|
|
||||||
|
if paramCount() >= 1:
|
||||||
|
let fname = paramStr(1)
|
||||||
|
|
||||||
|
let dt = now()
|
||||||
|
|
||||||
|
let appAuthor = "Armando I. Rivera"
|
||||||
|
let appName = fname
|
||||||
|
let iconFile = "appIcon.icns"
|
||||||
|
let bundleIdentifier = "net.binarymagic." & appName
|
||||||
|
let appVersion = "0.1"
|
||||||
|
let appInfo = appVersion & " Created by " & appAuthor & " on " & dt.format("MM-dd-yyyy")
|
||||||
|
let appCopyRight = "Copyright" & dt.format(" yyyy ") & appAuthor & ". All rights reserved."
|
||||||
|
let appBundle = appName & ".app"
|
||||||
|
|
||||||
|
if fname.len > 0:
|
||||||
|
var pl = %*
|
||||||
|
|
||||||
|
{ "CFBundlePackageType" : "APPL",
|
||||||
|
"CFBundleInfoDictionaryVersion" : "6.0",
|
||||||
|
"CFBundleName" : appName,
|
||||||
|
"CFBundleExecutable" : appName,
|
||||||
|
"CFBundleIconFile" : iconFile ,
|
||||||
|
"CFBundleIdentifier" : bundleIdentifier ,
|
||||||
|
"CFBundleVersion" : appVersion ,
|
||||||
|
"CFBundleGetInfoString" : appInfo,
|
||||||
|
"CFBundleShortVersionString" : appVersion ,
|
||||||
|
"NSHumanReadableCopyright" : appCopyRight ,
|
||||||
|
"NSPrincipalClass" : "NSApplication" ,
|
||||||
|
"NSMainNibFile" : "MainMenu"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
createDir(appBundle & "/Contents/MacOS")
|
||||||
|
createDir(appBundle & "/Contents/Resources")
|
||||||
|
createDir(appBundle & "/Contents/Frameworks")
|
||||||
|
|
||||||
|
if appName.fileExists:
|
||||||
|
appName.copyFileWithPermissions(appBundle & "/Contents/MacOS/" & appName)
|
||||||
|
|
||||||
|
if iconFile.fileExists:
|
||||||
|
iconFile.copyFileWithPermissions(appBundle & "/Contents/Resources/" & iconFile)
|
||||||
|
|
||||||
|
if "Credits.rtf".fileExists:
|
||||||
|
"Credits.rtf".copyFileWithPermissions(appBundle & "/Contents/Resources/Credits.rtf")
|
||||||
|
|
||||||
|
|
||||||
|
pl.writePlist(appBundle & "/Contents/Info.plist")
|
||||||
|
|
||||||
|
discard execShellCmd("touch " & appBundle)
|
||||||
|
discard execShellCmd("open " & appBundle)
|
||||||
|
else:
|
||||||
|
echo "Usage: bundle <file>"
|
||||||
|
|
@ -7,6 +7,6 @@
|
|||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import nimcocoa
|
import cocoa
|
||||||
test "can add":
|
test "can add":
|
||||||
check add(5, 5) == 10
|
check add(5, 5) == 10
|
||||||
|
Loading…
Reference in New Issue
Block a user