diff --git a/packages/blocks/.gitattributes b/packages/blocks/.gitattributes new file mode 100644 index 0000000000000..a6921e6098673 --- /dev/null +++ b/packages/blocks/.gitattributes @@ -0,0 +1,4 @@ +# Files not needed to be distributed in the package. +.gitattributes export-ignore +phpunit.xml.dist export-ignore +tests/ export-ignore diff --git a/packages/blocks/.gitignore b/packages/blocks/.gitignore new file mode 100644 index 0000000000000..e7ffe02657727 --- /dev/null +++ b/packages/blocks/.gitignore @@ -0,0 +1,3 @@ +vendor +wordpress +composer.lock diff --git a/packages/blocks/README.md b/packages/blocks/README.md new file mode 100644 index 0000000000000..0adbbf4047b03 --- /dev/null +++ b/packages/blocks/README.md @@ -0,0 +1,22 @@ +# Jetpack Blocks + +Register and manage blocks within a plugin. Used to manage block registration, enqueues, and more. + +## Usage + +## Development + +Running tests requires working `svn`, `composer` and `yarn` commands. + +Once these are installed, you install the composer dependencies by running: + +```bash +$ composer install --ignore-platform-reqs +``` + +### Run PHP unit tests + +On a local development environment run: +```bash +$ composer phpunit +``` diff --git a/packages/blocks/composer.json b/packages/blocks/composer.json new file mode 100644 index 0000000000000..47685e11f23d4 --- /dev/null +++ b/packages/blocks/composer.json @@ -0,0 +1,31 @@ +{ + "name": "automattic/jetpack-blocks", + "description": "Register and manage blocks within a plugin. Used to manage block registration, enqueues, and more.", + "type": "library", + "license": "GPL-2.0-or-later", + "require": {}, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5", + "automattic/wordbless": "dev-master" + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "scripts": { + "phpunit": [ + "@composer install", + "./vendor/phpunit/phpunit/phpunit --colors=always" + ], + "post-update-cmd": "php -r \"copy('vendor/automattic/wordbless/src/dbless-wpdb.php', 'wordpress/wp-content/db.php');\"" + }, + "repositories": [ + { + "type": "path", + "url": "../*" + } + ], + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/packages/blocks/phpunit.xml.dist b/packages/blocks/phpunit.xml.dist new file mode 100644 index 0000000000000..443d8a0ace772 --- /dev/null +++ b/packages/blocks/phpunit.xml.dist @@ -0,0 +1,7 @@ + + + + tests/php + + + diff --git a/packages/blocks/src/class-blocks.php b/packages/blocks/src/class-blocks.php new file mode 100644 index 0000000000000..208707af45008 --- /dev/null +++ b/packages/blocks/src/class-blocks.php @@ -0,0 +1,23 @@ +