Skip to content

Commit 73de484

Browse files
committed
Add Posts 2 Posts plugin stubs generator
1 parent 4189c72 commit 73de484

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

stub-generators/wp-posts-to-posts.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
#
3+
# Generate Posts 2 Posts stubs.
4+
#
5+
6+
PLUGIN_VERSION="1.6.5"
7+
8+
GENERATE_STUBS_COMMAND="vendor/bin/generate-stubs"
9+
10+
# Check plugin
11+
if [ ! -r ./posts-to-posts.php ]; then
12+
echo "Please extract Posts 2 Posts into the current directory!" 1>&2
13+
echo "wget https://downloads.wordpress.org/plugin/posts-to-posts.${PLUGIN_VERSION}.zip && unzip posts-to-posts.${PLUGIN_VERSION}.zip" 1>&2
14+
exit 10
15+
fi
16+
17+
rm vendor/scribu/scb-framework/load.php
18+
sed -e '/^\/\/ WP/,$d' -i vendor/scribu/lib-posts-to-posts/item-user.php
19+
20+
# Generate stubs
21+
if hash generate-stubs 2>/dev/null; then
22+
GENERATE_STUBS_COMMAND="generate-stubs"
23+
elif hash generate-stubs.phar 2>/dev/null; then
24+
GENERATE_STUBS_COMMAND="generate-stubs.phar"
25+
elif [ ! -x vendor/bin/generate-stubs ]; then
26+
rm composer.json composer.lock
27+
composer require --no-interaction --update-no-dev --prefer-dist --ignore-platform-reqs \
28+
giacocorsiglia/stubs-generator
29+
fi
30+
31+
"$GENERATE_STUBS_COMMAND" --functions --classes --interfaces --traits --out=wp-posts-to-posts-${PLUGIN_VERSION}.php \
32+
vendor/scribu/scb-framework vendor/scribu/lib-posts-to-posts/ posts-to-posts.php

0 commit comments

Comments
 (0)