Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Change install path #216

Merged
merged 1 commit into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ $ mint run XcodeGen # use newest tag and find XcodeGen in installed packages
```

### Linking
By default Mint symlinks your installs into `usr/local/bin` on `mint install`, unless `--no-link` is passed. This means a package will be accessible from anywhere, and you don't have to prepend commands with `mint run package`. Note that only one linked version can be used at a time though. If you need to run a specific older version use `mint run`.
By default Mint symlinks your installs into `~/.mint/bin` on `mint install`, unless `--no-link` is passed. This means a package will be accessible from anywhere, and you don't have to prepend commands with `mint run package`, as long as you add `~/.mint/bin` to your `$PATH`. Note that only one linked version can be used at a time. If you need to run a specific older version use `mint run`.

### Mintfile
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.
Expand Down Expand Up @@ -146,7 +146,7 @@ mint bootstrap --link

### Advanced
- You can use `--silent` in `mint run` to silence any output from mint itself. Useful if forwarding output somewhere else.
- You can set `MINT_PATH` and `MINT_LINK_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` respectively
- You can set `MINT_PATH` and `MINT_LINK_PATH` envs to configure where mint caches builds, and where it symlinks global installs. These default to `~/.mint` and `~/.mint/bin` respectively
- You can use `mint install --force` to reinstall a package even if it's already installed. This shouldn't be required unless you are pointing at a branch and want to update it.

### Linux
Expand Down
4 changes: 2 additions & 2 deletions Sources/MintCLI/MintCLI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public class MintCLI {

public init() {

var mintPath: Path = "/usr/local/lib/mint"
var linkPath: Path = "/usr/local/bin"
var mintPath: Path = "~/.mint"
var linkPath: Path = "~/.mint/bin"

if let path = ProcessInfo.processInfo.environment["MINT_PATH"], !path.isEmpty {
mintPath = Path(path)
Expand Down
8 changes: 8 additions & 0 deletions Sources/MintKit/Mint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ public class Mint {
try linkPackage(package, executable: executable, overwrite: overwrite)
}
}
checkLinkPath()
}
return false
}
Expand Down Expand Up @@ -394,10 +395,17 @@ public class Mint {
try linkPackage(package, executable: executable, overwrite: overwrite)
}
}
checkLinkPath()
}

return true
}

private func checkLinkPath() {
if let path = ProcessInfo.processInfo.environment["PATH"], !path.contains(linkPath.string) {
output("\(linkPath) must be added to your $PATH if you wish to run this package outside of mint".yellow)
}
}

private func runPackageCommand(name: String, command: String, directory: Path, stdOutOnError: Bool = false, error mintError: MintError) throws {
output(name)
Expand Down