diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000000000..c308ed0c0
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,13 @@
+# http://editorconfig.org
+root = true
+
+[*]
+indent_style = space
+indent_size = 4
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.md]
+trim_trailing_whitespace = false
diff --git a/App/mas-cli-Info.plist b/App/mas-cli-Info.plist
index 6a348b273..3b1ef73b3 100644
--- a/App/mas-cli-Info.plist
+++ b/App/mas-cli-Info.plist
@@ -11,6 +11,6 @@
CFBundleName
mas-cli
CFBundleShortVersionString
- 1.4.2
+ 1.4.3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a6bb713c9..689ac3221 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,11 +7,24 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
+
+
+## [v1.4.3] đĻđī¸ MasKit & Carthage - 2018-10-17
+
+Big project restructure to fix issues building for Homebrew.
+The `mas` binary now depends on the separate `MasKit.framework`.
+Use the `mas.pkg` package to install manually.
+
- 𧰠MasKit Framework #175
+- đĻ Added installer package #178
- đ Xcode 10 & Swift 4.2 #173
-- âģī¸ Use Carthage rather than CocoaPods to manage dependencies #169
+- âģī¸ Use Carthage rather than CocoaPods to manage dependencies #169
+ thanks @tonyarnold!
+- âŦī¸ danger (5.7.0) #176
+
+## [v1.4.2] đđĨđ
đģââī¸ Sign-In Disabled - 2018-08-12
-## [v1.4.2] - Sign-In Disabled - 2018-08-12
+> Version 1.4.2 was never [released](https://github.com/Homebrew/homebrew-core/pull/31058) through Homebrew.
- đđĨđ
đģââī¸ Disabled `signin` command on macOS 10.13+ #162
- An error is immediately returned instead of crashing on newer macOS versions.
@@ -27,11 +40,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- đ Xcode 9.3 #141
- đˇđģââī¸â ī¸ Re-enabled Danger #137
-## [v1.4.1] Stop Littering - 2018-02-18
+## [v1.4.1] đ¯ Stop Littering - 2018-02-18
- đ Prevent `default.profraw` from getting created #135
-## [v1.4.0] It's Alive! đ§ââī¸ - 2018-02-16
+## [v1.4.0] đ§ââī¸ It's Alive! - 2018-02-16
### ⨠Enhancements
- âšī¸ Info command #26, #55
@@ -109,7 +122,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [v1.0.0] - 2015-09-20
- Initial Release
-[Unreleased]: https://github.com/mas-cli/mas/compare/v1.4.2...HEAD
+[Unreleased]: https://github.com/mas-cli/mas/compare/v1.4.3...HEAD
+[v1.4.3]: https://github.com/mas-cli/mas/compare/v1.4.2...v1.4.3
[v1.4.2]: https://github.com/mas-cli/mas/compare/v1.4.1...v1.4.2
[v1.4.1]: https://github.com/mas-cli/mas/compare/v1.4.0...v1.4.1
[v1.4.0]: https://github.com/mas-cli/mas/compare/v1.3.1...v1.4.0
diff --git a/Gemfile.lock b/Gemfile.lock
index 0a42bfa71..b101e0fb9 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -11,7 +11,7 @@ GEM
colored2 (3.1.2)
cork (0.3.0)
colored2 (~> 3.1)
- danger (5.6.5)
+ danger (5.7.0)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
@@ -23,7 +23,7 @@ GEM
no_proxy_fix
octokit (~> 4.7)
terminal-table (~> 1)
- faraday (0.15.2)
+ faraday (0.15.3)
multipart-post (>= 1.2, < 3)
faraday-http-cache (1.3.1)
faraday (~> 0.8)
@@ -32,7 +32,7 @@ GEM
multipart-post (2.0.0)
nap (1.1.0)
no_proxy_fix (0.1.2)
- octokit (4.11.0)
+ octokit (4.13.0)
sawyer (~> 0.8.0, >= 0.5.3)
open4 (1.3.4)
public_suffix (3.0.3)
@@ -54,4 +54,4 @@ DEPENDENCIES
xcpretty
BUNDLED WITH
- 1.16.4
+ 1.16.6
diff --git a/Homebrew/Components.plist b/Homebrew/Components.plist
new file mode 100644
index 000000000..e2798c207
--- /dev/null
+++ b/Homebrew/Components.plist
@@ -0,0 +1,29 @@
+
+
+
+
+
+ BundleIsVersionChecked
+
+ BundleOverwriteAction
+ upgrade
+ ChildBundles
+
+
+ BundleOverwriteAction
+
+ RootRelativeBundlePath
+ Frameworks/MasKit.framework/Versions/A/Frameworks/Commandant.framework
+
+
+ BundleOverwriteAction
+
+ RootRelativeBundlePath
+ Frameworks/MasKit.framework/Versions/A/Frameworks/Result.framework
+
+
+ RootRelativeBundlePath
+ Frameworks/MasKit.framework
+
+
+
diff --git a/Homebrew/Distribution.plist b/Homebrew/Distribution.plist
new file mode 100644
index 000000000..2451c93b9
--- /dev/null
+++ b/Homebrew/Distribution.plist
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ mas_temp.pkg
+
diff --git a/Homebrew/mas.rb b/Homebrew/mas.rb
index 37b578be7..976f9febe 100644
--- a/Homebrew/mas.rb
+++ b/Homebrew/mas.rb
@@ -2,8 +2,9 @@ class Mas < Formula
desc "Mac App Store command-line interface"
homepage "https://github.com/mas-cli/mas"
url "https://github.com/mas-cli/mas.git",
- :tag => "v1.4.2",
- :revision => "966872b32820c014a9004691f5da47f170702236",
+ :branch => "release-1.4.3",
+ # :tag => "v1.4.2",
+ # :revision => "966872b32820c014a9004691f5da47f170702236",
:shallow => true
head "https://github.com/mas-cli/mas.git", :shallow => true
@@ -14,15 +15,23 @@ class Mas < Formula
end
depends_on :xcode => ["10.0", :build]
+ depends_on "carthage" => :build
def install
+ # Prevent build failures from warnings
+ xcconfig = buildpath/"Overrides.xcconfig"
+ File.open(xcconfig, 'w') { |file| file.write("GCC_TREAT_WARNINGS_AS_ERRORS = NO") }
+ ENV["XCODE_XCCONFIG_FILE"] = xcconfig
- xcodebuild "-workspace", "mas-cli.xcworkspace",
+ system "carthage", "bootstrap", "--platform", "macOS"
+
+ xcodebuild "-project", "mas-cli.xcodeproj",
"-scheme", "mas-cli Release",
+ "-configuration",đ ī¸ "Release",
+ "OBJROOT=#{buildpath.realpath}",
"SYMROOT=#{buildpath.realpath}"
- bin.install buildpath/"build/mas"
- # TODO: Move MasKit.frameworks to prefix/Frameworks
+ system "script/install", prefix
bash_completion.install "contrib/completion/mas-completion.bash" => "mas"
end
diff --git a/MasKit/Info.plist b/MasKit/Info.plist
index 7d8659fb5..5151ef381 100644
--- a/MasKit/Info.plist
+++ b/MasKit/Info.plist
@@ -15,9 +15,9 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 1.0
+ 1.4.3
CFBundleVersion
- $(CURRENT_PROJECT_VERSION)
+ 10403000
NSHumanReadableCopyright
Copyright Š 2018 Andrew Naylor. All rights reserved.
diff --git a/MasKitTests/Info.plist b/MasKitTests/Info.plist
index 6c40a6cd0..a7b93cd82 100644
--- a/MasKitTests/Info.plist
+++ b/MasKitTests/Info.plist
@@ -15,8 +15,8 @@
CFBundlePackageType
BNDL
CFBundleShortVersionString
- 1.0
+ 1.4.3
CFBundleVersion
- 1
+ 10403000
diff --git a/mas-cli.xcodeproj/project.pbxproj b/mas-cli.xcodeproj/project.pbxproj
index 035f1d661..6d240b2de 100644
--- a/mas-cli.xcodeproj/project.pbxproj
+++ b/mas-cli.xcodeproj/project.pbxproj
@@ -7,7 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
- 90CB4071213F4E000044E445 /* Commandant.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 90CB406B213F4DDD0044E445 /* Commandant.framework */; };
ED031A7C1B5127C00097692E /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED031A7B1B5127C00097692E /* main.swift */; };
F83213892173D3E1008BA8A0 /* CKAccountStore.h in Headers */ = {isa = PBXBuildFile; fileRef = F8FB719B20F2EC4500F56FDC /* CKAccountStore.h */; };
F832138A2173D3E1008BA8A0 /* CKDownloadQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = F8FB719C20F2EC4500F56FDC /* CKDownloadQueue.h */; };
@@ -39,7 +38,6 @@
F83213A82173F5A7008BA8A0 /* MasKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8FB715220F2B41400F56FDC /* MasKit.framework */; };
F83213A92173F5D0008BA8A0 /* Commandant.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 90CB406B213F4DDD0044E445 /* Commandant.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
F83213AA2173F5D0008BA8A0 /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 90CB4069213F4DDD0044E445 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
- F83213AB2173F697008BA8A0 /* MasKit.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F8FB715220F2B41400F56FDC /* MasKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
F8FB715B20F2B41400F56FDC /* MasKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8FB715220F2B41400F56FDC /* MasKit.framework */; };
F8FB716020F2B41400F56FDC /* MasKitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8FB715F20F2B41400F56FDC /* MasKitTests.swift */; };
F8FB716220F2B41400F56FDC /* MasKit.h in Headers */ = {isa = PBXBuildFile; fileRef = F8FB715420F2B41400F56FDC /* MasKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -97,17 +95,6 @@
name = "Copy Debugging Symbols";
runOnlyForDeploymentPostprocessing = 0;
};
- 90CB407E213F4E8A0044E445 /* Copy Frameworks */ = {
- isa = PBXCopyFilesBuildPhase;
- buildActionMask = 2147483647;
- dstPath = "";
- dstSubfolderSpec = 10;
- files = (
- F83213AB2173F697008BA8A0 /* MasKit.framework in Copy Frameworks */,
- );
- name = "Copy Frameworks";
- runOnlyForDeploymentPostprocessing = 0;
- };
ED031A761B5127C00097692E /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
@@ -210,7 +197,6 @@
buildActionMask = 2147483647;
files = (
F83213A82173F5A7008BA8A0 /* MasKit.framework in Frameworks */,
- 90CB4071213F4E000044E445 /* Commandant.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -456,7 +442,6 @@
90CB4073213F4E070044E445 /* Copy Debugging Symbols */,
ED031A741B5127C00097692E /* Sources */,
ED031A751B5127C00097692E /* Frameworks */,
- 90CB407E213F4E8A0044E445 /* Copy Frameworks */,
ED031A761B5127C00097692E /* CopyFiles */,
E7460A391382D898934EFFBD /* Resources */,
);
@@ -666,7 +651,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CREATE_INFOPLIST_SECTION_IN_BINARY = YES;
- CURRENT_PROJECT_VERSION = 10402000;
+ CURRENT_PROJECT_VERSION = 10403000;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@@ -732,7 +717,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CREATE_INFOPLIST_SECTION_IN_BINARY = YES;
- CURRENT_PROJECT_VERSION = 10402000;
+ CURRENT_PROJECT_VERSION = 10403000;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -771,9 +756,12 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
- LD_RUNPATH_SEARCH_PATHS = "@executable_path/. @executable_path/MasKit.framework/Versions/Current/Frameworks /Library/Frameworks /Library/Frameworks/MasKit.framework/Versions/Current/Frameworks $(inherited)";
+ INSTALL_PATH = /bin;
+ LD_RUNPATH_SEARCH_PATHS = "@executable_path/. @executable_path/MasKit.framework/Versions/Current/Frameworks /usr/local/Frameworks /usr/local/Frameworks/MasKit.framework/Versions/Current/Frameworks $(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "com.mphys.mas-cli";
PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_FORCE_DYNAMIC_LINK_STDLIB = YES;
+ SWIFT_FORCE_STATIC_LINK_STDLIB = NO;
SWIFT_OBJC_BRIDGING_HEADER = "App/mas-cli-Bridging-Header.h";
SWIFT_VERSION = 4.2;
};
@@ -785,15 +773,16 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO;
COPY_PHASE_STRIP = NO;
DEPLOYMENT_LOCATION = YES;
- DSTROOT = "$(SRCROOT)";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
- INSTALL_PATH = /build;
- LD_RUNPATH_SEARCH_PATHS = "@executable_path/. @executable_path/MasKit.framework/Versions/Current/Frameworks /Library/Frameworks /Library/Frameworks/MasKit.framework/Versions/Current/Frameworks $(inherited)";
+ INSTALL_PATH = /bin;
+ LD_RUNPATH_SEARCH_PATHS = "@executable_path/. @executable_path/MasKit.framework/Versions/Current/Frameworks /usr/local/Frameworks /usr/local/Frameworks/MasKit.framework/Versions/Current/Frameworks $(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "com.mphys.mas-cli";
PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_FORCE_DYNAMIC_LINK_STDLIB = YES;
+ SWIFT_FORCE_STATIC_LINK_STDLIB = NO;
SWIFT_OBJC_BRIDGING_HEADER = "App/mas-cli-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
@@ -803,6 +792,7 @@
F8FB716320F2B41400F56FDC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
@@ -813,10 +803,10 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 1;
+ CURRENT_PROJECT_VERSION = 10403000;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 10403000;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -825,13 +815,11 @@
FRAMEWORK_VERSION = A;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = MasKit/Info.plist;
- INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = at.phatbl.MasKit;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
- SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_INCLUDE_PATHS = "$(inherited) $(SRCROOT)/PrivateFrameworks/CommerceKit $(SRCROOT)/PrivateFrameworks/StoreFoundation";
SWIFT_VERSION = 4.2;
@@ -842,6 +830,7 @@
F8FB716420F2B41400F56FDC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
@@ -852,10 +841,10 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 1;
+ CURRENT_PROJECT_VERSION = 10403000;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 10403000;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -864,12 +853,11 @@
FRAMEWORK_VERSION = A;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = MasKit/Info.plist;
- INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+ INSTALL_PATH = /Frameworks;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = at.phatbl.MasKit;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
- SKIP_INSTALL = YES;
SWIFT_INCLUDE_PATHS = "$(inherited) $(SRCROOT)/PrivateFrameworks/CommerceKit $(SRCROOT)/PrivateFrameworks/StoreFoundation";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
diff --git a/script/archive b/script/archive
new file mode 100755
index 000000000..ded3614af
--- /dev/null
+++ b/script/archive
@@ -0,0 +1,20 @@
+#!/bin/bash -ex
+
+pushd build
+
+echo "==> đī¸ Compressing mas.xcarchive"
+zip -r mas.xcarchive.zip mas.xcarchive
+
+echo "==> ī¸đī¸ Compressing binary and framework"
+pushd mas.xcarchive/Products
+zip -r \
+ mas-cli.zip \
+ bin/mas \
+ Frameworks/MasKit.framework
+mv mas-cli.zip ../../
+popd
+
+echo "==> đĸ Files Hashes"
+shasum -a 256 mas-cli.zip mas.xcarchive.zip
+
+popd
diff --git a/script/build b/script/build
index 4d718ca0c..acd9cdfaf 100755
--- a/script/build
+++ b/script/build
@@ -14,12 +14,6 @@ main() {
--configuration "$CONFIG"
archive
-
- # If this is a tagged build we are going to release
-# TEMP: Generate archive on all builds
-# if [[ ! -z $TRAVIS_TAG ]]; then
- # archive
-# fi
}
# OBJROOT - Intermediate Build Files Path
diff --git a/script/clean b/script/clean
index b4d67ae19..e532fb61b 100755
--- a/script/clean
+++ b/script/clean
@@ -1,9 +1,11 @@
#!/bin/bash -e
BUILD_DIR=build
+INSTALL_DIR=/tmp/mas-cli.dst
main() {
- rm -rf $BUILD_DIR/
+ rm -rf ${BUILD_DIR:?}
+ rm -rf ${INSTALL_DIR:?}
}
main
diff --git a/script/install b/script/install
new file mode 100755
index 000000000..91a32b246
--- /dev/null
+++ b/script/install
@@ -0,0 +1,37 @@
+#!/bin/bash -e
+
+PREFIX=/usr/local
+INSTALL_TEMPORARY_FOLDER=/tmp/mas-cli.dst
+FRAMEWORK_NAME=MasKit.framework
+BINARY_NAME=mas
+
+# Override default prefix path with optional 1st arg
+if test -n "$1"; then
+ PREFIX="$1"
+fi
+
+echo "==> đ˛ Installing mas to $PREFIX"
+
+xcodebuild install
+
+ditto -v \
+ "$INSTALL_TEMPORARY_FOLDER/Frameworks" \
+ "$PREFIX/Frameworks"
+
+ditto -v \
+ "$INSTALL_TEMPORARY_FOLDER/bin" \
+ "$PREFIX/bin"
+
+echo "==> đ Update dylib load paths"
+
+install_name_tool \
+ -rpath \
+ "/usr/local/Frameworks" \
+ "@executable_path/../Frameworks" \
+ "$PREFIX/bin/$BINARY_NAME"
+
+install_name_tool \
+ -rpath \
+ "/usr/local/Frameworks/$FRAMEWORK_NAME/Versions/Current/Frameworks" \
+ "@executable_path/../Frameworks/$FRAMEWORK_NAME/Versions/Current/Frameworks" \
+ "$PREFIX/bin/$BINARY_NAME"
diff --git a/script/package b/script/package
index d09a46524..6881f8ab8 100755
--- a/script/package
+++ b/script/package
@@ -1,17 +1,35 @@
-#!/bin/bash -e
+#!/bin/bash -ex
-pushd build
+# TODO: Make VERSION_STRING dynamic
+VERSION_STRING=1.4.3
-echo "==> đī¸ Compressing mas.xcarchive"
-zip -r mas.xcarchive.zip mas.xcarchive
+xcodebuild install
-echo "==> ī¸đī¸ Compressing binary and framework"
-pushd mas.xcarchive/Products/build
-zip -r mas-cli.zip mas MasKit.framework
-mv mas-cli.zip ../../../
-popd
+echo "==> đĻ Assemble an installer package"
+IDENTIFIER=com.mphys.mas-cli
+COMPONENTS_PLIST=Homebrew/Components.plist
+DISTRIBUTION_PLIST=Homebrew/Distribution.plist
+INSTALL_TEMPORARY_FOLDER=/tmp/mas-cli.dst
+INTERNAL_PACKAGE=mas_temp.pkg
+OUTPUT_PACKAGE=mas.pkg
-echo -n "==> đĸ SHA256: "
-shasum -a 256 mas-cli.zip
+# Assemble pkg. Using /usr/local prefix to avoid the following errors with "/"
+# - installer: The install failed (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.)
+# - GUI warning: This package is incompatible with this version of macOS and may fail to install. (may damage your system... )
+pkgbuild \
+ --component-plist "$COMPONENTS_PLIST" \
+ --identifier "$IDENTIFIER" \
+ --install-location "/usr/local" \
+ --root "$INSTALL_TEMPORARY_FOLDER" \
+ --version "$VERSION_STRING" \
+ "$INTERNAL_PACKAGE"
-popd
+# Build 2nd pkg from 1st. Not sure why, but this is how Carthage does it.
+# https://github.com/Carthage/Carthage/blob/master/Makefile#L87
+productbuild \
+ --distribution "$DISTRIBUTION_PLIST" \
+ --package-path "$INTERNAL_PACKAGE" \
+ "$OUTPUT_PACKAGE"
+
+echo "==> đĸ Files Hashes"
+shasum -a 256 mas.pkg
diff --git a/script/package_install b/script/package_install
new file mode 100755
index 000000000..c92c5bc1d
--- /dev/null
+++ b/script/package_install
@@ -0,0 +1,13 @@
+#!/bin/bash -ex
+
+IDENTIFIER=com.mphys.mas-cli
+
+echo "==> đ˛ Installing mas"
+
+sudo installer \
+ -pkg build/mas.pkg \
+ -target /
+
+pkgutil --pkg-info "$IDENTIFIER"
+
+pkgutil --files "$IDENTIFIER"
diff --git a/script/uninstall b/script/uninstall
new file mode 100755
index 000000000..8e23dd0aa
--- /dev/null
+++ b/script/uninstall
@@ -0,0 +1,8 @@
+#!/bin/bash -e
+
+PREFIX=/usr/local
+
+echo "==> đĨ Installing mas"
+
+rm -rf /usr/local/Frameworks/MasKit.framework
+rm -f /usr/local/bin/mas