Esempio n. 1
0
File: Make.cs Progetto: waybuild/wb
        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());
        }
Esempio n. 2
0
File: Make.cs Progetto: waybuild/wb
        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();
            }
        }
Esempio n. 3
0
File: Make.cs Progetto: waybuild/wb
        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);
                }
            }
        }
Esempio n. 4
0
File: Make.cs Progetto: waybuild/wb
 public virtual void Write(Layer layer, string path)
 {
     var formatter = new FormatterFactory().GetFormatter(Args);
     Write(layer, path, formatter);
 }