Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ intermediate
cache
node_modules
vendor
dist
build
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,13 @@ This is only for contributors with committer access:
1. Fetch the latest contents of Subversion repo with `svn update`.
2. Remove the contents of `trunk/` with `rm -Rf trunk`.
3. Update the contents of `trunk/` with a clone of the tag you created in step 2.
1. `git clone https://github.com/rollbar/rollbar-php-wordpress.git trunk`
2. `cd trunk && git checkout tags/v[version number] && cd ..`
3. `rm -Rf trunk/.git`
1. Checkout the tag you created in step 2: `git checkout tags/v[version number]`
2. Run `bin/build.sh` to build the plugin.
3. Copy the contents of `dist/` to `trunk/`
4. `svn add trunk --force`
5. `svn commit -m"Sync with GitHub repo"`
5. `svn commit -m "Sync with GitHub repo"`
4. Create the Subversion tag:
`svn copy https://plugins.svn.wordpress.org/rollbar/trunk https://plugins.svn.wordpress.org/rollbar/tags/[version number] -m"Tag [version number]"`.
`svn copy https://plugins.svn.wordpress.org/rollbar/trunk https://plugins.svn.wordpress.org/rollbar/tags/[version number] -m" Tag [version number]"`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit - intentional to add the space?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... that was supposed to be on the other side of the quote. Thanks!

Notice the version number in Subversion doesn't include the "v" prefix.

## Disclaimer
Expand Down
36 changes: 36 additions & 0 deletions bin/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#! /bin/sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering about testing. Do we, or could we, have tests that ensure that the package as built by this script functions correctly? (For example, could we have the existing test suite test what's built by this script.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to think about this one for a while. We probably could add tests.

We would need to install the test dependencies in seperate vendor directory e.g. vendor_test in the dist directory. From there we should be able to copy the files from the root of the repo needed to run tests: tests, .wp.env.json, package.json, package-lock.json, phpcs.xml, and phpunit.xml.

I believe at that point the dist directory could run the test suite the same as the we do with the repo normally.


set -e

echo "Building plugin ..."

ROOT_DIR=$(realpath "$(dirname "$(dirname "$0")")")

rm -rf "$ROOT_DIR/build"
mkdir -p "$ROOT_DIR/build"

echo " - Copying files to build/ ..."

cp -r "$ROOT_DIR/mu-plugin/" "$ROOT_DIR/build/mu-plugin/"
cp -r "$ROOT_DIR/public/" "$ROOT_DIR/build/public/"
cp -r "$ROOT_DIR/src/" "$ROOT_DIR/build/src/"
cp -r "$ROOT_DIR/templates/" "$ROOT_DIR/build/templates/"
cp "$ROOT_DIR/composer.json" "$ROOT_DIR/build/"
cp "$ROOT_DIR/composer.lock" "$ROOT_DIR/build/"
cp "$ROOT_DIR/LICENSE" "$ROOT_DIR/build/"
cp "$ROOT_DIR/README.md" "$ROOT_DIR/build/"
cp "$ROOT_DIR/readme.txt" "$ROOT_DIR/build/"
cp "$ROOT_DIR/rollbar.php" "$ROOT_DIR/build/"

echo " - Installing dependencies with Composer ..."

cd "$ROOT_DIR/build"

composer install --no-dev --optimize-autoloader

echo " - Namespace prefixing with PHP-Scoper ..."

cd "$ROOT_DIR"

rm -rf "$ROOT_DIR/dist"
vendor/bin/php-scoper add-prefix "$ROOT_DIR/build"
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"squizlabs/php_codesniffer": "^3.5",
"phpcompatibility/php-compatibility": "^9.3",
"wp-coding-standards/wpcs": "^2.2",
"sirbrillig/phpcs-variable-analysis": "^2.8"
"sirbrillig/phpcs-variable-analysis": "^2.8",
"humbug/php-scoper": "^0.18.7"
},
"license": "GPL-2.0-or-later",
"authors": [
Expand Down
Loading