]> git.r.bdr.sh - rbdr/map/commitdiff
3.0.0 3.0.0
authorRuben Beltran del Rio <redacted>
Mon, 16 Sep 2024 10:10:02 +0000 (12:10 +0200)
committerRuben Beltran del Rio <redacted>
Mon, 16 Sep 2024 10:10:02 +0000 (12:10 +0200)
12 files changed:
.gitignore
Makefile
Map.xcodeproj/project.pbxproj
Map.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
Map/Info.plist
Map/Map.entitlements
Map/MapApp.swift
Map/Presentation/Commands/UpdateCommands.swift [new file with mode: 0644]
Map/Presentation/MapEditor.swift
README.md
export_options.plist [new file with mode: 0644]
scripts/package.sh [new file with mode: 0755]

index 996111eea43f93e418718475dc9bc88da690cccc..7c955e34936e3bae17b70ce96c8898568bde220a 100644 (file)
@@ -25,3 +25,4 @@ DerivedData/
 ## Gcc Patch
 /*.gcno
 .DS_Store
+builds/
index c02a2276e9ec30412e53433737d35a645131f279..8d1a3b165a64d578d9b499b0c91a12a6674450a5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,22 @@
-swift_version = 5.3
+project_name := Map
+derived_data_path := ~/Library/Developer/Xcode/DerivedData
+sparkle_path := $(shell find $(derived_data_path) -type d -path '*artifacts/sparkle/Sparkle' -print -quit)
+build_directory := builds
+sparkle_account := tranquil.systems
+
+distribute: archive package generate_appcast
+
+package:
+       @scripts/package.sh "$(project_name)" "$(build_directory)"
+
+generate_appcast:
+       @$(sparkle_path)/bin/generate_appcast --account $(sparkle_account) $(build_directory)
+
+archive: prepare
+       xcodebuild -project $(project_name).xcodeproj -scheme $(project_name) -configuration Release -archivePath $(build_directory)/$(project_name).xcarchive archive && xcodebuild -exportArchive -archivePath $(build_directory)/$(project_name).xcarchive -exportPath $(build_directory) -exportOptionsPlist export_options.plist
+
+prepare:
+       mkdir -p $(build_directory)
 
 format:
        swift format -i -r .
@@ -6,4 +24,4 @@ format:
 lint:
        swift format lint -r .
 
-.PHONY: format lint docker-build docker-push
+.PHONY: package prepare archive generate_appcast package distribute format lint
index 15ddee9fa9111c33edcced54d68eb457a225e924..f1387469f52ceffe2cbb641e8fa3b4a8319e3f44 100644 (file)
@@ -38,6 +38,8 @@
                B5012E8A2C98235500AC4D68 /* MapCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5012E892C98235300AC4D68 /* MapCommands.swift */; };
                B5012E8C2C98244000AC4D68 /* ViewStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5012E8B2C98243E00AC4D68 /* ViewStyle.swift */; };
                B5012E8E2C9828D000AC4D68 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5012E8D2C9828CE00AC4D68 /* Constants.swift */; };
+               B51A45F52C982FAE00870ED5 /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = B51A45F42C982FAE00870ED5 /* Sparkle */; };
+               B51A45F72C982FEA00870ED5 /* UpdateCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51A45F62C982FE700870ED5 /* UpdateCommands.swift */; };
                B54587102C961E9C0067B788 /* MapApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = B545870F2C961E9C0067B788 /* MapApp.swift */; };
                B54587122C961E9C0067B788 /* MapDocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54587112C961E9C0067B788 /* MapDocument.swift */; };
                B54587142C961E9C0067B788 /* MapEditor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54587132C961E9C0067B788 /* MapEditor.swift */; };
@@ -95,6 +97,7 @@
                B5012E892C98235300AC4D68 /* MapCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapCommands.swift; sourceTree = "<group>"; };
                B5012E8B2C98243E00AC4D68 /* ViewStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewStyle.swift; sourceTree = "<group>"; };
                B5012E8D2C9828CE00AC4D68 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
+               B51A45F62C982FE700870ED5 /* UpdateCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateCommands.swift; sourceTree = "<group>"; };
                B545870C2C961E9C0067B788 /* Map.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Map.app; sourceTree = BUILT_PRODUCTS_DIR; };
                B545870F2C961E9C0067B788 /* MapApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapApp.swift; sourceTree = "<group>"; };
                B54587112C961E9C0067B788 /* MapDocument.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapDocument.swift; sourceTree = "<group>"; };
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               B51A45F52C982FAE00870ED5 /* Sparkle in Frameworks */,
                                B5012E742C9625E200AC4D68 /* Patterns in Frameworks */,
                                B5012E7F2C97315800AC4D68 /* ConcaveHull in Frameworks */,
                        );
                B5012E882C98234F00AC4D68 /* Commands */ = {
                        isa = PBXGroup;
                        children = (
+                               B51A45F62C982FE700870ED5 /* UpdateCommands.swift */,
                                B5012E892C98235300AC4D68 /* MapCommands.swift */,
                        );
                        path = Commands;
                        packageProductDependencies = (
                                B5012E732C9625E200AC4D68 /* Patterns */,
                                B5012E7E2C97315800AC4D68 /* ConcaveHull */,
+                               B51A45F42C982FAE00870ED5 /* Sparkle */,
                        );
                        productName = Map2;
                        productReference = B545870C2C961E9C0067B788 /* Map.app */;
                        packageReferences = (
                                B5012E722C9625E200AC4D68 /* XCRemoteSwiftPackageReference "patterns" */,
                                B5012E7D2C97315800AC4D68 /* XCRemoteSwiftPackageReference "ConcaveHull" */,
+                               B51A45F32C982FAE00870ED5 /* XCRemoteSwiftPackageReference "Sparkle" */,
                        );
                        productRefGroup = B545870D2C961E9C0067B788 /* Products */;
                        projectDirPath = "";
                                B54587142C961E9C0067B788 /* MapEditor.swift in Sources */,
                                B5012E3F2C96232A00AC4D68 /* EvolutionPicker.swift in Sources */,
                                B5012E572C96249400AC4D68 /* NoteParserStrategy.swift in Sources */,
+                               B51A45F72C982FEA00870ED5 /* UpdateCommands.swift in Sources */,
                                B5012E582C96249400AC4D68 /* BlockerParserStrategy.swift in Sources */,
                                B5012E592C96249400AC4D68 /* VertexParserStrategy.swift in Sources */,
                                B5012E5A2C96249400AC4D68 /* MapParser.swift in Sources */,
                                kind = branch;
                        };
                };
+               B51A45F32C982FAE00870ED5 /* XCRemoteSwiftPackageReference "Sparkle" */ = {
+                       isa = XCRemoteSwiftPackageReference;
+                       repositoryURL = "https://github.com/sparkle-project/Sparkle";
+                       requirement = {
+                               kind = upToNextMajorVersion;
+                               minimumVersion = 2.6.4;
+                       };
+               };
 /* End XCRemoteSwiftPackageReference section */
 
 /* Begin XCSwiftPackageProductDependency section */
                        package = B5012E7D2C97315800AC4D68 /* XCRemoteSwiftPackageReference "ConcaveHull" */;
                        productName = ConcaveHull;
                };
+               B51A45F42C982FAE00870ED5 /* Sparkle */ = {
+                       isa = XCSwiftPackageProductDependency;
+                       package = B51A45F32C982FAE00870ED5 /* XCRemoteSwiftPackageReference "Sparkle" */;
+                       productName = Sparkle;
+               };
 /* End XCSwiftPackageProductDependency section */
        };
        rootObject = B54587042C961E9C0067B788 /* Project object */;
index 887d9eee0f754e9e6ec9ae4e6a046c768d0d1daf..8e294b8e527f7183b38ae8d45e91ab6087e460c2 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "originHash" : "02d7b701c0ab6f32b55ad490056b5cb87cdec5003f477a828ca9a07b09a2d7b3",
+  "originHash" : "761de39b705b9793661607e3e8ffa75397e9772bccc8dc4c303ed42c76e874de",
   "pins" : [
     {
       "identity" : "concavehull",
         "revision" : "ba4ee0edf2aba19ad73fa53cb01dd0fb9b527526",
         "version" : "2.0.0"
       }
+    },
+    {
+      "identity" : "sparkle",
+      "kind" : "remoteSourceControl",
+      "location" : "https://github.com/sparkle-project/Sparkle",
+      "state" : {
+        "revision" : "0ef1ee0220239b3776f433314515fd849025673f",
+        "version" : "2.6.4"
+      }
     }
   ],
   "version" : 3
index 61150cf6e956228449194f844856e1a6931931c6..e86242388d54b013053373593ee66af1190d3e9d 100644 (file)
@@ -2,6 +2,12 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
+       <key>SUEnableInstallerLauncherService</key>
+       <true/>
+       <key>SUPublicEDKey</key>
+       <string>lacD9VFVjJO55y+hEy+ReU4S0xbrnbdhncui1qLsmfI=</string>
+       <key>SUFeedURL</key>
+       <string>https://map.tranquil.systems/appcast.xml</string>
        <key>CFBundleDocumentTypes</key>
        <array>
                <dict>
@@ -25,7 +31,7 @@
                                <string>public.plain-text</string>
                        </array>
                        <key>UTTypeDescription</key>
-                       <string>Wardley Map written in Map's wmap syntax</string>
+                       <string>Wardley Map written in Map&apos;s wmap syntax</string>
                        <key>UTTypeIcons</key>
                        <dict/>
                        <key>UTTypeIdentifier</key>
index 6d968edb4f8cd6ec865ba1cc4f804c71ef522b3e..d363e1c5ac38f7afb445e3a1818d26c8612698f7 100644 (file)
@@ -2,9 +2,16 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
-    <key>com.apple.security.app-sandbox</key>
-    <true/>
-    <key>com.apple.security.files.user-selected.read-write</key>
-    <true/>
+       <key>com.apple.security.app-sandbox</key>
+       <true/>
+       <key>com.apple.security.files.user-selected.read-write</key>
+       <true/>
+       <key>com.apple.security.network.client</key>
+       <true/>
+       <key>com.apple.security.temporary-exception.mach-lookup.global-name</key>
+       <array>
+               <string>$(PRODUCT_BUNDLE_IDENTIFIER)-spks</string>
+               <string>$(PRODUCT_BUNDLE_IDENTIFIER)-spki</string>
+       </array>
 </dict>
 </plist>
index 9aff010b2021f042f3d7579faac0a6c7b975b616..ef1b119310980049d35b220131c9063a817d471d 100644 (file)
@@ -1,12 +1,17 @@
 import SwiftUI
+import Sparkle
 
 @main
 struct MapApp: App {
+  
+  private let updaterController: SPUStandardUpdaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil)
+  
   var body: some Scene {
     DocumentGroup(newDocument: MapDocument()) { file in
       MapEditor(document: file.$document, url: file.fileURL)
     }.commands {
       MapCommands()
+      UpdateCommands(updaterController: updaterController)
     }
   }
 }
diff --git a/Map/Presentation/Commands/UpdateCommands.swift b/Map/Presentation/Commands/UpdateCommands.swift
new file mode 100644 (file)
index 0000000..44a4610
--- /dev/null
@@ -0,0 +1,39 @@
+import SwiftUI
+import Sparkle
+
+struct UpdateCommands: Commands {
+  let updaterController: SPUStandardUpdaterController
+  
+  var body: some Commands {
+    CommandGroup(after: .appInfo) {
+      CheckForUpdatesView(updater: updaterController.updater)
+    }
+  }
+}
+
+
+struct CheckForUpdatesView: View {
+    @ObservedObject private var checkForUpdatesViewModel: CheckForUpdatesViewModel
+    private let updater: SPUUpdater
+    
+    init(updater: SPUUpdater) {
+        self.updater = updater
+        
+        // Create our view model for our CheckForUpdatesView
+        self.checkForUpdatesViewModel = CheckForUpdatesViewModel(updater: updater)
+    }
+    
+    var body: some View {
+        Button("Check for Updates…", action: updater.checkForUpdates)
+            .disabled(!checkForUpdatesViewModel.canCheckForUpdates)
+    }
+}
+
+final class CheckForUpdatesViewModel: ObservableObject {
+    @Published var canCheckForUpdates = false
+
+    init(updater: SPUUpdater) {
+        updater.publisher(for: \.canCheckForUpdates)
+            .assign(to: &$canCheckForUpdates)
+    }
+}
index bf33f750849df870ff559b0f80c2e91ba3daffc8..f9415d32662675ec9c3fcaa9eb8eacb54ea5eab7 100644 (file)
@@ -97,7 +97,6 @@ struct MapEditor: View {
   }
 
   private func onDragVertex(vertex: Vertex, x: CGFloat, y: CGFloat) {
-    print("Dragging: \(vertex), \(x), \(y)")
   }
 
   private func saveImage() {
index 888781a277e0d941acb608a0ed0af6e6b214f564..d8713cbf0cb6f637356055da911a1da53d7aaa44 100644 (file)
--- a/README.md
+++ b/README.md
@@ -71,9 +71,10 @@ You can group nodes together by using `[Group] NodeA NodeB...`. eg.
 
 ### Notes
 
-You can add notes by using `[Note] (x,y) Text`. eg.
+You can add notes `[Note] (x, y) Text` where x and y are numbers, and Text is
+any text with spaces or `\n`.
 
-- `[Note] (10, 20.1) This is a note, it will wrap itself`
-- `[Note] (10, 20.1) This is a note,\nwith a forced wrap`
+- `[Note] (30, 45) Here we want to call out an explanation or context.`
+- `[Note] (90, 25) We're close to the edge \n so we can multiline it.`
 
 [swift-format]: https://github.com/apple/swift-format.git
diff --git a/export_options.plist b/export_options.plist
new file mode 100644 (file)
index 0000000..bb805c5
--- /dev/null
@@ -0,0 +1,10 @@
+<?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>method</key>
+    <string>developer-id</string>
+    <key>signingStyle</key>
+    <string>automatic</string>
+</dict>
+</plist>
diff --git a/scripts/package.sh b/scripts/package.sh
new file mode 100755 (executable)
index 0000000..477693a
--- /dev/null
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+set -e
+
+
+if [ "$#" -ne 2 ]; then
+       echo "Usage: $0 <project_name> <build_directory>"
+       exit 1
+fi
+
+project_name="$1"
+build_directory="$2"
+
+app_path="${build_directory}/${project_name}.app"
+app_version=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" ${app_path}/Contents/Info.plist)
+tmp_dir=$(mktemp -d)
+dmg_path="${build_directory}/${project_name}-${app_version}.dmg"
+cp -R "${app_path}" "${tmp_dir}"
+ln -s /Applications "${tmp_dir}/Applications"
+hdiutil create -volname "${project_name}" -srcfolder "${tmp_dir}" -ov -format UDZO "${dmg_path}"
+rm -rf "${tmp_dir}"