-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dev container setup #113
Dev container setup #113
Changes from all commits
3d9fc99
bc52113
db61abc
1f163d8
02bb453
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu | ||
{ | ||
"name": "Ubuntu", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"image": "mcr.microsoft.com/devcontainers/base:jammy", | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
"features": { | ||
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": { | ||
"packages": [ | ||
"mono-complete" | ||
] | ||
}, | ||
"ghcr.io/devcontainers-extra/features/gh-release:1": { | ||
"repo": "oscript-library/ovm", | ||
"version": "latest", | ||
"binaryNames": "ovm.exe", | ||
"additionalFlags": [ | ||
"--no-filter-assets-by-platform" | ||
] | ||
} | ||
}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "bash .devcontainer/postCreateCommand.sh", | ||
|
||
"postAttachCommand": "source /home/vscode/.profile", | ||
|
||
// Configure tool-specific properties. | ||
"customizations": { | ||
"vscode": { | ||
"extensions":[ | ||
"1c-syntax.language-1c-bsl", | ||
"EvilBeaver.oscript-debug", | ||
"zhuangtongfa.material-theme", | ||
"yzhang.markdown-all-in-one", | ||
"GitHub.copilot", | ||
"GitHub.copilot-chat" | ||
], | ||
|
||
"settings": { | ||
"language-1c-bsl.languageServerReleaseChannel": "prerelease" | ||
} | ||
} | ||
}, | ||
|
||
"containerEnv": { | ||
"LC_ALL": "en_US.UTF-8" | ||
} | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,15 @@ | ||||||||||||||||||||||||||||||
#!/usr/bin/env bash | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
set -eux | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
mkdir -p /home/vscode/.local/bin | ||||||||||||||||||||||||||||||
echo "mono /usr/local/bin/ovm.exe \"\$@\"" > /home/vscode/.local/bin/ovm | ||||||||||||||||||||||||||||||
chmod +x /home/vscode/.local/bin/ovm | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
ovm use --install dev | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
source /home/vscode/.profile | ||||||||||||||||||||||||||||||
Comment on lines
+9
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Добавьте проверки результатов выполнения команд Необходимо добавить проверки успешности выполнения критических операций:
-ovm use --install dev
-
-source /home/vscode/.profile
+if ! ovm use --install dev; then
+ echo "Ошибка: не удалось установить dev версию" >&2
+ exit 1
+fi
+
+PROFILE_FILE="${HOME:-/home/vscode}/.profile"
+if [[ -f "${PROFILE_FILE}" ]]; then
+ source "${PROFILE_FILE}"
+else
+ echo "Предупреждение: файл профиля ${PROFILE_FILE} не найден" >&2
+fi 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
opm install opm | ||||||||||||||||||||||||||||||
opm install oscript-config | ||||||||||||||||||||||||||||||
opm install -l | ||||||||||||||||||||||||||||||
Comment on lines
+13
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Улучшите процесс установки пакетов Текущая реализация установки пакетов требует улучшений:
-opm install opm
-opm install oscript-config
-opm install -l
+# Функция для установки пакета с проверкой результата
+install_package() {
+ local package="$1"
+ local version="${2:-}"
+
+ echo "Установка пакета ${package}${version:+ версии ${version}}..."
+ if ! opm install ${version:+--version ${version}} "$package"; then
+ echo "Ошибка: не удалось установить пакет $package" >&2
+ return 1
+ fi
+}
+
+# Установка пакетов с фиксированными версиями
+install_package "opm" "1.0.0" || exit 1
+install_package "oscript-config" "1.0.0" || exit 1
+
+# Локальная установка пакетов из текущей директории
+echo "Установка локальных пакетов..."
+if ! opm install -l; then
+ echo "Ошибка: не удалось установить локальные пакеты" >&2
+ exit 1
+fi Также рекомендуется добавить комментарий, поясняющий назначение флага
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Добавьте проверки предусловий и используйте переменные окружения
Текущая реализация имеет несколько потенциальных проблем:
/home/vscode
предполагает конкретного пользователяПредлагаю следующие улучшения:
📝 Committable suggestion