Ejemplo n.º 1
0
        public void Execute(DeploymentTaskContext context)
        {
            dynamic hostConfig = new ExpandoObject();

            foreach (var folder in context.GetValue <SpecialFolder[]>(DeploymentTaskContext.Folders))
            {
                ((IDictionary <string, object>)hostConfig)[folder.Purpose] = folder.FullPath;
            }

            var hostConfigString = JsonConvert.SerializeObject(hostConfig, Formatting.Indented);

            context.BuildLog.WriteLine("Generated host config");
            context.BuildLog.WriteLine(hostConfigString);

            WriteConfig(context.BuildLog, hostConfigString);
        }
Ejemplo n.º 2
0
        public void Execute(DeploymentTaskContext context)
        {
            var folders = context.GetValue <SpecialFolder[]>(DeploymentTaskContext.Folders);

            foreach (var specialFolder in folders)
            {
                if (Folder.Exists(specialFolder.FullPath))
                {
                    context.BuildLog.WriteLine($"Folder '{specialFolder.Purpose}'-'{specialFolder.FullPath}' exists");
                    continue;
                }

                Folder.EnsureExists(specialFolder.FullPath);

                context.BuildLog.WriteLine($"Folder '{specialFolder.Purpose}'-'{specialFolder.FullPath}' was created");
            }
        }
Ejemplo n.º 3
0
        public void Execute(DeploymentTaskContext context)
        {
            string config;

            if (!context.TryGetValue <string>(DeploymentTaskContext.Config, out config) || string.IsNullOrWhiteSpace(config))
            {
                context.BuildLog.WriteLine("Service config is not provided or empty. Operation Skipped.");
                return;
            }

            context.BuildLog.WriteLine("Found service config:");
            context.BuildLog.WriteLine(config);

            var configFolder = context
                               .GetValue <SpecialFolder[]>(DeploymentTaskContext.Folders)
                               .Single(x => x.Purpose == SpecialFolderDictionary.Configs);

            var configPath = Path.Combine(configFolder.FullPath, "config.json");

            context.BuildLog.WriteLine("Write service config to '{0}'", configPath);
            File.WriteAllText(configPath, config);
            context.BuildLog.WriteLine("Config was successfully written");
        }