-
Notifications
You must be signed in to change notification settings - Fork 36
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 #109 from deliciousbrains/release-1.4.6
Release 1.4.6
- Loading branch information
Showing
19 changed files
with
2,572 additions
and
229 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 |
---|---|---|
|
@@ -14,6 +14,7 @@ $RECYCLE.BIN/ | |
.project | ||
.metadata | ||
build/ | ||
builds/ | ||
tmp/ | ||
tests/clover.xml | ||
|
||
|
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,16 @@ | ||
build-translations: | ||
grunt makepot | ||
|
||
build-css: | ||
grunt cssmin | ||
|
||
uglify: | ||
grunt uglify | ||
|
||
zip: | ||
./build-cfg/build-plugin.sh | ||
|
||
package: build-translations build-css uglify zip | ||
|
||
publish: build-translations build-css uglify | ||
./build-cfg/build-plugin.sh better-search-replace --publish |
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
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
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
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,8 @@ | ||
<?php | ||
$root_dir = dirname( $parent_dir ); | ||
$src_dir = $root_dir; | ||
$tmp_dir = $root_dir . '/builds'; | ||
$zip_dir = $tmp_dir; | ||
$zip_name = 'better-search-replace'; | ||
$main_plugin_file = $src_dir . '/better-search-replace.php'; | ||
$plugin_slug = 'better-search-replace'; |
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,11 @@ | ||
- build-cfg | ||
- builds | ||
- .gitignore | ||
- .scruitinizer.yml | ||
- Gruntfile.js | ||
- package.json | ||
- package-lock.json | ||
- yarn.lock | ||
- Makefile | ||
- node_modules | ||
- CONTRIBUTING.md |
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,4 @@ | ||
<?php | ||
chdir( $root_dir ); | ||
system( 'make' ); | ||
chdir( $src_dir ); |
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,28 @@ | ||
<?php | ||
|
||
if ( ! $publish ) { | ||
return; | ||
} | ||
|
||
echo 'Publish to WP.org? (Y/n) '; | ||
if ( 'Y' == strtoupper( trim( fgets( STDIN ) ) ) ) { | ||
system( 'rm -fR svn' ); // Cleanup before checkout to prevent errors | ||
system( 'svn co -q http://svn.wp-plugins.org/better-search-replace svn' ); | ||
system( 'rm -R svn/trunk' ); | ||
system( 'mkdir svn/trunk' ); | ||
system( 'mkdir svn/tags/$version' ); | ||
system( "rsync -r $plugin_slug/* svn/trunk/" ); | ||
system( "rsync -r $plugin_slug/* svn/tags/$version" ); | ||
system( 'svn stat svn/ | grep \'^\?\' | awk \'{print $2}\' | xargs -I x svn add x@' ); | ||
system( 'svn stat svn/ | grep \'^\!\' | awk \'{print $2}\' | xargs -I x svn rm --force x@' ); | ||
system( 'svn stat svn/' ); | ||
|
||
echo 'Commit to WP.org? (Y/n)? '; | ||
if ( 'Y' == strtoupper( trim( fgets( STDIN ) ) ) ) { | ||
system( "svn ci --username deliciousbrains svn/ -m 'Deploy version $version'" ); | ||
} | ||
|
||
system( 'rm -fR svn' ); // All done | ||
} | ||
|
||
|
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,7 @@ | ||
<?php | ||
$version_checks = array( | ||
"better-search-replace.php" => array( | ||
'@Version:\s+(.*)\n@' => 'header', | ||
"/define\(\s*'BSR_VERSION',\s*'([^']+)'\s*\);/" => 'constant', | ||
), | ||
); |
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,92 @@ | ||
#!/usr/bin/env bash | ||
|
||
function usage() { | ||
echo "Usage: $0 [ slug1 slug2 ... ]" | ||
exit 1 | ||
} | ||
|
||
SCRIPT_ARGS="$@" | ||
PROJECT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" | ||
PLUGIN_SRC_PATH="$PROJECT_ROOT" | ||
PLUGIN_BUILDS_PATH="$PROJECT_ROOT/builds" | ||
PLUGIN_BUILD_CONFIG_PATH="$PROJECT_ROOT/build-cfg" | ||
PUBLISH="" | ||
if [[ $* == *--publish* ]] | ||
then | ||
PUBLISH="-p" | ||
fi | ||
|
||
function echog() { | ||
echo "$(tput setaf 2)$1$(tput sgr 0)" | ||
} | ||
function echor() { | ||
echo "$(tput setaf 1)$1$(tput sgr 0)" | ||
} | ||
|
||
function build_plugin() { | ||
PLUGIN_DIR="$PLUGIN_BUILD_CONFIG_PATH/$PLUGIN" | ||
|
||
if [[ -d "$PLUGIN_DIR" && ! -L "$PLUGIN_DIR" ]]; then | ||
if [ "utils" != "$PLUGIN" ] && [ "common" != "$PLUGIN" ]; | ||
then | ||
VERSION=$(php -f "$PLUGIN_BUILD_CONFIG_PATH/utils/get_plugin_version.php" "$PROJECT_ROOT" $PLUGIN) | ||
ZIP_NAME=$(php -f "$PLUGIN_BUILD_CONFIG_PATH/utils/get_plugin_zip_name.php" "$PROJECT_ROOT" $PLUGIN) | ||
BUILD_ZIP="$PLUGIN_BUILDS_PATH/$ZIP_NAME-$VERSION.zip"; | ||
|
||
if [ -f "$BUILD_ZIP" ] | ||
then | ||
rm "$BUILD_ZIP" | ||
fi | ||
|
||
echog "Building $PLUGIN v$VERSION..." | ||
cd "$PLUGIN_BUILD_CONFIG_PATH/$PLUGIN/" | ||
"$PLUGIN_BUILDS_PATH/plugin-build" "$VERSION" "$PUBLISH" | ||
echog "Plugin built: $BUILD_ZIP" | ||
echo "--------------------------" | ||
fi | ||
else | ||
usage | ||
fi | ||
} | ||
|
||
cd "$PROJECT_ROOT"; | ||
|
||
if [[ $SCRIPT_ARGS == *--pro-version* ]] | ||
then | ||
echo $(php -f "$PLUGIN_BUILD_CONFIG_PATH/utils/get_plugin_version.php" "$PROJECT_ROOT" wp-offload-ses) | ||
exit; | ||
fi | ||
|
||
if [ -z "${SCRIPT_ARGS}" ] | ||
then | ||
echog "Clearing previously built plugins..." | ||
rm -rf "$PLUGIN_BUILDS_PATH" | ||
fi | ||
|
||
if [ ! -d "$PLUGIN_BUILDS_PATH" ] | ||
then | ||
mkdir -p "$PLUGIN_BUILDS_PATH" | ||
fi | ||
|
||
if [ ! -f "$PLUGIN_BUILDS_PATH/plugin-build" -o ! -x "$PLUGIN_BUILDS_PATH/plugin-build" ] | ||
then | ||
echog "Downloading plugin-build script..." | ||
curl -sSL https://raw.githubusercontent.com/deliciousbrains/wp-plugin-build/582fdeb3f6d19ae0b1f2bd0da9b48f45c131ac34/plugin-build -o "$PLUGIN_BUILDS_PATH/plugin-build" | ||
chmod +x "$PLUGIN_BUILDS_PATH/plugin-build" | ||
fi | ||
|
||
echog "Building plugins..." | ||
if [ -z "${SCRIPT_ARGS}" ] | ||
then | ||
for PLUGIN_DIR in "$PLUGIN_BUILD_CONFIG_PATH"/*/ | ||
do | ||
PLUGIN=$(basename "$PLUGIN_DIR"); | ||
|
||
build_plugin | ||
done | ||
else | ||
for PLUGIN in ${SCRIPT_ARGS} | ||
do | ||
build_plugin | ||
done | ||
fi |
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,47 @@ | ||
<?php | ||
echo get_version( $argv[1], $argv[2] ); | ||
|
||
function get_version( $project_dir, $plugin_slug ) { | ||
$project_dir = trim( $project_dir ); | ||
$parent_dir = $project_dir . '/build-cfg/'; | ||
$config = $project_dir . '/build-cfg/' . $plugin_slug . '/config.php'; | ||
include $config; | ||
$version_check_hook = $project_dir . '/build-cfg/' . $plugin_slug . '/version-check.php'; | ||
|
||
if ( file_exists( $version_check_hook ) ) { | ||
include $version_check_hook; | ||
|
||
//$messages = ''; | ||
|
||
foreach ( $version_checks as $file => $regexes ) { | ||
$file = "$src_dir/$file"; | ||
|
||
if ( ! file_exists( $file ) ) { | ||
$messages .= "Whoa! Couldn't find $file\n"; | ||
continue; | ||
} | ||
|
||
$file_content = file_get_contents( $file ); | ||
|
||
if ( ! $file_content ) { | ||
$messages .= "Whoa! Could not read contents of $file\n"; | ||
continue; | ||
} | ||
|
||
foreach ( $regexes as $regex => $context ) { | ||
if ( ! preg_match( $regex, $file_content, $matches ) ) { | ||
$messages .= "Whoa! Couldn't find $context version number in $file\n"; | ||
continue; | ||
} | ||
|
||
if ( isset( $matches[1] ) ) { | ||
return $matches[1]; | ||
} | ||
} | ||
} | ||
} | ||
|
||
echo $messages; | ||
|
||
return false; | ||
} |
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,19 @@ | ||
<?php | ||
echo get_zip_name( $argv[1], $argv[2] ); | ||
|
||
function get_zip_name( $project_dir, $plugin ) { | ||
$project_dir = trim( $project_dir ); | ||
$parent_dir = $project_dir . '/build-cfg/'; | ||
$config = $project_dir . '/build-cfg/' . $plugin . '/config.php'; | ||
$zip_name = false; | ||
include $config; | ||
if ( ! file_exists( $config ) ) { | ||
return $plugin; | ||
} | ||
|
||
if ( ! $zip_name ) { | ||
$zip_name = $plugin; | ||
} | ||
|
||
return $zip_name; | ||
} |
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
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
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
Oops, something went wrong.