diff --git a/.gitignore b/.gitignore index 65855619..795d063a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ app/config/sources/*.txt cache/*.cache cache/lastdataupdate.txt cache/stats_*.json +cache/tag.txt cache/version.txt composer.lock composer.phar diff --git a/app/inc/constants.php b/app/inc/constants.php index 49066e08..21ee1230 100644 --- a/app/inc/constants.php +++ b/app/inc/constants.php @@ -27,7 +27,7 @@ If the file doesn't exist, or is empty, fall back to 'unknown.dev'. */ if (file_exists(CACHE_PATH . 'version.txt')) { - $file_content = file(CACHE_PATH . 'version.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + $file_content = file(CACHE_PATH . 'version.txt'); $git_hash = empty($file_content) ? 'unknown.dev' : $file_content[0]; diff --git a/app/models/changelog.php b/app/models/changelog.php index a9aaa35d..59fec0f5 100644 --- a/app/models/changelog.php +++ b/app/models/changelog.php @@ -62,7 +62,7 @@ }; // Helper to generate the list of patches for the version -$github_link = function ($release) use ($releases) { +$github_link = function ($release, $releases) { if ($release > 1) { $keys = array_keys($releases); $previous = $keys[array_search($release, $keys, true) - 1]; @@ -76,7 +76,7 @@ }; // Helper to generate a release title block -$release_title = function ($version) use ($releases) { +$release_title = function ($version, $releases) { return <<
There is no entry in the changelog for this release, but you can learn more about it in the GitHub release notes and look at the list of commits from the latest documented release.
"; + $text .= $github_link($version_number, $releases); + } + + return $text; +}; diff --git a/app/scripts/setup.sh b/app/scripts/setup.sh index 89a7529e..4aeba15d 100755 --- a/app/scripts/setup.sh +++ b/app/scripts/setup.sh @@ -161,16 +161,19 @@ DEV_VERSION="dev" if [ ! -d ${install}/.git ] then CURRENT_TIP="unknown" + LATEST_TAG_NAME="unknown" else cd "${install}" CURRENT_TIP=$(git rev-parse HEAD) LATEST_TAG=$(git describe --abbrev=0 --tags | xargs -I {} git rev-list -n 1 {}) + LATEST_TAG_NAME=$(git describe --abbrev=0 --tags) if [ "${CURRENT_TIP}" = "${LATEST_TAG}" ] then DEV_VERSION="" fi fi -echo "${CURRENT_TIP:0:7}${DEV_VERSION}" > "${install}/cache/version.txt" +echo "${CURRENT_TIP:0:7}${DEV_VERSION}" | tr -d '\n' > "${install}/cache/version.txt" +echo "${LATEST_TAG_NAME}" | tr -d '\n' > "${install}/cache/tag.txt" setupExternalLibraries initGeckoStringsRepo diff --git a/app/views/changelog.php b/app/views/changelog.php index b408b1be..26b79614 100644 --- a/app/views/changelog.php +++ b/app/views/changelog.php @@ -2,9 +2,10 @@ namespace Transvision; $output = ''; +$output .= $latest_undocumented_release(); foreach ($changelog as $release => $changes) { // Add release title and initialize variables - $output .= $release_title($release); + $output .= $release_title($release, $releases); $empty_release = true; $section = ''; foreach ($changes as $change => $attributes) { @@ -28,7 +29,7 @@ $output .= "\n"; } $output .= "\n"; - $output .= $github_link($release); + $output .= $github_link($release, $releases); } print($output); diff --git a/app/views/changelog_rss.php b/app/views/changelog_rss.php index ec434773..66f8c68d 100644 --- a/app/views/changelog_rss.php +++ b/app/views/changelog_rss.php @@ -44,7 +44,7 @@ $output .= 'Data last updated: not available.
\n"; } + +$version_number = ''; +if (file_exists(CACHE_PATH . 'tag.txt')) { + $version_number = $title_productname . ' ' . file_get_contents(CACHE_PATH . 'tag.txt'); +} ?> @@ -134,6 +139,7 @@