Sha256: 9142e25fe26702ccccf00b1e65fb88ea31d0aeca3fc50b77fc11e8f5b5fb7fa2
Contents?: true
Size: 1.96 KB
Versions: 22
Compression:
Stored size: 1.96 KB
Contents
require "bakery/buildPattern" module Bake def self.getBuildPattern(cols, name) colMeta = @options.collection_dir+"/Collection.meta" if (cols.length == 0) Bake.formatter.printError("Collection #{name} not found", colMeta) ExitHelper.exit(1) elsif (cols.length > 1) Bake.formatter.printError("Collection #{name} found more than once", colMeta) ExitHelper.exit(1) end col = cols[0] col.project.each do |p| if p.name == "" Bake.formatter.printError("Project name empty", p) ExitHelper.exit(1) end if p.config == "" Bake.formatter.printError("Config name empty", p) ExitHelper.exit(1) end end toBuildPattern = [] @options.roots.each do |root| col.project.each do |p| projs = Root.search_to_depth(root.dir,p.name + "/Project.meta", root.depth) if projs.length == 0 toBuildPattern << BuildPattern.new(nil, nil, p) # remember it for sorted info printout end projs.each do |f| toBuildPattern << BuildPattern.new(f, "^"+p.config.gsub("*","(\\w*)")+"$", p) end end end toBuild = [] toBuildPattern.each do |bp| next unless bp.proj contents = File.open(bp.proj, "r") {|io| io.read } contents.split("\n").each do |c| res = c.match("\\s*(Library|Executable|Custom){1}Config\\s*(\\w*)") if res if res[2].match(bp.conf) != nil toBuild << BuildPattern.new(bp.proj, res[2], nil) bp.coll_p.found end end end end col.exclude.each do |p| p.name = "/"+p.name.gsub("*","(\\w*)")+"/Project.meta" p.config = "^"+p.config.gsub("*","(\\w*)")+"$" end toBuild.delete_if do |bp| exclude = false col.exclude.each do |p| exclude = true if (bp.proj.match(p.name) != nil and bp.conf.match(p.config) != nil) end exclude end toBuild.uniq! return toBuild end end
Version data entries
22 entries across 22 versions & 1 rubygems