Remove a dependency on WP in svn:publish command [MAILPOET-1156]
This commit is contained in:
21
RoboFile.php
21
RoboFile.php
@@ -289,14 +289,11 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function svnPublish($opts = ['force' => false]) {
|
function svnPublish($opts = ['force' => false]) {
|
||||||
$this->loadWPFunctions();
|
$this->loadEnv();
|
||||||
|
|
||||||
$svn_dir = ".mp_svn";
|
$svn_dir = ".mp_svn";
|
||||||
$plugin_data = get_plugin_data('mailpoet.php', false, false);
|
$plugin_version = $this->getPluginVersion('mailpoet.php');
|
||||||
$plugin_version = $plugin_data['Version'];
|
$plugin_dist_name = 'mailpoet';
|
||||||
$plugin_dist_name = sanitize_title_with_dashes($plugin_data['Name']);
|
|
||||||
$plugin_dist_name = explode('-', $plugin_dist_name);
|
|
||||||
$plugin_dist_name = $plugin_dist_name[0];
|
|
||||||
$plugin_dist_file = $plugin_dist_name . '.zip';
|
$plugin_dist_file = $plugin_dist_name . '.zip';
|
||||||
$this->say('Publishing version: ' . $plugin_version);
|
$this->say('Publishing version: ' . $plugin_version);
|
||||||
|
|
||||||
@@ -416,13 +413,9 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
$dotenv->load();
|
$dotenv->load();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function loadWPFunctions() {
|
protected function getPluginVersion($file) {
|
||||||
$this->loadEnv();
|
$data = file_get_contents($file);
|
||||||
define('ABSPATH', getenv('WP_TEST_PATH') . '/');
|
preg_match('/^[ \t*]*Version:(.*)$/mi', $data, $m);
|
||||||
define('WPINC', 'wp-includes');
|
return !empty($m[1]) ? trim($m[1]) : false;
|
||||||
require_once(ABSPATH . WPINC . '/functions.php');
|
|
||||||
require_once(ABSPATH . WPINC . '/formatting.php');
|
|
||||||
require_once(ABSPATH . WPINC . '/plugin.php');
|
|
||||||
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user