in tool/TeamCity.Docker/GenerateCommand.cs [47:86]
public Task<Result> Run()
{
var templates = _configurationExplorer.Explore(_options.SourcePath, _options.ConfigurationFiles);
if (templates.State == Result.Error)
{
return Task.FromResult(Result.Error);
}
// convert configuration parameters into graph for further processing
var graph = _buildGraphFactory.Create(templates.Value);
if (graph.State == Result.Error)
{
return Task.FromResult(Result.Error);
}
using (_logger.CreateBlock("Generate"))
{
foreach (var generator in _generators)
{
generator.Generate(graph.Value);
}
var dockerFiles = graph.Value.Nodes.Select(i => i.Value).OfType<GeneratedDockerfile>();
foreach (var dockerfile in dockerFiles)
{
var path = _pathService.Normalize(Path.Combine(_options.TargetPath, dockerfile.Path));
_logger.Log(path);
_fileSystem.WriteLines(path, dockerfile.Lines.Select(i => i.Text));
}
var artifacts = graph.Value.Nodes.Select(i => i.Value).OfType<FileArtifact>();
foreach (var artifact in artifacts)
{
_logger.Log(artifact.Path);
_fileSystem.WriteLines(artifact.Path, artifact.Lines);
}
}
return Task.FromResult(graph.State);
}