Skip to content

Commit

Permalink
fix: use ">= <current autoproj version>" as constraint in the default…
Browse files Browse the repository at this point in the history
… gemfile

It ensures that the Gemfile uses "the autoproj that was used during
install or later", reducing the possibility of triggering a behavior
in Bundler such as rubygems/rubygems#6226
  • Loading branch information
doudou committed Jan 2, 2023
1 parent b92c16a commit c2c5ab5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ task "bootstrap" do
%w[bootstrap install].each do |install_script|
bootstrap_code = File.read(File.join(Dir.pwd, "bin", "autoproj_#{install_script}.in"))
.gsub("require 'autoproj/ops/install'", autoproj_ops_install)
.gsub('#{Autoproj::VERSION}', Autoproj::VERSION) # rubocop:disable Lint/InterpolationCheck
File.open(File.join(Dir.pwd, "bin", "autoproj_#{install_script}"), "w") do |io|
io.write bootstrap_code
end
Expand Down
2 changes: 1 addition & 1 deletion bin/autoproj_bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ module Autoproj
# @param [String] autoproj_version a constraint on the autoproj version
# that should be used
# @return [String]
def default_gemfile_contents(autoproj_version = ">= 2.0.0")
def default_gemfile_contents(autoproj_version = ">= 2.16.0")
["source \"#{gem_source}\"",
"ruby \"#{RUBY_VERSION}\" if respond_to?(:ruby)",
"gem \"autoproj\", \"#{autoproj_version}\""].join("\n")
Expand Down
2 changes: 1 addition & 1 deletion bin/autoproj_install
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ module Autoproj
# @param [String] autoproj_version a constraint on the autoproj version
# that should be used
# @return [String]
def default_gemfile_contents(autoproj_version = ">= 2.0.0")
def default_gemfile_contents(autoproj_version = ">= 2.16.0")
["source \"#{gem_source}\"",
"ruby \"#{RUBY_VERSION}\" if respond_to?(:ruby)",
"gem \"autoproj\", \"#{autoproj_version}\""].join("\n")
Expand Down
5 changes: 2 additions & 3 deletions lib/autoproj/ops/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,10 @@ def self.guess_gem_program
# @param [String] autoproj_version a constraint on the autoproj version
# that should be used
# @return [String]
def default_gemfile_contents(autoproj_version = ">= 2.0.0")
def default_gemfile_contents(autoproj_version = ">= #{Autoproj::VERSION}")
["source \"#{gem_source}\"",
"ruby \"#{RUBY_VERSION}\" if respond_to?(:ruby)",
"gem \"autoproj\", \"#{autoproj_version}\"",
"gem \"utilrb\", \">= 3.0.1\""].join("\n")
"gem \"autoproj\", \"#{autoproj_version}\""].join("\n")
end

def add_seed_config(path)
Expand Down

0 comments on commit c2c5ab5

Please sign in to comment.