git.fiddlerwoaroof.com
Browse code

Add utilities and make build work "froms scratch"

Edward Langley authored on 25/10/2019 22:05:50
Showing 5 changed files
... ...
@@ -1,5 +1,6 @@
1 1
 ASSET_DIRS = $(shell find assets/ -type d)
2 2
 ASSET_FILES = $(shell find assets/ -type f)
3
+LW_PATH = $(shell which lw)
3 4
 
4 5
 all: app.icns CJAWSAccess.app assets/accounts.json $(ASSET_DIRS) $(ASSET_FILES)
5 6
 	rsync -arvh assets/ CJAWSAccess.app/Contents/Resources/
... ...
@@ -29,3 +30,6 @@ cleanDmg:
29 30
 clean: cleanDmg
30 31
 	rm -f assets/accounts.json
31 32
 	rm -rf CJAWSAccess.app
33
+
34
+dev:
35
+	cp $(LW_PATH) CJAWSAccess.app/Contents/MacOS/lw
... ...
@@ -22,8 +22,10 @@
22 22
     :serial t
23 23
     :components ((:module "src"
24 24
                   :serial t
25
-                  :components ((:file "pprint-setup")
26
-                               (:file "package")
25
+                  :components ((:file "package")
26
+                               (:file "utils")
27
+                               (:file "capi-utils")
28
+                               (:file "pprint-setup")
27 29
                                (:file "store")
28 30
                                (:file "aws-dispatcher")
29 31
                                (:file "domain")
... ...
@@ -1,3 +1,13 @@
1
+(defun utf-8-file-encoding (pathname ef-spec buffer length)
2
+  (declare (ignore pathname buffer length))
3
+  (system:merge-ef-specs ef-spec :utf-8))
4
+
5
+(setq system:*file-encoding-detection-algorithm*
6
+      (substitute 'utf-8-file-encoding
7
+                  'system:locale-file-encoding
8
+                  system:*file-encoding-detection-algorithm*))
9
+(set-default-character-element-type 'simple-char)
10
+
1 11
 (in-package :cl-user)
2 12
 (setf *default-pathname-defaults*
3 13
  (make-pathname :directory (pathname-directory *load-pathname*)))
4 14
new file mode 100644
... ...
@@ -0,0 +1,8 @@
1
+(in-package :mfa-tool)
2
+
3
+(defun open-url (url)
4
+  (capi:contain (make-instance 'capi:browser-pane
5
+                               :url url)
6
+                :title "Management Console"
7
+                :best-width 1280
8
+                :best-height 800))
0 9
new file mode 100644
... ...
@@ -0,0 +1,17 @@
1
+(in-package :mfa-tool)
2
+
3
+(defmacro with-retry (form &body restart-cases)
4
+  `(loop (restart-case (return ,form)
5
+           (continue ())
6
+           ,@restart-cases)))
7
+
8
+(defmacro with-retry* (bindings &body body)
9
+  `(loop
10
+     (restart-bind (,@bindings)
11
+       ,@(butlast body)
12
+       ,(cons 'return (last body)))))
13
+
14
+(defmacro safely-invoke-restart (name condition &rest args)
15
+  (alexandria:with-gensyms (restart)
16
+    `(alexandria:when-let ((,restart (find-restart ,name ,condition)))
17
+       (invoke-restart ,restart ,@args))))