Skip to content

Commit 80eb343

Browse files
committed
Don't use YAML::Store as it's not included by default in Ruby 3.5.
1 parent 13910c9 commit 80eb343

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

bake/utopia/environment.rb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@ def update(name, root: context.root, **variables)
5151
yield store if block_given?
5252

5353
Console.info(self) do |buffer|
54-
buffer.puts "Environment #{name} (#{path}):"
55-
store.roots.each do |key|
56-
value = store[key]
57-
54+
buffer.puts "Environment #{name.inspect} (#{path}):"
55+
store.each do |key, value|
5856
buffer.puts "#{key}=#{value.inspect}"
5957
end
6058
end
@@ -84,9 +82,15 @@ def update_environment(root, name)
8482
environment_path = self.environment_path(root, name)
8583
FileUtils.mkpath File.dirname(environment_path)
8684

87-
store = YAML::Store.new(environment_path)
85+
if File.exist?(environment_path)
86+
store = YAML.load_file(environment_path)
87+
else
88+
store = Hash.new
89+
end
90+
91+
yield store, name, environment_path
8892

89-
store.transaction do
90-
yield store, name, environment_path
93+
File.open(environment_path, "w") do |file|
94+
YAML.dump(store, file)
9195
end
9296
end

0 commit comments

Comments
 (0)