Ajout grawlix, suppression symfony
This commit is contained in:
parent
de81f87c0f
commit
8bdb293c3e
|
@ -1,66 +0,0 @@
|
|||
edit:add-var maj-symfony~ {|@argv|
|
||||
var repo = symfony-cli/symfony-cli
|
||||
var bin = /usr/local/bin/symfony
|
||||
var tmp = (mktemp -u /tmp/symfony.XXXXXXXX)
|
||||
var cdir = (pwd)
|
||||
|
||||
fn lastVersion {||
|
||||
try {
|
||||
curl -s (printf 'https://api.github.com/repos/%s/releases/latest' $repo) | grep 'tag_name' | awk '{print substr($2, 3, length($2)-4) }'
|
||||
} catch e {
|
||||
fail 'Impossible de récupérer les infos sur la dernière version'
|
||||
}
|
||||
}
|
||||
|
||||
fn currentVersion {||
|
||||
$bin -V --no-ansi | awk '{print $4}'
|
||||
}
|
||||
|
||||
fn download {|version|
|
||||
mkdir $tmp
|
||||
cd $tmp
|
||||
try {
|
||||
#wget -O symfony.tar.gz (printf 'https://github.com/%s/archive/refs/tags/v%s.tar.gz' $repo $version)
|
||||
wget -O symfony.tar.gz (printf 'https://github.com/%s/releases/download/v%s/symfony-cli_linux_amd64.tar.gz' $repo $version)
|
||||
tar -xzf symfony.tar.gz
|
||||
} catch e {
|
||||
cd $cdir
|
||||
rm -rf $tmp
|
||||
fail (printf 'Impossible de récupérer symfony %s' $version)
|
||||
}
|
||||
}
|
||||
|
||||
fn install {|version|
|
||||
#cd (printf '%s/symfony-cli-%s' $tmp $version)
|
||||
#go mod vendor
|
||||
#go build -mod=vendor -o symfony main.go
|
||||
cd $tmp
|
||||
cp -fa $bin{,.old}
|
||||
cp -fa symfony $bin
|
||||
}
|
||||
|
||||
fn info {|msg|
|
||||
echo (styled $msg bold yellow)
|
||||
}
|
||||
|
||||
fn error {|msg|
|
||||
echo (styled $msg bold red)
|
||||
}
|
||||
|
||||
var cv = (currentVersion)
|
||||
var lv = (lastVersion)
|
||||
|
||||
if (eq $cv $lv) {
|
||||
info (printf 'Vous avez la dernière version de symfony (%s)' $cv)
|
||||
return
|
||||
}
|
||||
|
||||
info (printf 'Récupération de symfony %s' $lv)
|
||||
download $lv
|
||||
|
||||
info (printf 'Mise à jour de symfony %s vers %s' $cv $lv)
|
||||
install $lv
|
||||
|
||||
cd $cdir
|
||||
rm -rf $tmp
|
||||
}
|
Loading…
Reference in New Issue