yml_merger 发布了 https://rubygems.org/gems/yml_merger
yml_merger
This is a tool that helps to organize the YML in different files.
source code
install
gem install yml_merger
gem install deep_merge
usage:
Please refer to the test.
create a yml file as below
test.yml
__load__:
more.yml
<your yml content>
require 'yml_merger'
entry_yml = "test.yml"
@search_path = (Pathname.new(File.dirname(__FILE__)).realpath + 'records/').to_s
merge_unit = YML_Merger.new(
@entry_yml, @search_path
)
merged_data = merge_unit.process()
puts "creating './merged_data.yml'"
File.write('./merged_data.yml', YAML.dump(merged_data))
the test.yml and more.yml content are merged together