public void Push(NPackageDescriptor desc) { if (desc.SpecPath != null) { exec("push \"" + desc.PackagePath + "\"" + " " + apiKey ?? ""); } //We don't push the symbols, those are pushed automatically. //if (desc.SymbolSpecPath != null)exec("push \"" + desc.SymbolPackagePath + "\""); }
public static IList <NPackageDescriptor> GetPackagesIn(string dir) { string nuspecExt = ".nuspec"; string symbolsExt = ".symbols"; Dictionary <string, NPackageDescriptor> byName = new Dictionary <string, NPackageDescriptor>(StringComparer.OrdinalIgnoreCase); List <NPackageDescriptor> packages = new List <NPackageDescriptor>(); string[] files = Directory.GetFiles(dir, "*" + nuspecExt); foreach (string s in files) { //Strip the _specPath string fname = System.IO.Path.GetFileName(s); //Ignore all files that start with ".". if (fname.StartsWith(".")) { continue; } //Strip nuspec extension if (fname.EndsWith(nuspecExt, StringComparison.OrdinalIgnoreCase)) { fname = fname.Substring(0, fname.Length - nuspecExt.Length); } //Is it a symbol? bool isSymbol = fname.EndsWith(symbolsExt, StringComparison.OrdinalIgnoreCase); //Strip symbol extension if (fname.EndsWith(symbolsExt, StringComparison.OrdinalIgnoreCase)) { fname = fname.Substring(0, fname.Length - symbolsExt.Length); } //Look it up, add if missing NPackageDescriptor desc = null; if (!byName.TryGetValue(fname, out desc)) { desc = new NPackageDescriptor(); packages.Add(desc); desc.BaseName = fname; byName[fname] = desc; } //Set the appropriate value on the package. if (isSymbol) { desc.SymbolSpecPath = s; } else { desc.SpecPath = s; } } return(packages); }
public void Pack(NPackageDescriptor desc) { //11 - Pack and upload nuget packages //Pack symbols first, then rename them. if (desc.SymbolSpecPath != null) { pack(desc, desc.SymbolSpecPath, desc.VariableSubstitutions); //nuget.exe has a bug - the symbol package is build using the Name.nupkg instead of Name.symbols.nupkg format. //So we copy it, then overwrite it with the main package. if (File.Exists(desc.PackagePath)) { File.Copy(desc.PackagePath, desc.SymbolPackagePath, true); } } if (desc.SpecPath != null) { pack(desc, desc.SpecPath, desc.VariableSubstitutions); } }
public void pack(NPackageDescriptor desc, string spec, NameValueCollection variables) { string oldText = File.ReadAllText(spec); string newText = oldText; foreach (string key in variables.Keys) { newText = newText.Replace("$" + key + "$", variables[key]); } DateTime lastMod = File.GetLastWriteTimeUtc(spec); //Grab modified date File.WriteAllText(spec, newText, Encoding.UTF8); //Set version value string arguments = "pack " + Path.GetFileName(spec) + " -Version " + desc.Version; arguments += " -OutputDirectory " + desc.OutputDirectory; exec(arguments); File.WriteAllText(spec, oldText, Encoding.UTF8); //restore file File.SetLastWriteTimeUtc(spec, lastMod); //Restore modified date }
public static IList<NPackageDescriptor> GetPackagesIn(string dir) { string nuspecExt = ".nuspec"; string symbolsExt = ".symbols"; Dictionary<string, NPackageDescriptor> byName = new Dictionary<string, NPackageDescriptor>(StringComparer.OrdinalIgnoreCase); List<NPackageDescriptor> packages = new List<NPackageDescriptor>(); string[] files = Directory.GetFiles(dir, "*" + nuspecExt); foreach (string s in files) { //Strip the _specPath string fname = System.IO.Path.GetFileName(s); //Ignore all files that start with ".". if (fname.StartsWith(".")) continue; //Strip nuspec extension if (fname.EndsWith(nuspecExt, StringComparison.OrdinalIgnoreCase)) fname = fname.Substring(0, fname.Length - nuspecExt.Length); //Is it a symbol? bool isSymbol = fname.EndsWith(symbolsExt, StringComparison.OrdinalIgnoreCase); //Strip symbol extension if (fname.EndsWith(symbolsExt, StringComparison.OrdinalIgnoreCase)) fname = fname.Substring(0, fname.Length - symbolsExt.Length); //Look it up, add if missing NPackageDescriptor desc = null; if (!byName.TryGetValue(fname, out desc)) { desc = new NPackageDescriptor(); packages.Add(desc); desc.BaseName = fname; byName[fname] = desc; } //Set the appropriate value on the package. if (isSymbol) desc.SymbolSpecPath = s; else desc.SpecPath = s; } return packages; }