Skip to content

Commit 2230e2e

Browse files
authored
Merge pull request #38 from movabletype/more-codespaces
[expecimental] update codespaces
2 parents 1fdb8e7 + 67def9f commit 2230e2e

4 files changed

Lines changed: 37 additions & 2 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
}
1515
}
1616
},
17-
"extensions": ["mortenhenriksen.perl-debug", "d9705996.perl-toolbox"]
17+
"extensions": ["bscan.perlnavigator"]
1818
}

.devcontainer/post-create.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
set -xe
33

44
sudo apt update
5-
sudo apt install -y make git zip libio-socket-ssl-perl
5+
sudo apt install -y make git zip cpanminus perltidy libio-socket-ssl-perl
6+
sudo cpanm --force --from https://www.cpan.org App::cpm
67
sudo apt clean

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
/.env-*
88
/.ssh-config
99
.DS_Store
10+
/.perl-local

Makefile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,36 @@ cp-R:
222222

223223
build:
224224
${MAKE} -C docker
225+
226+
CODE_CPANM=$(shell type cpm >/dev/null 2>&1 && echo "cpm install" || echo "cpanm --installdeps .")
227+
CODE_WORKSPACES_DIR=$(abspath ${MAKEFILE_DIR}/..)
228+
CODE_DIR=${MAKEFILE_DIR}/.code
229+
CODE_CODE_WORKSPACE_FILE=${CODE_DIR}/mt.code-workspace
230+
231+
code-init:
232+
mkdir -p ${CODE_DIR}
233+
234+
LIBS=$(shell \
235+
find .. -maxdepth 4 -type d \
236+
\( -name 'lib' -o -name 'extlib' \) \
237+
-not -path '*/node_modules/*' \
238+
-not -path '*/bower_components/*' \
239+
-not -path '*/local/*' \
240+
-not -path '*/.*/*' \
241+
| sed -e 's/^..\///' | grep -v 'movabletype-patches')
242+
code-generate-workspace: code-init
243+
echo '{"folders":[' > ${CODE_CODE_WORKSPACE_FILE}
244+
for d in `echo ${LIBS} | perl -pe 's/\/\S+//g; s/ /\\n/g' | sort -u`; do \
245+
printf '%s%s%s' '{"path":"' ${CODE_WORKSPACES_DIR}/$$d '"},' >> ${CODE_CODE_WORKSPACE_FILE}; \
246+
done
247+
echo '],"settings":{"perlnavigator.includePaths":["${CODE_DIR}/local/lib/perl5",' >> ${CODE_CODE_WORKSPACE_FILE}
248+
for d in ${LIBS}; do \
249+
printf '%s%s%s' '"' ${CODE_WORKSPACES_DIR}/$$d '",' >> ${CODE_CODE_WORKSPACE_FILE}; \
250+
done
251+
echo ']}' >> ${CODE_CODE_WORKSPACE_FILE}
252+
253+
code-cpanm-install: code-init
254+
cd `ls -d ../*movabletype/t | head -n 1` && ${CODE_CPANM} -L${CODE_DIR}/local || true
255+
256+
code-open-workspace: code-cpanm-install code-generate-workspace
257+
code ${CODE_CODE_WORKSPACE_FILE}

0 commit comments

Comments
 (0)