I bump the version of Rake to 13.2.0 and got a NameError at the above point.
Rake uses Struct instead of OpenStruct in version 13.2.0.
ruby/rake#545
It seems that OpenStruct loading is implicitly dependent on Rake.
I suggest adding require 'ostruct' or using Struct instead of the deprecated OpenStruct.