Skip to content

Commit 6b4f4bb

Browse files
committed
[.devcontainer] make it work under ancient rubies
Notice that it now removes locks, a cleaner solution would be to go multi-lock - and I tried - and then gave up due to time constraints. Something to revisit in the future.
1 parent 8a639be commit 6b4f4bb

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.devcontainer/setup

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class SetupScript
3535

3636
if should_run_bundle?
3737
cleanup_ruby_lsp_directories
38+
update_rubygems_and_bundler
3839
install_bundle_dependencies
3940
install_foreman_gem if @options[:with_foreman]
4041
end
@@ -121,7 +122,8 @@ class SetupScript
121122
if Dir.exist?(folder_path) && File.exist?(gemfile_path)
122123
Dir.chdir(folder_path) do
123124
puts " Installing dependencies for #{folder_path}..."
124-
unless system('bundle install')
125+
126+
unless system("[ -f Gemfile.lock ] && rm Gemfile.lock; bundle install")
125127
puts "❌ Bundle install failed for #{folder}"
126128
exit 1
127129
end
@@ -134,6 +136,28 @@ class SetupScript
134136
end
135137
end
136138

139+
def update_rubygems_and_bundler
140+
puts "📦 Updating RubyGems and Bundler..."
141+
142+
if RUBY_VERSION >= "3.0"
143+
unless system("sudo gem update --system --silent")
144+
puts "❌ RubyGems update failed"
145+
exit 1
146+
end
147+
else
148+
unless system("sudo gem update --silent --system 3.4.22")
149+
puts "❌ RubyGems update failed"
150+
exit 1
151+
end
152+
153+
# sentry-sidekiq does not bundle with Bundler 2.5.x that ships with RubyGems 3.4.22
154+
unless system("sudo gem install bundler -v 2.4.22")
155+
puts "❌ Bundler installation failed"
156+
exit 1
157+
end
158+
end
159+
end
160+
137161
def install_foreman_gem
138162
unless system('gem install foreman')
139163
puts "❌ Foreman gem installation failed"

0 commit comments

Comments
 (0)