Skip to content

Commit

Permalink
fix: YAML::safe_load deprecated arguments use
Browse files Browse the repository at this point in the history
  • Loading branch information
g-arjones committed Jul 4, 2024
1 parent c11aeb9 commit 7eb4527
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
12 changes: 10 additions & 2 deletions bin/autoproj_bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,22 @@ 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.16.0")
def default_gemfile_contents(autoproj_version = ">= 2.17.0")
["source \"#{gem_source}\"",
"ruby \"#{RUBY_VERSION}\" if respond_to?(:ruby)",
"gem \"autoproj\", \"#{autoproj_version}\""].join("\n")
end

def load_yaml(contents)
if Gem::Version.new(Psych::VERSION) >= Gem::Version.new("3.1.0")
YAML.safe_load(contents, permitted_classes: [Symbol])
else
YAML.safe_load(contents, [Symbol])
end
end

def add_seed_config(path)
@config.merge!(YAML.safe_load(File.read(path), [Symbol]))
@config.merge!(load_yaml(File.read(path)))
end

# Parse the provided command line options and returns the non-options
Expand Down
12 changes: 10 additions & 2 deletions bin/autoproj_install
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,22 @@ 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.16.0")
def default_gemfile_contents(autoproj_version = ">= 2.17.0")
["source \"#{gem_source}\"",
"ruby \"#{RUBY_VERSION}\" if respond_to?(:ruby)",
"gem \"autoproj\", \"#{autoproj_version}\""].join("\n")
end

def load_yaml(contents)
if Gem::Version.new(Psych::VERSION) >= Gem::Version.new("3.1.0")
YAML.safe_load(contents, permitted_classes: [Symbol])
else
YAML.safe_load(contents, [Symbol])
end
end

def add_seed_config(path)
@config.merge!(YAML.safe_load(File.read(path), [Symbol]))
@config.merge!(load_yaml(File.read(path)))
end

# Parse the provided command line options and returns the non-options
Expand Down
10 changes: 9 additions & 1 deletion lib/autoproj/ops/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,16 @@ def default_gemfile_contents(autoproj_version = ">= #{Autoproj::VERSION}")
"gem \"autoproj\", \"#{autoproj_version}\""].join("\n")
end

def load_yaml(contents)
if Gem::Version.new(Psych::VERSION) >= Gem::Version.new("3.1.0")
YAML.safe_load(contents, permitted_classes: [Symbol])
else
YAML.safe_load(contents, [Symbol])
end
end

def add_seed_config(path)
@config.merge!(YAML.safe_load(File.read(path), [Symbol]))
@config.merge!(load_yaml(File.read(path)))
end

# Parse the provided command line options and returns the non-options
Expand Down

0 comments on commit 7eb4527

Please sign in to comment.