Example #1
0
        private static void CreateNuspec(
            string id,
            Version version,
            string description,
            IEnumerable <File> fileList,
            IEnumerable <Dependency> dependencyList,
            IEnumerable <string> tags)
        {
            var nuspec =
                N("package").Append(
                    N("metadata").Append(
                        N("id", id),
                        N("version", version.ToString()),
                        N("authors", Config.Authors),
                        N("owners", Config.Owners),
                        N("licenseUrl", "https://github.com/sergey-shandar/getboost/blob/master/LICENSE"),
                        N("projectUrl", "https://github.com/sergey-shandar/getboost"),
                        N("requireLicenseAcceptance", "false"),
                        N("description", description),
                        N("dependencies").Append(
                            dependencyList.Select(
                                d =>
                                N(
                                    "dependency",
                                    Xml.A("id", d.Id),
                                    Xml.A("version", d.Version)
                                    )
                                )
                            ),
                        N("tags", string.Join(" ", tags))
                        ),
                    N("files").Append(fileList.Select(f => f.N))
                    );
            var nuspecFile = id + ".nuspec";

            nuspec.CreateDocument().Save(nuspecFile);
            Process.Start(
                new ProcessStartInfo(
                    @"..\..\..\packages\NuGet.CommandLine.2.8.3\tools\nuget.exe",
                    "pack " + nuspecFile)
            {
                UseShellExecute = false,
            }).WaitForExit();
        }
Example #2
0
        public static string Create(
            string nuspecId,
            string packageId,
            IEnumerable <ItemDefinitionGroup> itemDefinitionGroupList,
            IEnumerable <CompilationUnit> compilationUnitList)
        {
            var srcPath       = PathFromThis(SrcPath);
            var clCompileList =
                compilationUnitList.
                Select(u => u.ClCompile(packageId, srcPath).X);
            var targetsFile = nuspecId + ".targets";
            var targets     =
                M("Project", Xml.A("ToolVersion", "4.0")).
                Append(itemDefinitionGroupList.Select(g => g.X)).
                Append(M("ItemGroup").Append(clCompileList)
                       );

            targets.CreateDocument().Save(targetsFile);
            return(targetsFile);
        }
Example #3
0
        private static void CreateNuspec(
            string id,
            Version version,
            string description,
            IEnumerable <File> fileList,
            IEnumerable <Dependency> dependencyList,
            IEnumerable <string> tags)
        {
            var nuspec =
                N("package").Append(
                    N("metadata").Append(
                        N("id", id),
                        N("version", version.ToString()),
                        N("authors", Config.Authors),
                        N("owners", Config.Owners),
                        N("licenseUrl", "https://github.com/sergey-shandar/getboost/blob/master/LICENSE"),
                        N("projectUrl", "https://github.com/sergey-shandar/getboost"),
                        N("requireLicenseAcceptance", "false"),
                        N("description", description),
                        N("dependencies").Append(
                            dependencyList.Select(
                                d =>
                                N(
                                    "dependency",
                                    Xml.A("id", d.Id),
                                    Xml.A("version", d.Version)
                                    )
                                )
                            ),
                        N("tags", string.Join(" ", tags))
                        ),
                    N("files").Append(fileList.Select(f => f.N))
                    );
            var nuspecFile = id + ".nuspec";

            nuspec.CreateDocument().Save(nuspecFile);
            Process.Start(
                new ProcessStartInfo(
                    @"..\..\..\packages\NuGet.CommandLine.5.10.0\tools\nuget.exe",
                    "pack " + nuspecFile)
            {
                UseShellExecute = false,
            }).WaitForExit();
            var nupkgFile = id + "." + version + ".nupkg";

            Console.WriteLine("uploading: " + nupkgFile);
            {
                var p = Process.Start(
                    new ProcessStartInfo(
                        @"..\..\..\packages\NuGet.CommandLine.5.10.0\tools\nuget.exe",
                        "push " + nupkgFile + " -Source https://api.nuget.org/v3/index.json -ApiKey _")
                {
                    UseShellExecute = false,
                });
                p.WaitForExit();
                if (p.ExitCode != 0)
                {
                    Environment.Exit(p.ExitCode);
                }
            }
        }