#REFACTORING by cg
authorClaus Gittinger <cg@exept.de>
Fri, 12 Oct 2018 14:50:34 +0200
changeset 23430 00371f2b70a3
parent 23429 58f5170cac48
child 23431 79d6ac15fb54
#REFACTORING by cg class: ApplicationDefinition class added: #generate_osxOsascript #generate_osx_osascript #osxOsascript #osxOsascript_mappings #osx_osascript #osx_osascript_mappings changed: #basicFileNamesToGenerate
ApplicationDefinition.st
--- a/ApplicationDefinition.st	Fri Oct 12 14:25:27 2018 +0200
+++ b/ApplicationDefinition.st	Fri Oct 12 14:50:34 2018 +0200
@@ -799,7 +799,9 @@
         at:self rcFilename      put:#'generate_packageName_dot_rc';
         at:self nsiFilename     put:#'generate_packageName_dot_nsi';            "/ for win32
         at:self apspecFilename  put:#'generate_autopackage_default_dot_apspec'; "/ for linux
-        at:'osx/Info.plist'     put:#'generate_osx_info_dot_plist';             "/ for osx
+        at:'osx/Info.plist'       put:#'generate_osx_info_dot_plist';           "/ for osx
+        at:'osx/osascript.script' put:#'generate_osx_osascript';                "/ for osx
+
         "/ at:'osx/PkgInfo'        put:#'generate_osx_pkginfo';
         at:'builder/baseline.rbspec'  put:#'generate_builder_baseline_dot_rbspec';
         at:'builder/package.deps.rake' put: #'generate_package_dot_deps_dot_rake'.
@@ -855,6 +857,19 @@
     "Modified: / 11-08-2006 / 14:01:56 / cg"
 !
 
+generate_osx_osascript
+
+    ^ (self
+        replaceMappings: self osx_osascript_mappings
+        in: self osx_osascript) asStringCollection withTabs asString.
+
+    "
+     stx_clients_Clock_QlockTwoWatchApplication generate_osx_osascript
+    "
+
+    "Modified: / 09-08-2006 / 11:31:01 / fm"
+!
+
 generate_osx_pkginfo
     ^ 'APPL',self applicationName
 !
@@ -1237,6 +1252,18 @@
     ^ s
 !
 
+osx_osascript_mappings
+    |d|
+
+    d := Dictionary new.
+    d 
+        at: 'APPLICATION' put: (self applicationName);
+        at: 'PRODUCT_NAME' put: (self productName);
+        at: 'PRODUCT_FILENAME' put: (self productFilename);
+        yourself.
+    ^ d
+!
+
 packageName_dot_nsi_mappings
     |d fn s defLines undefLines defRunAsAdmin undefRunAsAdmin stxSourcesLines appSourcesLines|
 
@@ -2976,6 +3003,47 @@
 '
 !
 
+osx_osascript
+    "generate (OSX unix) osa script commands to arrange the dmg folder being shown.
+     This is used to generate a macOS deployable dmg"
+
+    |packageID product|
+
+    product := self productName.
+    packageID := self package copyReplaceAny:':/' with:$..
+
+    ^
+'tell application "Finder"
+  tell disk "%(PRODUCT_NAME)"
+        open
+        set current view of container window to icon view
+        set toolbar visible of container window to false
+        set statusbar visible of container window to false
+        set the bounds of container window to {500, 100, 1023, 380}
+        set viewOptions to the icon view options of container window
+        set arrangement of viewOptions to not arranged
+        set icon size of viewOptions to 72
+', (self osxDmgBackgroundImageFile notNil 
+        ifTrue:[
+'        set background picture of viewOptions to file ".background:banner.png"
+        set position of item ".background" of container window to {600, 200}
+']
+        ifFalse:[''])
+,'        set position of item ".Trashes" of container window to {600, 200}
+        set position of item ".fseventsd" of container window to {600, 200}
+        set position of item ".DS_Store" of container window to {600, 200}
+        set position of item "%(PRODUCT_NAME).app" of container window to {160, 100}
+        set position of item "Applications" of container window to {360, 100}
+        set the bounds of container window to {500, 100, 1023, 380}
+        close
+        open
+        update without registering applications
+        delay 2
+  end tell
+end tell
+'.
+!
+
 packageName_dot_nsi
     "the template code for the <appname>.nsi file"