Skip to content

Instantly share code, notes, and snippets.

@mymizan
Created November 18, 2020 05:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mymizan/8e486375659dc905f66fabf0b5208293 to your computer and use it in GitHub Desktop.
Save mymizan/8e486375659dc905f66fabf0b5208293 to your computer and use it in GitHub Desktop.
#!/usr/bin/php
<?php
$working_directory = getcwd();
$plugin_folder = basename( $working_directory );
$parent_folder = dirname( $working_directory );
/**
* Check if there's a git repo in the current directory.
*/
if ( ! file_exists( $working_directory . '/.git/index') ) {
die(PHP_EOL . "No git repo in the current directory {$working_directory}. Refusing to zip." . PHP_EOL . PHP_EOL);
}
chdir( $parent_folder );
shell_exec("rm -rf {$plugin_folder}.zip");
shell_exec("zip -r {$plugin_folder}.zip {$plugin_folder} -x '*.git*' -x '.DS_Store' -x '.travis.yml' -x 'bin' -x 'phpunit.xml.dist' -x 'tests'");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment