A package manager that installs and runs Swift command line tool packages.
$ mint run realm/[email protected] swiftlint
This would install and run SwiftLint version 0.22.0
Mint is designed to be used with Swift command line tools that build with the Swift Package Manager. It makes installing, running and distributing these tools much easier.
Homebrew is a popular method of distributing Swift executables, but that requires creating a formula and then maintaining that formula. Running specific versions of homebrew installations can also be tricky as only one global version is installed at any one time. Mint installs your package via SPM and lets you run multiple versions of that package, which are globally installed and cached on demand.
If your Swift executable package builds with SPM, then it can be run with Mint! See Support for details.
Swift Packager Manager Tools -> SPMT -> Spearmint -> Mint! 🌱😄
Mint: a place where something is produced or manufactured
Make sure Xcode 9.2 is installed first.
$ brew install mint
$ git clone https://github.com/yonaskolb/Mint.git
$ cd Mint
$ make
$ git clone https://github.com/yonaskolb/Mint.git
$ cd Mint
$ swift run mint install yonaskolb/mint
$ mint install yonaskolb/mint
Use CLI
$ git clone https://github.com/yonaskolb/Mint.git
$ cd Mint
$ swift run mint
Use as dependency
Add the following to your Package.swift file's dependencies:
.package(url: "https://github.com/yonaskolb/Mint.git", from: "0.1.0"),
And then import wherever needed: import MintKit
Run mint --help
to see usage instructions.
run
later, and also links that version globallyRun, install and update commands have 1 or 2 arguments:
install realm/SwiftLint
or a fully qualified git path install https://github.com/realm/SwiftLint.git
. In the case of run
you can also just pass the name of the repo if it is already installed run swiftlint
. This will do a lookup of all installed packages. An optional version can be specified by appending @version
, otherwise the newest tag or master will be used. Note that if you don't specify a version, the current tags must be loaded remotely each time.realm/swiftlint
it will be swiftlint
). In the case of run
you can also pass any arguments to the command eg mint run realm/swiftlint swiftlint --path source
$ mint run yonaskolb/[email protected] xcodegen --spec spec.yml # pass some arguments
$ mint install yonaskolb/[email protected] --prevent-global # installs a certain version but not globally
$ mint install yonaskolb/XcodeGen # install newest tag
$ mint run yonaskolb/[email protected] # run 1.2.4
$ mint run XcodeGen # use newest tag and find XcodeGen in installed packages
By default Mint symlinks your installs into usr/local/bin
when install
or update
are used, unless --prevent-global
is passed. This means a package will be accessible from anywhere, and you don't have to prepend commands with mint run
. Note that only one global version can be installed at a time though. If you need to run a specific older version use mint run
.
A Mintfile
can specify a list of versioned packages. It makes installing and running these packages easy, as the specific repos and versions are centralized.
Simply place this file in the directory you're running Mint in. The format of the Mintfile
is simply a list of packages in the same form as the usual package parameter:
yonaskolb/[email protected]
yonaskolb/[email protected]
Then you can simply run a package with:
mint run xcodegen
Or install all the packages in one go with:
mint bootstrap
--silent
in mint run
to silence any output from mint itself. Useful if forwarding output somewhere else.MINT_PATH
and MINT_INSTALL_PATH
envs to configure where mint caches builds, and where it symlinks global installs. These default to /usr/local/lib/mint
and /usr/local/bin
respectivelyMint works on Linux but has some limitations:
Mintfile
currently has no support for specifying the executable some packages may not work.If your Swift command line tool builds with the Swift Package Manager than it will automatically install and run with mint! You can add this to the Installing
section in your readme:
### [Mint](https://github.com/yonaskolb/mint)
```
$ mint install github_name/repo_name
```
If your executable name is different from your repo name then you will need to append the name to the above command.
The Swift Package Manager doesn't yet have a way of specifying resources directories. If your tool requires access to resources from the repo you require a custom Package.resources
file. This is a plain text file that lists the resources directories on different lines:
MyFiles
MyOtherFiles
If this file is found in you repo, then all those directories will be copied into the same path as the executable.
Feel free to add your own!
link |
Stars: 0 |
Last commit: 5 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics