|
@ -43,9 +43,17 @@ namespace DockerGenerator |
|
|
|
|
|
|
|
|
Console.WriteLine($"With fragments:"); |
|
|
Console.WriteLine($"With fragments:"); |
|
|
foreach (var fragment in Fragments) |
|
|
foreach (var fragment in Fragments) |
|
|
|
|
|
{ |
|
|
|
|
|
var fragmentPath = GetFragmentLocation(fragment); |
|
|
|
|
|
if (!File.Exists(fragmentPath)) |
|
|
|
|
|
{ |
|
|
|
|
|
Console.WriteLine($"\t{fragment} not found in {fragmentPath}, ignoring..."); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
{ |
|
|
{ |
|
|
Console.WriteLine($"\t{fragment}"); |
|
|
Console.WriteLine($"\t{fragment}"); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
var services = new List<KeyValuePair<YamlNode, YamlNode>>(); |
|
|
var services = new List<KeyValuePair<YamlNode, YamlNode>>(); |
|
|
var volumes = new List<KeyValuePair<YamlNode, YamlNode>>(); |
|
|
var volumes = new List<KeyValuePair<YamlNode, YamlNode>>(); |
|
|
|
|
|
|
|
@ -144,10 +152,15 @@ namespace DockerGenerator |
|
|
|
|
|
|
|
|
private YamlMappingNode ParseDocument(string fragment) |
|
|
private YamlMappingNode ParseDocument(string fragment) |
|
|
{ |
|
|
{ |
|
|
var input = new StringReader(File.ReadAllText(Path.Combine(FragmentLocation, $"{fragment}.yml"))); |
|
|
var input = new StringReader(File.ReadAllText(GetFragmentLocation(fragment))); |
|
|
YamlStream stream = new YamlStream(); |
|
|
YamlStream stream = new YamlStream(); |
|
|
stream.Load(input); |
|
|
stream.Load(input); |
|
|
return (YamlMappingNode)stream.Documents[0].RootNode; |
|
|
return (YamlMappingNode)stream.Documents[0].RootNode; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private string GetFragmentLocation(string fragment) |
|
|
|
|
|
{ |
|
|
|
|
|
return Path.Combine(FragmentLocation, $"{fragment}.yml"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|