use Rsconscript instead of Rsconsfile - close #62

This commit is contained in:
josh committed 2018-11-25 15:42:53 -05:00
1 parent 9975eec165
commit 1eb07e9a22
15 files changed
+164 -164

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
Rscons::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