diff --git a/CHANGELOG.md b/CHANGELOG.md index b1b15e6..55289e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Hieracles Changelog ======================= +### 0.4.4 - 2023-01-06 +- fix lib/hieracles/node.rb params function to load YAML properly + when moving to ruby3.2.0 / psych4 and the alias parsing behaviour + change. +- fix deprecated exists? method for File:Class in favor to exist? + (exists? is deprecated) + ### 0.4.3 - 2020-03-31 - fix formatting for console colors diff --git a/README.md b/README.md index 58c8e68..a1cfc4b 100644 --- a/README.md +++ b/README.md @@ -237,6 +237,14 @@ shar `find rubygem-hieracles` > rubygem-hieracles.shar - on https://bugs.freebsd.org submit the new version +GEM packaging +------------- + +- edit the CHANGELOG.md file (bump version/add the necessary comments) +- `gem build hieracles.gemspec` +- `gem install [--user-install] ./hieracles-X.Y.Z.gem` + + Todo -------------- - add json format (done) diff --git a/hieracles-0.4.4.gem b/hieracles-0.4.4.gem new file mode 100644 index 0000000..dc1fae5 Binary files /dev/null and b/hieracles-0.4.4.gem differ diff --git a/lib/hieracles/config.rb b/lib/hieracles/config.rb index d80a23c..cd90453 100644 --- a/lib/hieracles/config.rb +++ b/lib/hieracles/config.rb @@ -83,9 +83,9 @@ def load_facts(file, format) end def resolve_path(path) - if File.exists?(File.expand_path(path)) + if File.exist?(File.expand_path(path)) File.expand_path(path) - elsif File.exists?(File.expand_path(File.join(@basepath, path))) + elsif File.exist?(File.expand_path(File.join(@basepath, path))) File.expand_path(File.join(@basepath, path)) else raise IOError, "File #{path} not found." diff --git a/lib/hieracles/node.rb b/lib/hieracles/node.rb index 80ee010..2a2a796 100644 --- a/lib/hieracles/node.rb +++ b/lib/hieracles/node.rb @@ -52,7 +52,14 @@ def paths(without_common = true) def params(without_common = true) params = {} files(without_common).each do |f| - data = YAML.load_file(File.join(@config.basepath, f)) + + # Patch to work on ruby3.2.0 + begin + data = YAML.load_file(File.join(@config.basepath, f), aliases: true) + rescue ArgumentError + data = YAML.load_file(File.join(@config.basepath, f)) + end + if data s = to_shallow_hash(data) s.each do |k,v|