Add 'build' DSL method.
Disallow processing Environments until configuration is performed.
This commit is contained in:
1 parent
5720662b7c
commit
f8e6666a2c
90 files changed
+637
-434
No files matched your search
@@ -1,15 +1,17 @@
|
||||
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))))
|
||||
build do
|
||||
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
|
||||
cache.register_build(target, :JsonToYaml, sources, env)
|
||||
target
|
||||
end
|
||||
target
|
||||
env.JsonToYaml('foo.yml', 'foo.json')
|
||||
end
|
||||
env.JsonToYaml('foo.yml', 'foo.json')
|
||||
end
|
||||
Reference in new issue
Block a user