diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 42a29286b7db861db31593efd6460f0c6d81c83c..032be86b39ba30f97a7cdbd51b6a127b4d7fd808 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,7 +31,7 @@ build_linux: build_macos: stage: build_macos - image: poka/rust-osxcross:1.0.2 + image: poka/rust-osxcross:latest script: # Install the required dependencies - rustup target add x86_64-apple-darwin @@ -41,9 +41,13 @@ build_macos: - rm -rf target/macos - mkdir -p target/macos - cargo bundle --release --target x86_64-apple-darwin - # Zip the gcli.app before moving it + # Add Info.plist and install_gcli.scpt - cd target/x86_64-apple-darwin/release/bundle/osx - - echo -e "Unzip gcli.zip and move the gcli.app folder to /Applications/ folder.\nenjoy" > instructions.txt + - mkdir -p gcli.app/Contents/Resources/Scripts + - cp /opt/Info.plist gcli.app/Contents/Info.plist + - cp /opt/install_gcli.scpt gcli.app/Contents/Resources/Scripts/install_gcli.scpt + - echo -e "Just unzip gcli.app and open it.\nenjoy" > instructions.txt + # Zip the gcli.app before moving it - zip -r gcli.zip gcli.app instructions.txt - mv gcli.zip ../../../../macos/ # target/macos/ artifacts: diff --git a/Dockerfile.ci b/Dockerfile.ci index 0ed562c5fe500452004e7ab60e0fa979b66dade2..900570f3821417bc86fb04c36c83e80020141373 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -44,5 +44,9 @@ ENV CXX="o64-clang++" # Add rust target for macOS RUN rustup target add x86_64-apple-darwin +# Copy scripts +COPY scripts/install_gcli.scpt /opt/install_gcli.scpt +COPY scripts/Info.plist /opt/Info.plist + # Define the entrypoint CMD ["bash"] diff --git a/scripts/Info.plist b/scripts/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..8220ab932043a17cebe04d924508ef5e9d4b744d --- /dev/null +++ b/scripts/Info.plist @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleDisplayName</key> + <string>gcli</string> + <key>CFBundleExecutable</key> + <string>osascript</string> + <key>CFBundleIdentifier</key> + <string>com.axiomteam.gcli</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>gcli</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>0.2.13</string> + <key>CFBundleVersion</key> + <string>20240522.234244</string> + <key>CSResourcesFileMapped</key> + <true/> + <key>LSRequiresCarbon</key> + <true/> + <key>NSHighResolutionCapable</key> + <true/> + <key>NSAppleScriptEnabled</key> + <true/> + <key>CFBundleURLTypes</key> + <array> + <dict> + <key>CFBundleURLName</key> + <string>gcli script</string> + <key>CFBundleURLSchemes</key> + <array> + <string>file</string> + </array> + </dict> + </array> + <key>CFBundleDocumentTypes</key> + <array> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>scpt</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>ScriptEditorAppIcon.icns</string> + <key>CFBundleTypeName</key> + <string>AppleScript</string> + <key>CFBundleTypeRole</key> + <string>Editor</string> + </dict> + </array> + <key>CFBundleExecutable</key> + <string>osascript</string> + <key>CFBundleScriptPath</key> + <string>Contents/Resources/Scripts/install_gcli.scpt</string> +</dict> +</plist> diff --git a/scripts/install_gcli.scpt b/scripts/install_gcli.scpt new file mode 100644 index 0000000000000000000000000000000000000000..8a93d8a92f5e6206b67052e8a676364eec066229 --- /dev/null +++ b/scripts/install_gcli.scpt @@ -0,0 +1,18 @@ +-- Ask user if they want to install gcli +set userResponse to display dialog "Do you want to install gcli to /usr/local/bin?" buttons {"No", "Yes"} default button "Yes" + +if button returned of userResponse is "Yes" then + -- Run shell script to move gcli with administrator privileges + try + do shell script "mv gcli.app/Contents/MacOS/gcli /usr/local/bin" with administrator privileges + display dialog "gcli has been installed to /usr/local/bin and is now available in your PATH." + on error errMsg number errorNumber + if errorNumber is -128 then + display dialog "Installation cancelled." + else + display dialog "An error occurred: " & errMsg + end if + end try +else + display dialog "Installation cancelled." +end if