Exemple #1
0
        public void Init(string workingDirectory)
        {
            var configFilePath       = configFileLocator.GetConfigFilePath(workingDirectory);
            var currentConfiguration = Provide(workingDirectory, false);

            var config = configInitWizard.Run(currentConfiguration, workingDirectory);

            if (config == null)
            {
                return;
            }

            using var stream = fileSystem.OpenWrite(configFilePath);
            using var writer = new StreamWriter(stream);
            log.Info("Saving config file");
            ConfigSerializer.Write(config, writer);
            stream.Flush();
        }
        public static void Init(string workingDirectory, IFileSystem fileSystem, IConsole console, ILog log, IConfigFileLocator configFileLocator)
        {
            var configFilePath       = configFileLocator.GetConfigFilePath(workingDirectory);
            var currentConfiguration = Provide(workingDirectory, applyDefaults: false, configFileLocator: configFileLocator);
            var config = new ConfigInitWizard(console, fileSystem, log).Run(currentConfiguration, workingDirectory);

            if (config == null)
            {
                return;
            }

            using (var stream = fileSystem.OpenWrite(configFilePath))
                using (var writer = new StreamWriter(stream))
                {
                    log.Info("Saving config file");
                    ConfigSerialiser.Write(config, writer);
                    stream.Flush();
                }
        }