18 lines
517 B
Plaintext
18 lines
517 B
Plaintext
build do
|
|
Environment.new do |env|
|
|
require 'json'
|
|
require 'yaml'
|
|
env.add_builder(:JsonToYaml) do |target, sources, cache, env, vars|
|
|
unless cache.up_to_date?(target, :JsonToYaml, sources, env)
|
|
cache.mkdir_p(File.dirname(target))
|
|
File.open(target, 'w') do |f|
|
|
f.write(YAML.dump(JSON.load(IO.read(sources.first))))
|
|
end
|
|
cache.register_build(target, :JsonToYaml, sources, env)
|
|
end
|
|
target
|
|
end
|
|
env.JsonToYaml('foo.yml', 'foo.json')
|
|
end
|
|
end
|