Permalink
Browse files

generate nuspec and nupkg files

  • Loading branch information...
1 parent 41c0a91 commit 6d60cd7726f4b2c37dd311d082dd51286526df08 @bvanderveen bvanderveen committed May 2, 2012
Showing with 50 additions and 27 deletions.
  1. +3 −27 Sakefile.shade
  2. +28 −0 tools/sake/_update-nuspec.shade
  3. +19 −0 tools/sake/_update-xml.shade
View
@@ -48,33 +48,9 @@ use import="Files"
-File.Copy(OUTPUT_DIR + "/" + file, BIN_DIR + "/" + file, true);
#dist_nuget .binaries .build
- @{/*
- if is_nix()
- puts "Not running on Windows, skipping NuGet package creation."
- else
- input_nuspec = "Kayak.nuspec"
- output_nuspec = "#{BUILD_DIR}/Kayak.nuspec"
-
- transform_xml input_nuspec, output_nuspec do |x|
- x.root.elements["metadata/id"].text = PRODUCT
- x.root.elements["metadata/version"].text = VERSION
- x.root.elements["metadata/authors"].text = AUTHORS
- x.root.elements["metadata/owners"].text = AUTHORS
- x.root.elements["metadata/description"].text = DESCRIPTION
- x.root.elements["metadata/licenseUrl"].text = LICENSE_URL
- x.root.elements["metadata/projectUrl"].text = PROJECT_URL
- x.root.elements["metadata/tags"].text = "http io socket network async"
- end
-
- nuget = NuGetPack.new
- nuget.command = "tools/NuGet.exe"
- nuget.nuspec = output_nuspec
- nuget.output = BUILD_DIR
- #using base_folder throws as there are two options that begin with b in nuget 1.4
- nuget.parameters = "-Symbols"
- nuget.execute
- end
- */}
+ update-nuspec inputFile="Kayak.nuspec" outputFile="${BUILD_DIR}/Kayak.nuspec" id="${PRODUCT}" version="${VERSION}" authors="${AUTHORS}" description="${DESCRIPTION}" licenseUrl="${LICENSE_URL}" projectUrl="${PROJECT_URL}" tags="http io socket network async"
+
+ nuget-pack nuspecFile="${BUILD_DIR}/Kayak.nuspec" workingDir="${BUILD_DIR}" extra="-Symbols"
#dist_zip .build .binaries
@{/*
@@ -0,0 +1,28 @@
+
+default nuspec_path=''
+default id=''
+default version=''
+default authors=''
+default owners='${authors}'
+default description=''
+default licenseUrl=''
+default projectUrl=''
+default tags=''
+
+
+update-xml filename="${nuspec_path}"
+ @{
+ var metadata = doc["package"]["metadata"];
+ Action<string, string> setMetadata = (k, v) => {
+ metadata[k].InnerText = v;
+ };
+
+ setMetadata("id", id);
+ setMetadata("version", version);
+ setMetadata("authors", authors);
+ setMetadata("owners", owners);
+ setMetadata("description", description);
+ setMetadata("licenseUrl", licenseUrl);
+ setMetadata("projectUrl", projectUrl);
+ setMetadata("tags", tags);
+ }
@@ -0,0 +1,19 @@
+use namespace='System.Xml'
+use namespace='System.IO'
+
+default inputFile=''
+default outputFile=''
+
+@{
+ if (string.IsNullOrWhiteSpace(inputFile) || string.IsNullOrWhiteSpace(outputFile))
+ return;
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml(File.ReadAllText(inputFile));
+}
+render
+log info="writing ${outputFile}"
+@{
+ XmlTextWriter writer = new XmlTextWriter(outputFile, null);
+ writer.Formatting = Formatting.Indented;
+ doc.Save(writer);
+}

0 comments on commit 6d60cd7

Please sign in to comment.