-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from alleyinteractive/feature/allow-dev-install
- Loading branch information
Showing
5 changed files
with
121 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Coding Standards | ||
|
||
on: | ||
pull_request: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
php: [7.4] | ||
name: PHP ${{ matrix.php }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Get Composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Set up Composer caching | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-composer-dependencies | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ matrix.php }}-composer- | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd | ||
tools: composer:v2 | ||
coverage: none | ||
- name: Validate Composer | ||
run: composer validate --strict | ||
- name: Install dependencies | ||
uses: nick-invision/retry@v1 | ||
with: | ||
timeout_minutes: 5 | ||
max_attempts: 5 | ||
command: composer install | ||
- name: Run phpcs | ||
run: composer run phpcs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Testing Suite | ||
|
||
on: | ||
pull_request: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
php: [7.3, 7.4] | ||
name: PHP ${{ matrix.php }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Get Composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Set up Composer caching | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-composer-dependencies | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ matrix.php }}-composer- | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd | ||
tools: composer:v2 | ||
coverage: none | ||
- name: Install dependencies | ||
uses: nick-invision/retry@v1 | ||
with: | ||
timeout_minutes: 5 | ||
max_attempts: 5 | ||
command: composer install | ||
- name: Run phpunit | ||
run: composer run phpunit |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Mantle Installer | ||
|
||
Documentation can be found inside the [Mantle documentation](https://mantle.alley.co/). | ||
|
||
![Testing Suite](https://github.com/alleyinteractive/mantle-installer/workflows/Testing%20Suite/badge.svg) | ||
![Coding Standards](https://github.com/alleyinteractive/mantle-installer/workflows/Coding%20Standards/badge.svg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,8 @@ protected function configure() { | |
->addOption( 'dev', null, InputOption::VALUE_NONE, 'Installs the latest "development" release' ) | ||
->addOption( 'force', 'f', InputOption::VALUE_NONE, 'Install even if the directory already exists' ) | ||
->addOption( 'install', 'i', InputOption::VALUE_NONE, 'Install WordPress in the current location if it doesn\'t exist.' ) | ||
->addOption( 'no-must-use', 'no-mu', InputOption::VALUE_OPTIONAL, 'Don\'t load Mantle as a must-use plugin.', false ); | ||
->addOption( 'no-must-use', 'no-mu', InputOption::VALUE_OPTIONAL, 'Don\'t load Mantle as a must-use plugin.', false ) | ||
->addOption( 'setup-dev', null, InputOption::VALUE_NONE, 'Setup mantle for development on the framework.' ); | ||
} | ||
|
||
/** | ||
|
@@ -96,7 +97,7 @@ protected function get_wordpress_root( InputInterface $input, OutputInterface $o | |
|
||
// Bail if the folder already exists. | ||
if ( $name && is_dir( $name ) && ! $input->getOption( 'force' ) ) { | ||
$style->error( 'Directory already exists: ' . $abspath ); | ||
$style->error( "Directory already exists: [{$abspath}] Use --force to override." ); | ||
return null; | ||
} | ||
|
||
|
@@ -229,8 +230,9 @@ function ( $type, $line ) use ( $output ) { | |
protected function install_mantle( string $dir, InputInterface $input, OutputInterface $output ) { | ||
$wp_content = $dir . '/wp-content'; | ||
|
||
$name = $input->getArgument( 'name' )[0] ?? 'mantle'; | ||
$mantle_dir = "{$wp_content}/plugins/{$name}"; | ||
$name = $input->getArgument( 'name' )[0] ?? 'mantle'; | ||
$mantle_dir = "{$wp_content}/plugins/{$name}"; | ||
$framework_dir = "{$wp_content}/plugins/{$name}-framework"; | ||
|
||
// Check if Mantle exists at the current location. | ||
if ( is_dir( $mantle_dir ) && file_exists( $mantle_dir . '/composer.json' ) ) { | ||
|
@@ -243,6 +245,21 @@ protected function install_mantle( string $dir, InputInterface $input, OutputInt | |
"rm -rf {$mantle_dir}/docs", | ||
]; | ||
|
||
// Setup the application for local development on the framework. | ||
if ( $input->getOption( 'setup-dev' ) ) { | ||
if ( is_dir( $framework_dir ) && file_exists( "{$framework_dir}/composer.json" ) ) { | ||
throw new RuntimeException( "Mantle Framework is already installed: [{$framework_dir}'" ); | ||
} | ||
|
||
$commands = [ | ||
"git clone [email protected]:alleyinteractive/mantle-framework.git {$framework_dir}", | ||
"cd {$framework_dir} && composer install", | ||
"git clone [email protected]:alleyinteractive/mantle.git {$mantle_dir}", | ||
"cd {$mantle_dir} && composer config repositories.mantle-framework '{\"type\": \"path\", \"url\": \"../{$name}-framework\", \"options\": {\"symlink\": true}}' --file composer.json", | ||
"cd {$mantle_dir} && composer install --no-scripts", | ||
]; | ||
} | ||
|
||
$output->writeln( 'Installing Mantle...' ); | ||
|
||
$process = $this->run_commands( $commands, $input, $output ); | ||
|
@@ -253,6 +270,10 @@ protected function install_mantle( string $dir, InputInterface $input, OutputInt | |
|
||
$output->writeln( "Mantle installed successfully at <fg=yellow>{$mantle_dir}</>." ); | ||
|
||
if ( $input->getOption( 'setup-dev' ) ) { | ||
$output->writeln( "Mantle Framework installed successfully at <fg=yellow>{$framework_dir}</>." ); | ||
} | ||
|
||
// Add Mantle as a must-use plugin. | ||
if ( false === $input->getOption( 'no-must-use' ) ) { | ||
$mu_plugins = "{$wp_content}/mu-plugins"; | ||
|