Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Commit

Permalink
Add ability to launch with a nightly release of Gutenberg (#144)
Browse files Browse the repository at this point in the history
* Add ability to launch with Gutenberg nightly

* Bump versio to 4.5
  • Loading branch information
oskosk authored Nov 16, 2018
1 parent 09e1c07 commit e208553
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
46 changes: 46 additions & 0 deletions features/gutenberg-nightly.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace jn;

define( 'GUTENBERG_NIGHTLY_PLUGIN_URL', 'https://builds.danielbachhuber.com/gutenberg-nightly.zip' );

add_action( 'jurassic_ninja_init', function() {
$defaults = [
'gutenberg-nightly' => false,
];

add_action( 'jurassic_ninja_add_features_before_auto_login', function( &$app = null, $features, $domain ) use ( $defaults ) {
$features = array_merge( $defaults, $features );
if ( $features['gutenberg-nightly'] ) {
debug( '%s: Adding Gutenberg nightly release Plugin', $domain );
add_gutenberg_nightly_plugin();
}
}, 10, 3 );

add_filter( 'jurassic_ninja_rest_feature_defaults', function( $defaults ) {
return array_merge( $defaults, [
'gutenberg-nightly' => false,
] );
} );

add_filter( 'jurassic_ninja_rest_create_request_features', function( $features, $json_params ) {
if ( isset( $json_params['gutenberg-nightly'] ) ) {
$features['gutenberg-nightly'] = $json_params['gutenberg-nightly'];
}
return $features;
}, 10, 2 );

} );

/**
* Installs and activates the Gutenberg Nightly plugin on the site.
* https://builds.danielbachhuber.com/gutenberg-nightly.zip
* https://danielbachhuber.com/2018/10/02/gutenberg-nightly-build/
*/
function add_gutenberg_nightly_plugin() {
$gutenberg_nightly_plugin_url = GUTENBERG_NIGHTLY_PLUGIN_URL;
$cmd = "wp plugin install $gutenberg_nightly_plugin_url --activate";
add_filter( 'jurassic_ninja_feature_command', function ( $s ) use ( $cmd ) {
return "$s && $cmd";
} );
}
2 changes: 1 addition & 1 deletion jurassic.ninja.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* Plugin Name: Jurassic Ninja
* Description: Launch ephemeral instances of WordPress + Jetpack using ServerPilot and an Ubuntu Box.
* Version: 4.4
* Version: 4.5
* Author: Automattic
**/

Expand Down
3 changes: 2 additions & 1 deletion lib/stuff.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ function require_feature_files() {
'/features/woocommerce-beta-tester.php',
'/features/wp-debug-log.php',
'/features/gutenpack.php',
'/features/wordpress-5-beta.php',
'/features/gutenberg-master.php',
'/features/gutenberg-nightly.php',
'/features/wordpress-5-beta.php',
];

$available_features = apply_filters( 'jurassic_ninja_available_features', $available_features );
Expand Down

0 comments on commit e208553

Please sign in to comment.