示例#1
0
文件: Make.cs 项目: curabuild-alex/cb
        public virtual string MakePath(Layer layer)
        {
            var path = Path.Combine(Args.EnvDir, layer.SemName.ToString()); //todo:include slices semver
            Directory.CreateDirectory(path);

            var f = new FormatterFactory().GetFormatter(Args);
            if (f.GetType() == typeof (FormatterDocker))
            {
                return Path.Combine(path, "Dockerfile");
            }

            return Path.Combine(path, layer.SemName.ToString());
        }
示例#2
0
文件: Make.cs 项目: curabuild-alex/cb
        public virtual void Write(Layer layer, string path, IFormatter formatter)
        {
            var lines = new List<string>();
            Write(layer, lines);

            var slice = new Slice(layer.SemName, lines);

            var sb = new StringBuilder();
            formatter.Write(slice, sb);

            using (var fs = File.OpenWrite(path))
            using (var swr = new StreamWriter(fs))
            {
                swr.WriteLine(sb.ToString());
                swr.Flush();
            }
        }
示例#3
0
文件: Make.cs 项目: curabuild-alex/cb
        public virtual void Write(Layer layer, List<string> lines)
        {
            foreach (var dep in layer.Dependencies)
            {
                Write(dep, lines);
                dep.Written = true;
            }

            if (!layer.Written)
            {
                foreach (var section in layer.Sections)
                {
                    lines.Add(section.SectionType.ToString());
                    lines.AddRange(section.Lines);
                }
            }
        }
示例#4
0
文件: Make.cs 项目: curabuild-alex/cb
 public virtual void Write(Layer layer, string path)
 {
     var formatter = new FormatterFactory().GetFormatter(Args);
     Write(layer, path, formatter);
 }