begin transitioning builders to using instance variables instead of #run options Hash fields

This commit is contained in:
josh committed 2019-02-11 22:53:41 -05:00
1 parent ea25f62f7c
commit 86594c62b6
21 files changed
+149 -164

No files matched your search

+6 -7
View File
@@ -3,15 +3,14 @@ build do
require 'json'
require 'yaml'
env.add_builder(:JsonToYaml) do |params|
target, sources, cache, env, vars = params.values_at(: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))))
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)
@cache.register_build(@target, :JsonToYaml, @sources, @env)
end
target
@target
end
env.JsonToYaml('foo.yml', 'foo.json')
end