public void SaveConfig(DeploydConfiguration deploydConfiguration)
 {
     using (var file = _fileSystem.File.Open(_filePath, FileMode.Create, FileAccess.Write))
         using (var streamWriter = new StreamWriter(file))
         {
             streamWriter.Write(JsonConvert.SerializeObject(deploydConfiguration));
             streamWriter.Flush();
             streamWriter.Close();
         }
 }
        public AppExtractionCommand(IFileSystem fs, IEnumerable<IPackageExtractor> extractors, DeploydConfiguration deploydConfiguration, IInstanceConfiguration config, ILog log)
        {
            _fs = fs;
            _log = log;
            _extractors = extractors.ToList();
            _deploydConfiguration = deploydConfiguration;
            _config = config;

            var installRoot = deploydConfiguration.InstallRoot.ToAbsolutePath();
            _fs.EnsureDirectoryExists(installRoot);
        }
        public DeploydConfiguration LoadConfig()
        {
            if (!_fileSystem.File.Exists(_filePath))
            {
                var configuration = new DeploydConfiguration();
                using (var file = _fileSystem.File.Open(_filePath, FileMode.Create, FileAccess.Write))
                    using (var streamWriter = new StreamWriter(file))
                    {
                        configuration.PackageType   = PackageType.NuGet;
                        configuration.PackageSource = @"c:\path\to\packages";
                        configuration.InstallRoot   = @"c:\where\to\install\packages\to";
                        streamWriter.Write(JsonConvert.SerializeObject(configuration));
                        streamWriter.Flush();
                        streamWriter.Close();
                    }
            }

            var configFileContents = _fileSystem.File.ReadAllText(_filePath);

            return(JsonConvert.DeserializeObject <DeploydConfiguration>(configFileContents));
        }
 public void SetUp()
 {
     _config = new DeploydConfiguration {PackageSource = string.Empty};
     _log = new Mock<ILog>();
     _fs = new Mock<IFileSystem>();
     _packageList = new List<string>();
     _fs.Setup(x => x.Directory.GetFiles(It.IsAny<string>(), It.IsAny<string>(), SearchOption.AllDirectories))
        .Returns(_packageList.ToArray);
     _locator = new FileSystemAppInstallationLocator(_config, _fs.Object, _log.Object);
 }
 public void SetUp()
 {
     _config = new DeploydConfiguration {PackageSource = string.Empty};
     _fs = new Mock<IFileSystem>();
     _packageQuery = new Mock<IGetLatestNuGetPackageByNameQuery>();
 }
 public InstallationRoot(DeploydConfiguration deploydConfiguration, IFileSystem fs)
 {
     _fs = fs;
     Path = deploydConfiguration.InstallRoot;
     _absolutePath = Path.ToAbsolutePath();
 }