public async Task<Manifest> Install(Manifest manifest, InstallablePackage entry, InstallSettings settings) { var relativePath = MakeRelative(manifest.FileName, settings.InstallDirectory); if (settings.SaveManifest) { var package = new ManifestPackage { Version = entry.Version, Path = relativePath }; // Only write "files" to the manifest if it's different from all files. if (entry.AllFiles.Count() != entry.Files.Count()) { package.Files = entry.Files; } manifest.Packages[entry.Name] = package; await manifest.Save(); } string cwd = new FileInfo(manifest.FileName).DirectoryName; OnInstalling(entry, settings.InstallDirectory); await CopyPackageContent(entry, settings); OnInstalled(entry, settings.InstallDirectory); return manifest; }
public async Task <ManifestPackage> UninstallAsync(Manifest manifest, string name, bool saveManifest) { var package = manifest.Packages.FirstOrDefault(p => p.Key == name).Value; if (package == null) { throw new PackageNotFoundException(name, null); } if (saveManifest) { manifest.Packages.Remove(name); await manifest.Save(); } string cwd = Path.GetDirectoryName(manifest.FileName); var installDir = Path.Combine(cwd, package.Path); var files = package.Files; // If no files are specified in the entry, then find all files from package if (files == null) { var installable = await Provider.GetInstallablePackageAsync(name, package.Version); if (installable != null) { files = installable.AllFiles; } } if (files != null) { foreach (string file in files) { string path = Path.Combine(installDir, file); File.Delete(path); } } return(package); }
public async Task <Manifest> Install(Manifest manifest, InstallablePackage entry, InstallSettings settings) { var relativePath = MakeRelative(manifest.FileName, settings.InstallDirectory); if (settings.SaveManifest) { var package = new ManifestPackage { Version = entry.Version, Path = relativePath }; // Only write "files" to the manifest if it's different from all files. if (entry.AllFiles.Count() != entry.Files.Count()) { package.Files = entry.Files; } manifest.Packages[entry.Name] = package; await manifest.Save(); } string cwd = new FileInfo(manifest.FileName).DirectoryName; OnInstalling(manifest, entry, settings.InstallDirectory); var copied = await CopyPackageContent(entry, settings); // Check if the files where already installed. Skip if they were if (copied) { OnInstalled(manifest, entry, settings.InstallDirectory); } return(manifest); }
public async Task<ManifestPackage> UninstallAsync(Manifest manifest, string name, bool saveManifest) { var package = manifest.Packages.FirstOrDefault(p => p.Key == name).Value; if (package == null) throw new PackageNotFoundException(name, null); if (saveManifest) { manifest.Packages.Remove(name); await manifest.Save(); } string cwd = Path.GetDirectoryName(manifest.FileName); var installDir = Path.Combine(cwd, package.Path); var files = package.Files; // If no files are specified in the entry, then find all files from package if (files == null) { var installable = await Provider.GetInstallablePackageAsync(name, package.Version); if (installable != null) files = installable.AllFiles; } if (files != null) { foreach (string file in files) { string path = Path.Combine(installDir, file); File.Delete(path); } } return package; }