Palm1r / QodeAssist

QodeAssist is an AI-powered coding assistant plugin for Qt Creator
GNU General Public License v3.0
187 stars 22 forks source link

Update bash script. #170

Open alexzk1 opened 4 weeks ago

alexzk1 commented 4 weeks ago

Just sharing bash script with you. Finally I was tired enough to do manual updates :D

#!/bin/bash

DIR=/tmp/QodeAssist
PLUINGS_DIR=/lib/qtcreator/plugins

rm -rf ${DIR}
mkdir -p ${DIR}
cd ${DIR}

curl -s https://api.github.com/repos/Palm1r/QodeAssist/releases/latest \
    | grep "browser_download_url.*Linux-x64\.7z" \
    | cut -d : -f 2,3 \
    | tr -d \" \
    | wget -qi -

#We do not keep folder structure here, so file will be right in place.
7z e "*.7z"

mkdir -p ${PLUINGS_DIR}
sudo cp ./libQodeAssist.so ${PLUINGS_DIR}

echo "Latest plugin is installed. Run QtCreator now and check."
Palm1r commented 4 weeks ago

Yeah, good idea. I hoped Qt fix problem with manual plugin update and I will automate this. But looks better to create external-updater

alexzk1 commented 4 weeks ago

Yeah, good idea. I hoped Qt fix problem with manual plugin update and I will automate this. But looks better to create external-updater

I'm not sure if it is possible, as requires root pass :/ I tend to avoid giving it to GUI applications.

Palm1r commented 3 weeks ago

Sorry I changed name for future multi QtCreator support and show plugin version

alexzk1 commented 3 weeks ago

Sorry I changed name for future multi QtCreator support and show plugin version

No problem, it just worked. It checks "Linux-x64.7z" ending. However, when you will add more creator versions that will need extension.

alexzk1 commented 3 weeks ago

Updated script which handles version.

#!/bin/bash

DIR=/tmp/QodeAssist
PLUGINS_DIR=/lib/qtcreator/plugins

rm -rf ${DIR}
mkdir -p ${DIR}
cd ${DIR}

version=$(qtcreator --version | grep -oP 'Qt Creator \K[0-9]+\.[0-9]+\.[0-9]+')
echo "Qt Creator version detected: '$version'"

if [[ -z ${version} ]]; then
  echo "Could not detect version of the Qt Creator."
  exit 1
fi

curl -s https://api.github.com/repos/Palm1r/QodeAssist/releases/latest | \
  grep "browser_download_url.*QtC${version}-Linux-x64\.7z" | \
  cut -d : -f 2,3 | \
  tr -d \" | \
  wget -qi -

#We do not keep folder structure here, so file will be right in place.
7z e "*.7z"

mkdir -p ${PLUGINS_DIR}
sudo cp ./libQodeAssist.so ${PLUGINS_DIR}

echo "Latest plugin is installed. Run QtCreator now and check."