Skip to content

Commit

Permalink
Merge pull request #2 from inean/new-devcontainer-setting-prefix
Browse files Browse the repository at this point in the history
Update Dev Container extension settings prefix to dev.containers.
  • Loading branch information
inean authored Oct 7, 2023
2 parents 6dcb1f1 + 5f6c4ab commit 9676734
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
18 changes: 9 additions & 9 deletions code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -283,17 +283,17 @@ if [ ! -f "$settings_json" ] ; then
mkdir -p "$(dirname "$settings_json")"
cat > "$settings_json" <<EOF
{
"remote.containers.dockerPath": "$podman_wrapper"
"dev.containers.dockerPath": "$podman_wrapper"
}
EOF
elif ! grep -q '"remote\.containers\.dockerPath": *"'"$wrapper_quoted"'"' "$settings_json" ; then
if ! grep -q '"remote\.containers\.dockerPath"' "$settings_json" ; then
info "Editing $settings_json to add remote.containers.dockerPath"
sed -i '1s@{@{\n "remote.containers.dockerPath": "'"$podman_wrapper"'",@' \
elif ! grep -q '"dev\.containers\.dockerPath": *"'"$wrapper_quoted"'"' "$settings_json" ; then
if ! grep -q '"dev\.containers\.dockerPath"' "$settings_json" ; then
info "Editing $settings_json to add dev.containers.dockerPath"
sed -i '1s@{@{\n "dev.containers.dockerPath": "'"$podman_wrapper"'",@' \
"$settings_json"
else
info "Editing $settings_json to update remote.containers.dockerPath"
sed -i -r 's@("remote.containers.dockerPath": *")[^"]*@\1'"$podman_wrapper"'@' \
info "Editing $settings_json to update dev.containers.dockerPath"
sed -i -r 's@("dev.containers.dockerPath": *")[^"]*@\1'"$podman_wrapper"'@' \
"$settings_json"
fi
fi
Expand Down Expand Up @@ -396,8 +396,8 @@ if $toolbox_reset_configuration || [ ! -f $settings ] ; then
mkdir -p "$(dirname $settings)"
cat > $settings <<EOF
{
"remote.containers.copyGitConfig": false,
"remote.containers.gitCredentialHelperConfigLocation": "none",
"dev.containers.copyGitConfig": false,
"dev.containers.gitCredentialHelperConfigLocation": "none",
"terminal.integrated.defaultProfile.linux": "toolbox",
"terminal.integrated.profiles.linux": {
"toolbox": {
Expand Down
6 changes: 3 additions & 3 deletions tests/test-basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ EOF

assert_contents /home/testuser/.var/app/com.visualstudio.code/config/Code/User/settings.json <<'EOF'
{
"remote.containers.dockerPath": "/home/testuser/.local/bin/podman-host"
"dev.containers.dockerPath": "/home/testuser/.local/bin/podman-host"
}
EOF

assert_contents /root/.vscode-server/data/Machine/settings.json <<'EOF'
{
"remote.containers.copyGitConfig": false,
"remote.containers.gitCredentialHelperConfigLocation": "none",
"dev.containers.copyGitConfig": false,
"dev.containers.gitCredentialHelperConfigLocation": "none",
"terminal.integrated.defaultProfile.linux": "toolbox",
"terminal.integrated.profiles.linux": {
"toolbox": {
Expand Down
8 changes: 4 additions & 4 deletions tests/test-server-dir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mock_server_dir_topdir() {

test_server_dir_topdir() {
code .
assert_grep '"remote.containers.copyGitConfig": false' \
assert_grep '"dev.containers.copyGitConfig": false' \
/.vscode-server/data/Machine/settings.json
}

Expand All @@ -34,7 +34,7 @@ mock_server_dir_root() {

test_server_dir_root() {
code .
assert_grep '"remote.containers.copyGitConfig": false' \
assert_grep '"dev.containers.copyGitConfig": false' \
/root/.vscode-server/data/Machine/settings.json
}

Expand All @@ -54,7 +54,7 @@ mock_server_dir_home() {
test_server_dir_home() {
code .
check_home_symlink
assert_grep '"remote.containers.copyGitConfig": false' \
assert_grep '"dev.containers.copyGitConfig": false' \
/home/testuser/.vscode-server/data/Machine/settings.json
}

Expand All @@ -68,7 +68,7 @@ test_server_dir_home_old_symlink() {
ln -s /bah/bah /home/testuser/.vscode-server
code .
check_home_symlink
assert_grep '"remote.containers.copyGitConfig": false' \
assert_grep '"dev.containers.copyGitConfig": false' \
/home/testuser/.vscode-server/data/Machine/settings.json
}

Expand Down
8 changes: 4 additions & 4 deletions tests/test-settings-edit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test_settings_edit_missing() {

assert_contents /home/testuser/.var/app/com.visualstudio.code/config/Code/User/settings.json <<'EOF'
{
"remote.containers.dockerPath": "/home/testuser/.local/bin/podman-host"
"dev.containers.dockerPath": "/home/testuser/.local/bin/podman-host"
}
EOF
}
Expand All @@ -30,7 +30,7 @@ EOF

assert_contents /home/testuser/.var/app/com.visualstudio.code/config/Code/User/settings.json <<'EOF'
{
"remote.containers.dockerPath": "/home/testuser/.local/bin/podman-host",
"dev.containers.dockerPath": "/home/testuser/.local/bin/podman-host",
"test": "blah"
}
EOF
Expand All @@ -44,15 +44,15 @@ test_settings_edit_change() {
mkdir -p /home/testuser/.var/app/com.visualstudio.code/config/Code/User
cat > /home/testuser/.var/app/com.visualstudio.code/config/Code/User/settings.json <<'EOF'
{
"remote.containers.dockerPath": "/blah/bin/podman-host"
"dev.containers.dockerPath": "/blah/bin/podman-host"
}
EOF

code --toolbox-verbose . 2>&1

assert_contents /home/testuser/.var/app/com.visualstudio.code/config/Code/User/settings.json <<'EOF'
{
"remote.containers.dockerPath": "/home/testuser/.local/bin/podman-host"
"dev.containers.dockerPath": "/home/testuser/.local/bin/podman-host"
}
EOF
}

0 comments on commit 9676734

Please sign in to comment.