Skip to content

Commit 11ff74c

Browse files
committed
Fixed #138 Added PHP-Scoper to build to prevent dependency conflicts.
1 parent 7b1af3b commit 11ff74c

File tree

8 files changed

+2223
-572
lines changed

8 files changed

+2223
-572
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,5 @@ intermediate
4343
cache
4444
node_modules
4545
vendor
46+
dist
47+
build

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,13 +346,13 @@ This is only for contributors with committer access:
346346
1. Fetch the latest contents of Subversion repo with `svn update`.
347347
2. Remove the contents of `trunk/` with `rm -Rf trunk`.
348348
3. Update the contents of `trunk/` with a clone of the tag you created in step 2.
349-
1. `git clone https://github.com/rollbar/rollbar-php-wordpress.git trunk`
350-
2. `cd trunk && git checkout tags/v[version number] && cd ..`
351-
3. `rm -Rf trunk/.git`
349+
1. Checkout the tag you created in step 2: `git checkout tags/v[version number]`
350+
2. Run `bin/build.sh` to build the plugin.
351+
3. Copy the contents of `dist/` to `trunk/`
352352
4. `svn add trunk --force`
353-
5. `svn commit -m"Sync with GitHub repo"`
353+
5. `svn commit -m "Sync with GitHub repo"`
354354
4. Create the Subversion tag:
355-
`svn copy https://plugins.svn.wordpress.org/rollbar/trunk https://plugins.svn.wordpress.org/rollbar/tags/[version number] -m"Tag [version number]"`.
355+
`svn copy https://plugins.svn.wordpress.org/rollbar/trunk https://plugins.svn.wordpress.org/rollbar/tags/[version number] -m" Tag [version number]"`.
356356
Notice the version number in Subversion doesn't include the "v" prefix.
357357

358358
## Disclaimer

bin/build.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#! /bin/sh
2+
3+
set -e
4+
5+
echo "Building plugin ..."
6+
7+
ROOT_DIR=$(realpath "$(dirname "$(dirname "$0")")")
8+
9+
rm -rf "$ROOT_DIR/build"
10+
mkdir -p "$ROOT_DIR/build"
11+
12+
echo " - Copying files to build/ ..."
13+
14+
cp -r "$ROOT_DIR/mu-plugin/" "$ROOT_DIR/build/mu-plugin/"
15+
cp -r "$ROOT_DIR/public/" "$ROOT_DIR/build/public/"
16+
cp -r "$ROOT_DIR/src/" "$ROOT_DIR/build/src/"
17+
cp -r "$ROOT_DIR/templates/" "$ROOT_DIR/build/templates/"
18+
cp "$ROOT_DIR/composer.json" "$ROOT_DIR/build/"
19+
cp "$ROOT_DIR/composer.lock" "$ROOT_DIR/build/"
20+
cp "$ROOT_DIR/LICENSE" "$ROOT_DIR/build/"
21+
cp "$ROOT_DIR/README.md" "$ROOT_DIR/build/"
22+
cp "$ROOT_DIR/readme.txt" "$ROOT_DIR/build/"
23+
cp "$ROOT_DIR/rollbar.php" "$ROOT_DIR/build/"
24+
25+
echo " - Installing dependencies with Composer ..."
26+
27+
cd "$ROOT_DIR/build"
28+
29+
composer install --no-dev --optimize-autoloader
30+
31+
echo " - Namespace prefixing with PHP-Scoper ..."
32+
33+
cd "$ROOT_DIR"
34+
35+
rm -rf "$ROOT_DIR/dist"
36+
vendor/bin/php-scoper add-prefix "$ROOT_DIR/build"

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"squizlabs/php_codesniffer": "^3.5",
1313
"phpcompatibility/php-compatibility": "^9.3",
1414
"wp-coding-standards/wpcs": "^2.2",
15-
"sirbrillig/phpcs-variable-analysis": "^2.8"
15+
"sirbrillig/phpcs-variable-analysis": "^2.8",
16+
"humbug/php-scoper": "^0.18.18"
1617
},
1718
"license": "GPL-2.0-or-later",
1819
"authors": [

0 commit comments

Comments
 (0)