Add shortcut method for creating environments - close #149
Add env() method to create environments. Process all environments created at build script top level before executing any autoconf-enabled tasks, or if no tasks are specified by the user.
This commit is contained in:
1 parent
6d5f44d4e5
commit
ef7e9259cb
129 files changed
+742
-901
No files matched your search
@@ -1,18 +1,16 @@
|
||||
default do
|
||||
Environment.new do |env|
|
||||
require 'json'
|
||||
require 'yaml'
|
||||
env.add_builder(:JsonToYaml) do |params|
|
||||
unless @cache.up_to_date?(@target, :JsonToYaml, @sources, @env)
|
||||
print_run_message("JsonToYaml #{@target}", nil)
|
||||
@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)
|
||||
env do |env|
|
||||
require 'json'
|
||||
require 'yaml'
|
||||
env.add_builder(:JsonToYaml) do |params|
|
||||
unless @cache.up_to_date?(@target, :JsonToYaml, @sources, @env)
|
||||
print_run_message("JsonToYaml #{@target}", nil)
|
||||
@cache.mkdir_p(File.dirname(@target))
|
||||
File.open(@target, 'w') do |f|
|
||||
f.write(YAML.dump(JSON.load(IO.read(@sources.first))))
|
||||
end
|
||||
true
|
||||
@cache.register_build(@target, :JsonToYaml, @sources, @env)
|
||||
end
|
||||
env.JsonToYaml('foo.yml', 'foo.json')
|
||||
true
|
||||
end
|
||||
env.JsonToYaml('foo.yml', 'foo.json')
|
||||
end
|
||||
Reference in new issue
Block a user