internal static byte[] CreateEwlNuGetPackage(DevelopmentInstallation installation, bool useDebugAssembly, string outputFolderPath, bool?prerelease)
        {
            var localExportDateAndTime = prerelease.HasValue ? null as DateTime? : DateTime.Now;

            IoMethods.ExecuteWithTempFolder(folderPath => {
                var ewlOutputFolderPath = StandardLibraryMethods.CombinePaths(installation.GeneralLogic.Path,
                                                                              "Standard Library",
                                                                              StandardLibraryMethods.GetProjectOutputFolderPath(useDebugAssembly));
                var libFolderPath = StandardLibraryMethods.CombinePaths(folderPath, @"lib\net451-full");
                foreach (var fileName in new[] { "dll", "pdb", "xml" }.Select(i => "EnterpriseWebLibrary." + i))
                {
                    IoMethods.CopyFile(StandardLibraryMethods.CombinePaths(ewlOutputFolderPath, fileName), StandardLibraryMethods.CombinePaths(libFolderPath, fileName));
                }

                IoMethods.CopyFile(StandardLibraryMethods.CombinePaths(installation.GeneralLogic.Path, @"Development Utility\Package Manager Console Commands.ps1"),
                                   StandardLibraryMethods.CombinePaths(folderPath, @"tools\init.ps1"));

                var webSitePath = StandardLibraryMethods.CombinePaths(installation.GeneralLogic.Path, "Web Site");
                var webProjectFilesFolderPath = StandardLibraryMethods.CombinePaths(folderPath, AppStatics.WebProjectFilesFolderName);
                IoMethods.CopyFolder(StandardLibraryMethods.CombinePaths(webSitePath, AppStatics.EwfFolderName),
                                     StandardLibraryMethods.CombinePaths(webProjectFilesFolderPath, AppStatics.EwfFolderName),
                                     false);
                IoMethods.CopyFile(StandardLibraryMethods.CombinePaths(webSitePath, AppStatics.StandardLibraryFilesFileName),
                                   StandardLibraryMethods.CombinePaths(webProjectFilesFolderPath, AppStatics.StandardLibraryFilesFileName));

                const string duProjectAndFolderName = "Development Utility";
                IoMethods.CopyFolder(
                    StandardLibraryMethods.CombinePaths(installation.GeneralLogic.Path,
                                                        duProjectAndFolderName,
                                                        StandardLibraryMethods.GetProjectOutputFolderPath(useDebugAssembly)),
                    StandardLibraryMethods.CombinePaths(folderPath, duProjectAndFolderName),
                    false);
                packageGeneralFiles(installation, folderPath, false);
                IoMethods.CopyFolder(
                    StandardLibraryMethods.CombinePaths(installation.ExistingInstallationLogic.RuntimeConfiguration.ConfigurationFolderPath,
                                                        InstallationConfiguration.InstallationConfigurationFolderName,
                                                        InstallationConfiguration.InstallationsFolderName,
                                                        (!prerelease.HasValue || prerelease.Value ? "Testing" : "Live")),
                    StandardLibraryMethods.CombinePaths(folderPath,
                                                        InstallationConfiguration.ConfigurationFolderName,
                                                        InstallationConfiguration.InstallationConfigurationFolderName),
                    false);

                var manifestPath = StandardLibraryMethods.CombinePaths(folderPath, "Package.nuspec");
                using (var writer = IoMethods.GetTextWriterForWrite(manifestPath))
                    writeNuGetPackageManifest(installation, prerelease, localExportDateAndTime, writer);

                StatusStatics.SetStatus(StandardLibraryMethods.RunProgram(StandardLibraryMethods.CombinePaths(installation.GeneralLogic.Path, @"Solution Files\nuget"),
                                                                          "pack \"" + manifestPath + "\" -OutputDirectory \"" + outputFolderPath + "\"",
                                                                          "",
                                                                          true));
            });

            return
                (File.ReadAllBytes(StandardLibraryMethods.CombinePaths(outputFolderPath,
                                                                       EwlNuGetPackageSpecificationStatics.GetNuGetPackageFileName(installation.ExistingInstallationLogic.RuntimeConfiguration.SystemShortName,
                                                                                                                                   installation.CurrentMajorVersion,
                                                                                                                                   !prerelease.HasValue || prerelease.Value ? installation.NextBuildNumber as int? : null,
                                                                                                                                   localExportDateAndTime: localExportDateAndTime))));
        }
Example #2
0
        private static void writeNuGetPackageManifest(DevelopmentInstallation installation, bool prerelease, DateTime localExportDateAndTime, TextWriter writer)
        {
            writer.WriteLine("<?xml version=\"1.0\"?>");
            writer.WriteLine("<package>");
            writer.WriteLine("<metadata>");
            writer.WriteLine(
                "<id>" + EwlNuGetPackageSpecificationStatics.GetNuGetPackageId(installation.ExistingInstallationLogic.RuntimeConfiguration.SystemShortName) + "</id>");
            writer.WriteLine(
                "<version>" + EwlNuGetPackageSpecificationStatics.GetNuGetPackageVersionString(prerelease, localExportDateAndTime: localExportDateAndTime) +
                "</version>");
            writer.WriteLine("<title>" + installation.ExistingInstallationLogic.RuntimeConfiguration.SystemName + "</title>");
            writer.WriteLine("<authors>William Gross, Greg Smalter, Sam Rueby</authors>");
            writer.WriteLine(
                "<description>The Enterprise Web Library (EWL) is an extremely opinionated library for web applications that trades off performance, scalability, and development flexibility for an ease of maintenance you won't find anywhere else.</description>");
            writer.WriteLine("<projectUrl>http://enterpriseweblibrary.org</projectUrl>");
            writer.WriteLine("<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>");
            writer.WriteLine("<requireLicenseAcceptance>false</requireLicenseAcceptance>");
            writer.WriteLine("<dependencies>");

            var lines = from line in File.ReadAllLines(StandardLibraryMethods.CombinePaths(installation.GeneralLogic.Path, @"Standard Library\packages.config"))
                        let trimmedLine = line.Trim()
                                          where trimmedLine.StartsWith("<package ")
                                          select trimmedLine;

            foreach (var line in lines)
            {
                writer.WriteLine(line.Replace("package", "dependency").Replace(" targetFramework=\"net451\"", ""));
            }

            writer.WriteLine("</dependencies>");
            writer.WriteLine("<tags>C# ASP.NET DAL SQL-Server MySQL Oracle</tags>");
            writer.WriteLine("</metadata>");
            writer.WriteLine("</package>");
        }
Example #3
0
 private static void writeNuGetPackageManifest(
     TextWriter writer, DevelopmentInstallation installation, string id, string projectName, Action <TextWriter> dependencyWriter, bool?prerelease,
     DateTime?localExportDateAndTime)
 {
     writer.WriteLine("<?xml version=\"1.0\"?>");
     writer.WriteLine("<package>");
     writer.WriteLine("<metadata>");
     writer.WriteLine("<id>" + id + "</id>");
     writer.WriteLine(
         "<version>" + EwlNuGetPackageSpecificationStatics.GetNuGetPackageVersionString(
             installation.CurrentMajorVersion,
             !prerelease.HasValue || prerelease.Value ? (int?)installation.NextBuildNumber : null,
             localExportDateAndTime: localExportDateAndTime) + "</version>");
     writer.WriteLine(
         "<title>" + installation.ExistingInstallationLogic.RuntimeConfiguration.SystemName + projectName.PrependDelimiter(" - ") + "</title>");
     writer.WriteLine("<authors>William Gross, Greg Smalter, Sam Rueby</authors>");
     writer.WriteLine(
         "<description>The {0} ({1}), together with its tailored infrastructure platform, is a highly opinionated foundation for web-based enterprise software.</description>"
         .FormatWith(EwlStatics.EwlName, EwlStatics.EwlInitialism));
     writer.WriteLine("<projectUrl>http://enterpriseweblibrary.org</projectUrl>");
     writer.WriteLine("<license type=\"expression\">MIT</license>");
     writer.WriteLine("<requireLicenseAcceptance>false</requireLicenseAcceptance>");
     writer.WriteLine("<dependencies>");
     dependencyWriter(writer);
     writer.WriteLine("</dependencies>");
     writer.WriteLine("<tags>C# ASP.NET DAL SQL-Server MySQL Oracle</tags>");
     writer.WriteLine("</metadata>");
     writer.WriteLine("</package>");
 }
        private static void writeNuGetPackageManifest(
            DevelopmentInstallation installation, PackagingConfiguration packagingConfiguration, bool?prerelease, DateTime?localExportDateAndTime,
            TextWriter writer)
        {
            writer.WriteLine("<?xml version=\"1.0\"?>");
            writer.WriteLine("<package>");
            writer.WriteLine("<metadata>");
            writer.WriteLine("<id>" + EwlNuGetPackageSpecificationStatics.GetNuGetPackageId(packagingConfiguration.SystemShortName) + "</id>");
            writer.WriteLine(
                "<version>" + EwlNuGetPackageSpecificationStatics.GetNuGetPackageVersionString(
                    installation.CurrentMajorVersion,
                    !prerelease.HasValue || prerelease.Value ? installation.NextBuildNumber as int? : null,
                    localExportDateAndTime: localExportDateAndTime) + "</version>");
            writer.WriteLine("<title>" + installation.ExistingInstallationLogic.RuntimeConfiguration.SystemName + "</title>");
            writer.WriteLine("<authors>William Gross, Greg Smalter, Sam Rueby</authors>");
            writer.WriteLine(
                "<description>The {0} ({1}), and its tailored infrastructure platform, are a complete and open solution for developing and operating web-based enterprise software.</description>"
                .FormatWith(EwlStatics.EwlName, EwlStatics.EwlInitialism));
            writer.WriteLine("<projectUrl>http://enterpriseweblibrary.org</projectUrl>");
            writer.WriteLine("<licenseUrl>http://enterpriseweblibrary.org/license</licenseUrl>");
            writer.WriteLine("<requireLicenseAcceptance>false</requireLicenseAcceptance>");
            writer.WriteLine("<dependencies>");

            var lines = from line in File.ReadAllLines(EwlStatics.CombinePaths(installation.GeneralLogic.Path, AppStatics.CoreProjectName, "packages.config"))
                        let trimmedLine = line.Trim()
                                          where trimmedLine.StartsWith("<package ")
                                          select trimmedLine;

            foreach (var line in lines)
            {
                writer.WriteLine(Regex.Replace(line.Replace("package", "dependency"), @" targetFramework=""[\w]+""", ""));
            }

            writer.WriteLine("</dependencies>");
            writer.WriteLine("<tags>C# ASP.NET DAL SQL-Server MySQL Oracle</tags>");
            writer.WriteLine("</metadata>");
            writer.WriteLine("</package>");
        }
Example #5
0
        internal static IReadOnlyCollection <(string id, IReadOnlyList <byte[]> packages)> CreateEwlNuGetPackages(
            DevelopmentInstallation installation, PackagingConfiguration packagingConfiguration, bool useDebugAssembly, string outputFolderPath,
            IEnumerable <bool?> prereleaseValues)
        {
            var now      = DateTime.Now;
            var packages = new List <(string, IReadOnlyList <byte[]>)>();

            var mainId       = packagingConfiguration.SystemShortName;
            var mainPackages = prereleaseValues.Select(
                prerelease => {
                var localExportDateAndTime = prerelease.HasValue ? (DateTime?)null : now;

                IoMethods.ExecuteWithTempFolder(
                    folderPath => {
                    var ewlOutputFolderPath = EwlStatics.CombinePaths(
                        installation.GeneralLogic.Path,
                        EwlStatics.CoreProjectName,
                        EwlStatics.GetProjectOutputFolderPath(useDebugAssembly));
                    var libFolderPath = EwlStatics.CombinePaths(folderPath, @"lib\net472-full");
                    foreach (var fileName in new[] { "dll", "pdb", "xml" }.Select(i => "EnterpriseWebLibrary." + i))
                    {
                        IoMethods.CopyFile(EwlStatics.CombinePaths(ewlOutputFolderPath, fileName), EwlStatics.CombinePaths(libFolderPath, fileName));
                    }

                    IoMethods.CopyFile(
                        EwlStatics.CombinePaths(installation.GeneralLogic.Path, @"Development Utility\Package Manager Console Commands.ps1"),
                        EwlStatics.CombinePaths(folderPath, @"tools\init.ps1"));

                    IoMethods.CopyFolder(
                        EwlStatics.CombinePaths(installation.GeneralLogic.Path, EwlStatics.CoreProjectName, StaticFile.FrameworkStaticFilesSourceFolderPath),
                        EwlStatics.CombinePaths(folderPath, InstallationFileStatics.WebFrameworkStaticFilesFolderName),
                        false);
                    IoMethods.DeleteFolder(
                        EwlStatics.CombinePaths(folderPath, InstallationFileStatics.WebFrameworkStaticFilesFolderName, AppStatics.StaticFileLogicFolderName));

                    const string duProjectAndFolderName = "Development Utility";
                    IoMethods.CopyFolder(
                        EwlStatics.CombinePaths(installation.GeneralLogic.Path, duProjectAndFolderName, EwlStatics.GetProjectOutputFolderPath(useDebugAssembly)),
                        EwlStatics.CombinePaths(folderPath, duProjectAndFolderName),
                        false);
                    packageGeneralFiles(installation, folderPath, false);
                    IoMethods.CopyFolder(
                        EwlStatics.CombinePaths(
                            installation.ExistingInstallationLogic.RuntimeConfiguration.ConfigurationFolderPath,
                            InstallationConfiguration.InstallationConfigurationFolderName,
                            InstallationConfiguration.InstallationsFolderName,
                            !prerelease.HasValue || prerelease.Value ? "Testing" : "Live"),
                        EwlStatics.CombinePaths(
                            folderPath,
                            InstallationConfiguration.ConfigurationFolderName,
                            InstallationConfiguration.InstallationConfigurationFolderName),
                        false);
                    if (File.Exists(installation.ExistingInstallationLogic.RuntimeConfiguration.InstallationSharedConfigurationFilePath))
                    {
                        IoMethods.CopyFile(
                            installation.ExistingInstallationLogic.RuntimeConfiguration.InstallationSharedConfigurationFilePath,
                            EwlStatics.CombinePaths(
                                folderPath,
                                InstallationConfiguration.ConfigurationFolderName,
                                InstallationConfiguration.InstallationConfigurationFolderName,
                                InstallationConfiguration.InstallationSharedConfigurationFileName));
                    }

                    var manifestPath = EwlStatics.CombinePaths(folderPath, "Package.nuspec");
                    using (var writer = IoMethods.GetTextWriterForWrite(manifestPath))
                        writeNuGetPackageManifest(
                            writer,
                            installation,
                            mainId,
                            "",
                            w => {
                            var lines = from line in File.ReadAllLines(
                                EwlStatics.CombinePaths(installation.GeneralLogic.Path, EwlStatics.CoreProjectName, "packages.config"))
                                        let trimmedLine = line.Trim()
                                                          where trimmedLine.StartsWith("<package ")
                                                          select trimmedLine;
                            foreach (var line in lines)
                            {
                                w.WriteLine(Regex.Replace(line.Replace("package", "dependency"), @" targetFramework=""[\w]+""", ""));
                            }
                        },
                            prerelease,
                            localExportDateAndTime);

                    StatusStatics.SetStatus(
                        TewlContrib.ProcessTools.RunProgram(
                            EwlStatics.CombinePaths(installation.GeneralLogic.Path, @"Solution Files\nuget"),
                            "pack \"" + manifestPath + "\" -OutputDirectory \"" + outputFolderPath + "\"",
                            "",
                            true));
                });

                return(File.ReadAllBytes(
                           EwlStatics.CombinePaths(
                               outputFolderPath,
                               EwlNuGetPackageSpecificationStatics.GetNuGetPackageFileName(
                                   mainId,
                                   installation.CurrentMajorVersion,
                                   !prerelease.HasValue || prerelease.Value ? installation.NextBuildNumber as int? : null,
                                   localExportDateAndTime: localExportDateAndTime))));
            })
                               .MaterializeAsList();

            packages.Add((mainId, mainPackages));

            var samlId       = mainId + ".Saml";
            var samlPackages = prereleaseValues.Select(
                prerelease => {
                var localExportDateAndTime = prerelease.HasValue ? (DateTime?)null : now;

                IoMethods.ExecuteWithTempFolder(
                    folderPath => {
                    foreach (var fileName in new[] { "dll", "pdb" }.Select(i => "EnterpriseWebLibrary.Saml." + i))
                    {
                        IoMethods.CopyFile(
                            EwlStatics.CombinePaths(
                                installation.GeneralLogic.Path,
                                EwlStatics.SamlProviderProjectPath,
                                EwlStatics.GetProjectOutputFolderPath(useDebugAssembly),
                                fileName),
                            EwlStatics.CombinePaths(folderPath, @"lib\net472-full", fileName));
                    }

                    var manifestPath = EwlStatics.CombinePaths(folderPath, "Package.nuspec");
                    using (var writer = IoMethods.GetTextWriterForWrite(manifestPath))
                        writeNuGetPackageManifest(
                            writer,
                            installation,
                            samlId,
                            "SAML Provider",
                            w => {
                            w.WriteLine(
                                "<dependency id=\"{0}\" version=\"[{1}]\" />".FormatWith(
                                    mainId,
                                    EwlNuGetPackageSpecificationStatics.GetNuGetPackageVersionString(
                                        installation.CurrentMajorVersion,
                                        !prerelease.HasValue || prerelease.Value ? (int?)installation.NextBuildNumber : null,
                                        localExportDateAndTime: localExportDateAndTime)));
                            w.WriteLine("<dependency id=\"ComponentSpace.Saml2.Net.Licensed\" version=\"5.0.0\" />");
                        },
                            prerelease,
                            localExportDateAndTime);

                    StatusStatics.SetStatus(
                        TewlContrib.ProcessTools.RunProgram(
                            EwlStatics.CombinePaths(installation.GeneralLogic.Path, @"Solution Files\nuget"),
                            "pack \"" + manifestPath + "\" -OutputDirectory \"" + outputFolderPath + "\"",
                            "",
                            true));
                });

                return(File.ReadAllBytes(
                           EwlStatics.CombinePaths(
                               outputFolderPath,
                               EwlNuGetPackageSpecificationStatics.GetNuGetPackageFileName(
                                   samlId,
                                   installation.CurrentMajorVersion,
                                   !prerelease.HasValue || prerelease.Value ? installation.NextBuildNumber as int? : null,
                                   localExportDateAndTime: localExportDateAndTime))));
            })
                               .MaterializeAsList();

            packages.Add((samlId, samlPackages));

            return(packages);
        }