Skip to content

Commit

Permalink
[#209 state:resolved] Fixed MT's $VERSION assignment to allow for Mak…
Browse files Browse the repository at this point in the history
…eMaker to pick up the Melody version number while still maintaining the proper API_VERSION in $VERSION. Thanks to Brad Choate for the elegant hack!

See [this comment](https://openmelody.lighthouseapp.com/projects/26604-melody/tickets/209-make-dist-is-picking-up-the-wrong-version#ticket-209-6) and ensuing discussion for the explanation of how this works.
  • Loading branch information
jayallen committed Dec 9, 2009
1 parent a05ebbd commit 27bc797
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions lib/MT.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,32 @@ our $plugins_installed;

BEGIN {
$plugins_installed = 0;
use version;
if('__MAKE_ME__' eq '__MAKE_' . 'ME__') { # If make is not run
( $VERSION, $SCHEMA_VERSION ) = ( '4.32', '4.0076');
( $PRODUCT_NAME, $PRODUCT_CODE, $PRODUCT_VERSION, $VERSION_ID, $PORTAL_URL ) = (
'Melody', 'OM',
qv('0.9.6'), '0.9.6 (MT 4.32+)', 'http://openmelody.org'
# qv() comes from version.pm, please see POD for details
# NOTE: We must always compare Melody's product version with
# two decimals because:
# $PRODUCT_VERSION < '1.0.0'
# is not the same as
# $PRODUCT_VERSION < '1.0' OR $PRODUCT_VERSION < 1.0
);
} else {
( $VERSION, $SCHEMA_VERSION ) = ( '__API_VERSION__',
'__SCHEMA_VERSION__' );
( $PRODUCT_NAME, $PRODUCT_CODE, $PRODUCT_VERSION, $VERSION_ID, $PORTAL_URL ) = (
'__PRODUCT_NAME__', '__PRODUCT_CODE__',
'__PRODUCT_VERSION__', '__PRODUCT_VERSION_ID__', '__PORTAL_URL__'
);
# This first section is run by the default distribution
# which does not require building by make
if('__MAKE_ME__' eq '__MAKE_' . 'ME__') {
# The first three lines are a hack to allow MakeMaker to pick up
# the Melody version for the dist name and other variables while
# still maintaining the API version ($VERSION) for plugins to
# test against for compatibility (i.e. "use MT 4.32;")
use version; our $VERSION = qv('0.9.6'); # MakeMaker stops here
$PRODUCT_VERSION = $VERSION; # The rightful resting place
$VERSION = '4.32'; # The true API version
$SCHEMA_VERSION = '4.0076'
$PRODUCT_NAME = 'Melody';
$PRODUCT_CODE = 'OM';
$VERSION_ID = '0.9.6 (MT 4.32+)';
$PORTAL_URL = 'http://openmelody.org';
}
else {
# This section is run if the distro was built by make
$VERSION = '__API_VERSION__';
$SCHEMA_VERSION = '__SCHEMA_VERSION__' ;
$PRODUCT_NAME = '__PRODUCT_NAME__';
$PRODUCT_CODE = '__PRODUCT_CODE__';
$PRODUCT_VERSION = '__PRODUCT_VERSION__';
$VERSION_ID = '__PRODUCT_VERSION_ID__'
$PORTAL_URL = '__PORTAL_URL__';
}

$DebugMode = 0;

# Alias lowercase to uppercase package; note: this is an equivalence
Expand Down

0 comments on commit 27bc797

Please sign in to comment.