Skip to content

Commit

Permalink
Merge pull request #949 from Automattic/fix/build-scripts
Browse files Browse the repository at this point in the history
Improve build scripts
  • Loading branch information
Thierry Muller authored Feb 15, 2018
2 parents acf84e6 + 6cf7ef5 commit 8d120f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ module.exports = function( grunt ) {
grunt.config.set( 'copy', {
build: {
src: res.stdout.trim().split( /\n/ ).filter( function( file ) {
return ! /^(\.|bin|([^/]+)+\.(md|json|xml)|Gruntfile\.js|tests|wp-assets|dev-lib|readme\.md)/.test( file );
return ! /^(\.|bin|([^/]+)+\.(md|json|xml)|Gruntfile\.js|tests|wp-assets|dev-lib|readme\.md|composer\..*)/.test( file );
} ),
dest: 'build',
expand: true
Expand Down
9 changes: 7 additions & 2 deletions bin/verify-version-consistency.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env
#!/usr/bin/env php
<?php
/**
* Verify versions referenced in plugin match.
Expand Down Expand Up @@ -39,7 +39,7 @@
$versions['readme.md#changelog'] = $matches['version'];

$plugin_file = file_get_contents( dirname( __FILE__ ) . '/../amp.php' );
if ( ! preg_match( '/\*\s*Version:\s*(?P<version>\d+\.\d+(?:.\d+)?)/', $plugin_file, $matches ) ) {
if ( ! preg_match( '/\*\s*Version:\s*(?P<version>\d+\.\d+(?:.\d+)?(-\w+)?)/', $plugin_file, $matches ) ) {
echo "Could not find version in readme metadata\n";
exit( 1 );
}
Expand All @@ -59,3 +59,8 @@
fwrite( STDERR, "Error: Not all version references have been updated.\n" );
exit( 1 );
}

if ( false === strpos( $versions['amp.php#metadata'], '-' ) && ! preg_match( '/^\d+\.\d+\.\d+$/', $versions['amp.php#metadata'] ) ) {
fwrite( STDERR, sprintf( "Error: Release version (%s) lacks patch number. For new point releases, supply patch number of 0, such as 0.9.0 instead of 0.9.\n", $versions['amp.php#metadata'] ) );
exit( 1 );
}

0 comments on commit 8d120f3

Please sign in to comment.