Skip to content

Commit

Permalink
fix: set binpath
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Apr 20, 2018
1 parent b0fa66a commit 371bc32
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"@heroku-cli/color": "^1.1.3",
"@oclif/command": "^1.4.13",
"@oclif/config": "^1.6.4",
"@oclif/config": "^1.6.6",
"@oclif/errors": "^1.0.4",
"@types/semver": "^5.5.0",
"cli-ux": "^3.3.31",
Expand All @@ -25,14 +25,14 @@
"@oclif/plugin-help": "^1.2.4",
"@oclif/test": "^1.0.5",
"@oclif/tslint": "^1.1.0",
"@types/chai": "^4.1.2",
"@types/chai": "^4.1.3",
"@types/cross-spawn": "^6.0.0",
"@types/execa": "^0.9.0",
"@types/fs-extra": "^5.0.2",
"@types/glob": "^5.0.35",
"@types/lodash": "^4.14.107",
"@types/mocha": "^5.1.0",
"@types/node": "^9.6.5",
"@types/mocha": "^5.2.0",
"@types/node": "^9.6.6",
"@types/supports-color": "^5.3.0",
"@types/write-json-file": "^2.2.1",
"chai": "^4.1.2",
Expand All @@ -42,7 +42,7 @@
"ts-node": "6.0.0",
"tslib": "^1.9.0",
"tslint": "^5.9.1",
"typescript": "^2.8.1"
"typescript": "^2.8.3"
},
"engines": {
"node": ">=8.0.0"
Expand Down
11 changes: 8 additions & 3 deletions src/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,15 @@ export default class UpdateCommand extends Command {
}

private async createBin(version: string) {
let dst = this.clientBin
const dst = this.clientBin
const {bin} = this.config
const binPathEnvVar = this.config.scopedEnvVarKey('BINPATH')
const redirectedEnvVar = this.config.scopedEnvVarKey('REDIRECTED')
if (this.config.windows) {
let body = `@echo off
"%~dp0\\..\\${version}\\bin\\${this.config.bin}.cmd" %*
set ${redirectedEnvVar}="1"
set ${binPathEnvVar}="%~dp0${bin}"
"%~dp0..\\${version}\\bin\\${bin}.cmd" %*
`
await fs.outputFile(dst, body)
} else {
Expand All @@ -199,7 +204,7 @@ get_script_dir () {
echo "$DIR"
}
DIR=$(get_script_dir)
HEROKU_CLI_REDIRECTED=1 "$DIR/../${version}/bin/${this.config.bin}" "$@"
${binPathEnvVar}="\$DIR/${bin}" ${redirectedEnvVar}=1 "$DIR/../${version}/bin/${bin}" "$@"
`

await fs.remove(dst)
Expand Down
32 changes: 18 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
dependencies:
debug "^3.1.0"

"@oclif/config@^1.6.6":
version "1.6.6"
resolved "https://registry.yarnpkg.com/@oclif/config/-/config-1.6.6.tgz#8a5aed05018b6294ce4a46cba75aacebb1a3bf16"
dependencies:
debug "^3.1.0"

"@oclif/dev-cli@^1.13.1":
version "1.13.1"
resolved "https://registry.yarnpkg.com/@oclif/dev-cli/-/dev-cli-1.13.1.tgz#3a40b2c5890c86413ef3a2fcf232178cff7e897c"
Expand Down Expand Up @@ -115,9 +121,9 @@
dependencies:
tslint-xo "^0.7.0"

"@types/chai@^4.1.2":
version "4.1.2"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.1.2.tgz#f1af664769cfb50af805431c407425ed619daa21"
"@types/chai@^4.1.3":
version "4.1.3"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.1.3.tgz#b8a74352977a23b604c01aa784f5b793443fb7dc"

"@types/cross-spawn@^6.0.0":
version "6.0.0"
Expand Down Expand Up @@ -157,19 +163,17 @@
version "3.0.3"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"

"@types/mocha@^5.1.0":
version "5.1.0"
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-5.1.0.tgz#591f158012ec30de978b00065239a84fb1ce4380"
dependencies:
"@types/node" "*"
"@types/mocha@^5.2.0":
version "5.2.0"
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-5.2.0.tgz#b3c8e69f038835db1a7fdc0b3d879fc50506e29e"

"@types/node@*":
version "7.0.60"
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.60.tgz#5406c35961e4f9e2d5a1b9482daa14501754ecda"

"@types/node@^9.6.5":
version "9.6.5"
resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.5.tgz#ee700810fdf49ac1c399fc5980b7559b3e5a381d"
"@types/node@^9.6.6":
version "9.6.6"
resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.6.tgz#439b91f9caf3983cad2eef1e11f6bedcbf9431d2"

"@types/semver@^5.5.0":
version "5.5.0"
Expand Down Expand Up @@ -1749,9 +1753,9 @@ type-detect@^4.0.0:
version "4.0.8"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"

typescript@^2.8.1:
version "2.8.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.1.tgz#6160e4f8f195d5ba81d4876f9c0cc1fbc0820624"
typescript@^2.8.3:
version "2.8.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.3.tgz#5d817f9b6f31bb871835f4edf0089f21abe6c170"

union-value@^1.0.0:
version "1.0.0"
Expand Down

0 comments on commit 371bc32

Please sign in to comment.