diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2023-09-26 17:01:52 +0300 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2023-09-26 17:01:52 +0300 |
commit | 7b466349bc68e31b710c55d7aefedb234148c9c2 (patch) | |
tree | 74990335b4ea4c34954f00f3273de42fbf61f66b | |
parent | 249645bba9d02c082f8b5f1706e90f84636ce1e2 (diff) |
Update version.json testaxil-automate-dropdown-version-bump
Instead of hardcoding the version.json array stub value, use the methods
from the Release class to determine the current values.
-rw-r--r-- | lib/release.rb | 21 | ||||
-rw-r--r-- | spec/lib/release_spec.rb | 2 |
2 files changed, 17 insertions, 6 deletions
diff --git a/lib/release.rb b/lib/release.rb index d6b2627f..b8d14d1f 100644 --- a/lib/release.rb +++ b/lib/release.rb @@ -34,15 +34,26 @@ class Release git_push_branch end + def current_version + task_helpers.milestone(CURRENT_RELEASE_DATE) + end + + def next_version + task_helpers.milestone(NEXT_RELEASE_DATE) + end + + def previous_version + task_helpers.milestone(PREVIOUS_RELEASE_DATE) + end + + def previous_previous_version + task_helpers.milestone(PREVIOUS_PREVIOUS_RELEASE_DATE) + end + def update_versions_dropdown if dry_run info("DRY RUN: Not updating the version dropdown...") else - current_version = task_helpers.milestone(CURRENT_RELEASE_DATE) - next_version = task_helpers.milestone(NEXT_RELEASE_DATE) - previous_version = task_helpers.milestone(PREVIOUS_RELEASE_DATE) - previous_previous_version = task_helpers.milestone(PREVIOUS_PREVIOUS_RELEASE_DATE) - dropdown_json = JSON.load_file!('content/versions.json') dropdown_json.first.merge!( 'next' => next_version, diff --git a/spec/lib/release_spec.rb b/spec/lib/release_spec.rb index 50eaaa77..f2cd2afd 100644 --- a/spec/lib/release_spec.rb +++ b/spec/lib/release_spec.rb @@ -78,7 +78,7 @@ RSpec.describe Release do let(:dry_run) { false } it 'updates content/versions.json' do - expected_json = [{ "next" => "16.0", "current" => "15.11", "last_minor" => ["15.10", "15.9"], "last_major" => ["14.10", "13.12"] }] + expected_json = [{ "next" => described_class.new.next_version.to_s, "current" => described_class.new.current_version.to_s, "last_minor" => [described_class.new.previous_version.to_s, described_class.new.previous_previous_version.to_s], "last_major" => ["15.11", "14.10"] }] expect_info("Updating content/versions.json...") expect(File).to receive(:write).with('content/versions.json', JSON.pretty_generate(expected_json)) |