<?php

echo `grunt copy:files`;

include './build/wp-includes/plugin.php';

add_filter( 'automatic_updates_is_vcs_checkout', '__return_false' );
add_filter( 'auto_update_plugin', '__return_true' );

// Display the email locally rather than going to the inbox..
function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {
	echo "Subject: {$subject}\n";
	echo $message;
}

include './build/wp-load.php';

include_once( ABSPATH . '/wp-admin/includes/admin.php' );
include_once( ABSPATH . '/wp-admin/includes/class-wp-upgrader.php' );

// Make sure all updates are available.
wp_update_plugins();

var_dump( get_site_transient( 'update_plugins' ) );

// Clear lock if it fataled..
WP_Upgrader::release_lock( 'auto_updater' );


$upgrader = new WP_Automatic_Updater;
$upgrader->run();
//var_dump( $upgrader );

// Check there were translations installed as expected
echo `ls -R ./build/wp-content/languages/`;
