Skip to content

Commit

Permalink
Some packaging fixes:
Browse files Browse the repository at this point in the history
- Add VERSION file, which contains just the version number of the release
- Add WHATSNEW, which is a short summary of the new release
- Add release.php which bumps all the necessary version numbers in files
- Update package.php so that the version numbers aren't hardcoded
- Add news entry for 1.7.0

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@935 48356398-32a2-884e-a903-53898d9a118a
  • Loading branch information
Edward Z. Yang committed Apr 2, 2007
1 parent e223490 commit a0d6543
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 3 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
. Internal change
==========================

1.7.0, unknown release date

1.6.0, released 2007-04-01
! Support for most common deprecated attributes via transformations:
+ bgcolor in td, th, tr and table
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.6.0
5 changes: 5 additions & 0 deletions WHATSNEW
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The 1.6.0 release, code-named Long-Overdue, contains added support
for a number of deprecated attributes HTML Purifier should have
had from the very beginning, including the name, bgcolor, border,
width and height attributes. The CSS property 'height',
rel and rev attributes, ID blacklist regexps are also available.
9 changes: 6 additions & 3 deletions package.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,18 @@

$pkg->addMaintainer('lead', 'edwardzyang', 'Edward Z. Yang', '[email protected]', 'yes');

$version = file_get_contents('VERSION');
$api_version = substr($version, 0, strrpos($version, '.'));

$pkg->setChannel('hp.jpsband.org');
$pkg->setAPIVersion('1.5');
$pkg->setAPIVersion($api_version);
$pkg->setAPIStability('stable');
$pkg->setReleaseVersion('1.5.0');
$pkg->setReleaseVersion($version);
$pkg->setReleaseStability('stable');

$pkg->addRelease();

$pkg->setNotes('Major bugs were fixed and some major internal refactoring was undertaken. The visible changes include XHTML 1.1-style modularization of HTMLDefinition, rudimentary internationalization, and a fix for a fatal error when the PHP4 DOM XML extension was loaded. The x subtag is now allowed in language codes. Element by element AllowedAttribute declaration is now possible for global attributes. Instead of *.class, you can write span.class. The old syntax still works, and enables the attribute for all elements.');
$pkg->setNotes(file_get_contents('WHATSNEW'));
$pkg->setPackageType('php');

$pkg->setPhpDep('4.3.9');
Expand Down
82 changes: 82 additions & 0 deletions release.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php

// release script
// PHP 5.0 only

if (php_sapi_name() != 'cli') {
echo 'Release script cannot be called from web-browser.';
exit;
}

if (!isset($argv[1])) {
echo
'php release.php [version]
HTML Purifier release script
';
exit;
}

$version = trim($argv[1]);

// Bump version numbers:

// ...in VERSION
file_put_contents('VERSION', $version);

// ...in NEWS
$date = date('Y-m-d');
$news_c = str_replace(
$l = "$version, unknown release date",
"$version, released $date",
file_get_contents('NEWS'),
$c
);
if (!$c) {
echo 'Could not update NEWS, missing ' . $l . PHP_EOL;
exit;
} elseif ($c > 1) {
echo 'More than one release declaration in NEWS replaced' . PHP_EOL;
exit;
}
file_put_contents('NEWS', $news_c);

// ...in Doxyfile
$doxyfile_c = preg_replace(
'/(?<=PROJECT_NUMBER {9}= )[^\s]+/m', // brittle
$version,
file_get_contents('Doxyfile'),
1, $c
);
if (!$c) {
echo 'Could not update Doxyfile, missing PROJECT_NUMBER.' . PHP_EOL;
exit;
}
file_put_contents('Doxyfile', $doxyfile_c);

// ...in HTMLPurifier.php
$htmlpurifier_c = file_get_contents('library/HTMLPurifier.php');
$htmlpurifier_c = preg_replace(
'/HTML Purifier .+? - /',
"HTML Purifier $version - ",
$htmlpurifier_c,
1, $c
);
if (!$c) {
echo 'Could not update HTMLPurifier.php, missing HTML Purifier [version] header.' . PHP_EOL;
exit;
}
$htmlpurifier_c = preg_replace(
'/var \$version = \'.+?\';/',
"var \$version = '$version';",
$htmlpurifier_c,
1, $c
);
if (!$c) {
echo 'Could not update HTMLPurifier.php, missing var $version.' . PHP_EOL;
exit;
}
file_put_contents('library/HTMLPurifier.php', $htmlpurifier_c);

echo "Review changes, write something in WHATSNEW, and then SVN commit with log 'Release $version.'" . PHP_EOL;

?>

0 comments on commit a0d6543

Please sign in to comment.