Skip to content

Commit

Permalink
Add psych as dependency and fix schema load on psych >= 4.0.1 (#1685)
Browse files Browse the repository at this point in the history
* Add psych as dependency and fix schema load on psych >= 4.0.1

From version 4 psych, has changed the API for load_safe.

Resolves #1684

* Ensure we use proper syntax of safe_load based on the psych version

Since ruby 1.9.2 psych is a part of ruby MRI.
From ruby 3.1.0 it comes with psych 4.0.1, which introduced a braking change into safe_load method. Ruby 3.2.0 comes with psych 5.0.1

refs:
- https://www.ruby-lang.org/en/news/2021/12/25/ruby-3-1-0-released/
- https://www.ruby-lang.org/en/news/2022/12/25/ruby-3-2-0-released/
  • Loading branch information
chytreg authored Feb 10, 2023
1 parent 600b3a0 commit 07cbb25
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/active_graph/tasks/migration.rake
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ COMMENT

args.with_defaults(remove_missing: false)

schema_data = YAML.safe_load(File.read(SCHEMA_YAML_PATH), [Symbol])
schema_data = if Gem::Requirement.new(">= 4.0.1") =~ Gem::Version.new(Psych::VERSION)
YAML.safe_load(File.read(SCHEMA_YAML_PATH), permitted_classes: [Symbol])
else
YAML.safe_load(File.read(SCHEMA_YAML_PATH), [Symbol])
end

ActiveGraph::Base.subscribe_to_query(&method(:puts))

Expand Down

0 comments on commit 07cbb25

Please sign in to comment.