Skip to content
Snippets Groups Projects
Verified Commit 82ebaab4 authored by Igor Drozdov's avatar Igor Drozdov :two:
Browse files

Introduce Gitlab.next_rails? for dual-booting

parent 70d845c8
No related branches found
No related tags found
No related merge requests found
# frozen_string_literal: true
def next?
File.basename(__FILE__) == "Gemfile.next"
end
source 'https://rubygems.org'
if ENV.fetch('BUNDLER_CHECKSUM_VERIFICATION_OPT_IN', 'false') != 'false' # this verification is still experimental
......@@ -24,7 +28,12 @@ gem 'bundler-checksum', '~> 0.1.0', path: 'vendor/gems/bundler-checksum', requir
# https://gitlab.com/gitlab-org/gitlab/-/issues/375713
#
# See https://docs.gitlab.com/ee/development/gemfile.html#upgrade-rails for guidelines when upgrading Rails
gem 'rails', '~> 7.0.8.4' # rubocop:todo Gemfile/MissingFeatureCategory
if next?
gem 'rails', '~> 7.1.3.4', feature_category: :shared
else
gem 'rails', '~> 7.0.8.4', feature_category: :shared
end
gem 'activerecord-gitlab', path: 'gems/activerecord-gitlab' # rubocop:todo Gemfile/MissingFeatureCategory
......
Gemfile
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -132,4 +132,16 @@ def self.maintenance_mode?
::Gitlab::CurrentSettings.maintenance_mode
end
# This method will check your environment
# (e.g. `ENV['BUNDLE_GEMFILE]`) to determine whether your application is
# running with the next set of dependencies or the current set of dependencies.
#
# @return [Boolean]
def self.next_rails?
return @next_bundle_gemfile unless @next_bundle_gemfile.nil?
return false unless ENV["BUNDLE_GEMFILE"]
@next_bundle_gemfile = File.exist?(ENV["BUNDLE_GEMFILE"]) && File.basename(ENV["BUNDLE_GEMFILE"]) == "Gemfile.next"
end
end
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Gitlab do
RSpec.describe Gitlab, feature_category: :shared do
%w[root extensions ee? jh?].each do |method_name|
it "delegates #{method_name} to GitlabEdition" do
expect(GitlabEdition).to receive(method_name)
......@@ -380,4 +380,28 @@
expect(described_class.maintenance_mode?).to eq(false)
end
end
describe '.next_rails?' do
around do |example|
example.run
ensure
described_class.instance_variable_set(:@next_bundle_gemfile, nil)
end
where(:bundle_gemfile, :expected_result) do
[
[nil, false],
['Gemfile.another', false],
['Gemfile.next', true]
]
end
with_them do
it 'returns whether BUNDLE_GEMFILE points to Gemfile.next' do
stub_env('BUNDLE_GEMFILE', bundle_gemfile)
expect(described_class.next_rails?).to eq(expected_result)
end
end
end
end
......@@ -83,7 +83,7 @@ def validate_file_checksum(checksum)
module BundlerChecksum
class << self
def checksum_file
@checksum_file ||= File.join(File.dirname(Bundler.default_gemfile), 'Gemfile.checksum')
@checksum_file ||= "#{Bundler.default_gemfile}.checksum"
end
def checksums_from_file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment