From 3d3578b73efc8f85e06e0c357be3877accf718b4 Mon Sep 17 00:00:00 2001 From: Varsha Varadarajan Date: Mon, 17 Apr 2017 17:02:39 +0530 Subject: [PATCH] Detect current version from the sym link. --- rakelib/bump_version.rake | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/rakelib/bump_version.rake b/rakelib/bump_version.rake index 6562fb64de..f838c104b8 100644 --- a/rakelib/bump_version.rake +++ b/rakelib/bump_version.rake @@ -8,14 +8,6 @@ task :bump_version do value end - current_version = env('CURRENT_VERSION') - version_to_release = env('VERSION_TO_RELEASE') - next_version = env('NEXT_VERSION') - - if [Gem::Version.new(current_version), Gem::Version.new(version_to_release), Gem::Version.new(next_version)].sort.collect(&:to_s) != [current_version, version_to_release, next_version] - fail "CURRENT_VERSION VERSION_TO_RELEASE and NEXT_VERSION don't seem right" - end - remote_name = env('REMOTE_NAME') repo_url = `git config --get remote.#{remote_name}.url`.strip @@ -23,6 +15,14 @@ task :bump_version do rm_rf "build" sh("git clone #{repo_url} build --branch gh-pages --depth 1 --quiet") + current_version = File.readlink('build/current') + version_to_release = env('VERSION_TO_RELEASE') + next_version = env('NEXT_VERSION') + + if [Gem::Version.new(current_version), Gem::Version.new(version_to_release), Gem::Version.new(next_version)].sort.collect(&:to_s) != [current_version, version_to_release, next_version] + fail "CURRENT_VERSION VERSION_TO_RELEASE and NEXT_VERSION don't seem right" + end + cd "build" do rm_rf 'current' ln_sf version_to_release, "./current"