Skip to content

Commit

Permalink
Merge pull request k8s-ruby#41 from sathish-progress/make-3.1-compatible
Browse files Browse the repository at this point in the history
Make ruby 3.1 compatible
  • Loading branch information
clintoncwolfe authored Apr 11, 2023
2 parents 25ac008 + 82830d0 commit b406031
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

# forked and upgraded to be compatible with ruby 3.1
gem 'yaml-safe_load_stream3', '~> 0.1.2'
# Specify your gem's dependencies in k8s-ruby.gemspec
gemspec
4 changes: 2 additions & 2 deletions k8s-ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
spec.bindir = "bin"
spec.executables = []
spec.require_paths = ["lib"]
spec.required_ruby_version = [">= 2.4", "< 3.1"]
spec.required_ruby_version = spec.required_ruby_version = [">= 2.4", "< 3.2"]

spec.add_runtime_dependency "excon", "~> 0.71"
spec.add_runtime_dependency "dry-struct", "<= 1.6.0"
Expand All @@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency "hashdiff", "~> 1.0.0"
spec.add_runtime_dependency "jsonpath", "~> 0.9.5"
spec.add_runtime_dependency "yajl-ruby", "~> 1.4.0"
spec.add_runtime_dependency "yaml-safe_load_stream2", "~> 0.1.1"
spec.add_runtime_dependency "yaml-safe_load_stream3"

spec.add_development_dependency "bundler", ">= 1.17", "< 3.0"
spec.add_development_dependency "rake", ">= 12.3.3"
Expand Down
5 changes: 4 additions & 1 deletion lib/k8s/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ class NamedContext < ConfigStruct
# @param path [String]
# @return [K8s::Config]
def self.load_file(path)
new(YAML.safe_load(File.read(File.expand_path(path)), [Time, DateTime, Date], [], true))
new(YAML.safe_load(File.read(File.expand_path(path)),
permitted_classes: [Time, DateTime, Date],
permitted_symbols: [],
aliases: true))
end

# Loads configuration files listed in KUBE_CONFIG environment variable and
Expand Down
2 changes: 1 addition & 1 deletion lib/k8s/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def self.from_json(data)
# @param filename [String] file path
# @return [K8s::Resource]
def self.from_file(filename)
new(YAML.safe_load(File.read(filename), [], [], true, filename))
new(YAML.safe_load(File.read(filename), permitted_classes: [], permitted_symbols: [], aliases: true, filename: filename))
end

# @param path [String] file path
Expand Down

0 comments on commit b406031

Please sign in to comment.