Skip to content

Commit

Permalink
fix envman update function
Browse files Browse the repository at this point in the history
  • Loading branch information
cirolosapio committed Jul 22, 2024
1 parent f11ec72 commit 1aeeff9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
### Install

```
sudo curl -L https://github.com/cirolosapio/envman/releases/download/v0.0.16/envman -o /usr/local/bin/envman
sudo curl -L https://github.com/cirolosapio/envman/releases/download/v0.0.17/envman -o /usr/local/bin/envman
sudo chmod +x /usr/local/bin/envman
```
15 changes: 10 additions & 5 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { colors } from 'https://deno.land/x/cliffy@v1.0.0-rc.4/ansi/colors.ts'
import { checkOption, dockerServiceStartsAutomatically, getLastEnvmanVersion, isCurrentUserInDockerGroup, isDocker, isOhMyZshInstalled, isWsl, run, selectWsl } from './functions.ts'
import { dockerEnginePostInstall, installBottom, installCarootOnWsl, installCtop, installDeno, installDockerEngine, installEnvman, installJetBrainsGateway, installMage2Postman, installMagentoCloudCli, installMkcert, installMkcertWin, installOhMyZsh, installSig, installSshs, installStarship } from './softwares.ts'

export const VERSION = 'v0.0.16'
export const VERSION = 'v0.0.17'

async function main() {
if (await isDocker()) {
Expand Down Expand Up @@ -43,7 +43,13 @@ async function main() {
const installed = []
const options: CheckboxOption<string>[] = []

if (lastEnvmanVersion !== VERSION) options.push({ name: colors.yellow('envman - Update needed!'), value: 'envman', checked: true })
if (lastEnvmanVersion !== VERSION) {
console.log(colors.yellow(`New version of envman available: ${lastEnvmanVersion}`))
if (await Confirm.prompt({ message: 'Do you want to update envman?', default: true })) {
await installEnvman(lastEnvmanVersion)
return
}
}

if (showDocker.disabled) {
installed.push('Docker Engine')
Expand Down Expand Up @@ -112,10 +118,9 @@ async function main() {
if (softwares.includes('mgc')) toInstall.push(installMagentoCloudCli())
if (softwares.includes('mage2postman')) toInstall.push(installMage2Postman())
if (softwares.includes('starship')) toInstall.push(installStarship())
if (softwares.includes('envman')) toInstall.push(installEnvman())
await Promise.all(toInstall)

if (await Confirm.prompt('Do you want to install another software?')) await main()
if (await Confirm.prompt({ message: 'Do you want to install another software?', default: false })) await main()
} else console.log(colors.green('All software are installed ✔'))
} else {
const softwares = await Checkbox.prompt({
Expand Down Expand Up @@ -155,7 +160,7 @@ async function main() {
await child.stdin.close()
}

if (await Confirm.prompt('Do you want to install another software?')) await main()
if (await Confirm.prompt({ message: 'Do you want to install another software?', default: false })) await main()
}
}

Expand Down
10 changes: 5 additions & 5 deletions softwares.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { bash, exists, getJetBrainsGatewayVersion, getUser, hasDockerDesktop, isCurrentUserInDockerGroup, isInstalled, ps, run, runn } from './functions.ts'
import { colors } from 'https://deno.land/x/cliffy@v1.0.0-rc.4/ansi/colors.ts'
import { VERSION } from './main.ts'

export async function installDockerEngine() {
console.log(colors.blue('installing docker engine...'))
Expand Down Expand Up @@ -146,12 +145,13 @@ export async function installMage2Postman() {
console.log(colors.green(`mage2postman installed ✔\n`))
}

export async function installEnvman() {
console.log(colors.blue('installing evnman...'))
export async function installEnvman(version: string) {
console.log(colors.blue('updating evnman...'))
await run('sudo rm /usr/local/bin/envman'.split(' '))
await run(`sudo curl -L https://github.com/cirolosapio/envman/releases/download/${VERSION}/envman -o /usr/local/bin/envman`.split(' '))
await run(`sudo curl -L https://github.com/cirolosapio/envman/releases/download/${version}/envman -o /usr/local/bin/envman`.split(' '))
await run('sudo chmod +x /usr/local/bin/envman'.split(' '))
console.log(colors.green(`evnman installed ✔\n`))
console.log(colors.green(`evnman updated ✔\n`))
console.log(colors.underline('you can now re-run envman'))
}

export async function installJetBrainsGateway() {
Expand Down

0 comments on commit 1aeeff9

Please sign in to comment.