Exemple #1
0
        /// <summary>
        /// Replaces %FOO% environment variable references and translates the (back-)slashes to the platform's preferred form.
        /// </summary>
        private static string PrepareConfigPath(string input)
        {
            input = ExpandEnvVars(input);

            // canonicalize slashiness in paths from the configuration
            if (!string.IsNullOrEmpty(input))
            {
                input = PathX.Combine(input.Split('\\', '/'));
            }

            return(input);
        }
Exemple #2
0
        /// <summary>
        /// Copy from envConfig.BinarySource to envConfig.TestsTarget
        /// </summary>
        /// <param name="envConfig"></param>
        private static void InstallTestsBinaries(EnvConfig envConfig)
        {
            LogTitle("Installing Tests Binaries");

            // if source is empty or source and target are the same, binaries do not have to be copied
            if (!string.IsNullOrEmpty(envConfig.TestsTarget) && !string.IsNullOrEmpty(envConfig.BinarySource) && envConfig.BinarySource != envConfig.TestsTarget)
            {
                var sourcePaths = ExpandPath(envConfig.BinarySource);
                var isWildcard  = sourcePaths.Count() > 1;

                foreach (var source in sourcePaths)
                {
                    LogAction("copying Binaries from " + source);
                    if (isWildcard && !Directory.Exists(source))
                    {
                        continue;
                    }

                    CopyFolder(source, envConfig.TestsTarget, "*.dll", CopyMode.Flat); // does not handle sattelite assemblies
                    CopyFolder(source, envConfig.TestsTarget, "*.dll.config", CopyMode.Flat);
                    CopyFolder(source, envConfig.TestsTarget, "*.pdb", CopyMode.Flat);
                    CopyFolder(source, envConfig.TestsTarget, "*.mdb", CopyMode.Flat);
                }

                // Replace fallback binaries when generated ones are available
                foreach (var generatedSource in new[] { PathX.Combine(envConfig.BinarySource, "Common", "Core.Generated"),
                                                        PathX.Combine(envConfig.BinarySource, "Client", "Core.Generated"),
                                                        PathX.Combine(envConfig.BinarySource, "Server", "EF.Generated"),
                                                        PathX.Combine(envConfig.BinarySource, "Server", "NH.Generated") })
                {
                    var generatedSourcePaths = ExpandPath(generatedSource);

                    foreach (var path in generatedSourcePaths)
                    {
                        LogDetail("looking at [{0}]", path);
                        if (Directory.Exists(path))
                        {
                            LogDetail("found");
                            CopyTopFiles(path, envConfig.TestsTarget);
                        }
                        else
                        {
                            LogDetail("not found");
                        }
                    }
                }
                ReplaceNpgsql(envConfig.BinarySource, envConfig.TestsTarget);
            }
        }
Exemple #3
0
        /// <summary>
        /// Copy from envConfig.BinarySource to envConfig.BinaryTarget; fetch files from Modules\ and Data\
        /// </summary>
        /// <param name="envConfig"></param>
        private static void InstallBinaries(EnvConfig envConfig)
        {
            LogTitle("Installing Binaries");

            // if source is empty or source and target are the same, binaries do not have to be copied
            if (!string.IsNullOrEmpty(envConfig.BinarySource) && !string.IsNullOrEmpty(envConfig.BinaryTarget) && envConfig.BinarySource != envConfig.BinaryTarget)
            {
                var sourcePaths = ExpandPath(envConfig.BinarySource);
                var isWildcard  = sourcePaths.Count() > 1;

                foreach (var source in sourcePaths)
                {
                    LogAction("copying Binaries from " + source);
                    if (isWildcard && !Directory.Exists(source))
                    {
                        continue;
                    }

                    CopyFolder(source, envConfig.BinaryTarget);

                    var bootstrapperSource = Path.Combine(source, "Bootstrapper");
                    if (Directory.Exists(bootstrapperSource))
                    {
                        // Bootstrapper has to be available in the web root
                        CopyFolder(bootstrapperSource, PathX.Combine(envConfig.BinaryTarget, "HttpService", "Bootstrapper"));
                    }
                }

                var moduleTarget = Path.Combine(envConfig.BinaryTarget, "Modules");
                if (Directory.Exists("Modules"))
                {
                    LogAction("copying Modules");
                    CopyFolder("Modules", moduleTarget);
                }

                var dataTarget = Path.Combine(envConfig.BinaryTarget, "Data");
                if (Directory.Exists("Data"))
                {
                    LogAction("copying Data");
                    CopyFolder("Data", dataTarget);
                }

                ReplaceNpgsql(envConfig.BinarySource, envConfig.BinaryTarget);
            }
        }
Exemple #4
0
        private static void ReplaceNpgsql(string sourcePath, string targetPath)
        {
            var httpServiceExists = Directory.Exists(PathX.Combine(targetPath, "HttpService", "bin"));
            var npgsqlMonoSource  = ExpandPath(PathX.Combine(sourcePath, "Server", "Npgsql.Mono")).FirstOrDefault(p => Directory.Exists(p));
            var npgsqlMsSource    = ExpandPath(PathX.Combine(sourcePath, "Server", "Npgsql.Microsoft")).FirstOrDefault(p => Directory.Exists(p));

            LogAction("deploying Npgsql");
            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Unix:
                if (string.IsNullOrEmpty(npgsqlMonoSource))
                {
                    LogAction(string.Format("Missing source path for Mono Npgsql: {0}/Server/Npgsql.Mono", sourcePath));
                    return;
                }
                Copy(
                    Path.Combine(npgsqlMonoSource, "Npgsql.dll"),
                    Path.Combine(targetPath, "Npgsql.dll"),
                    true);
                // installed in mono's GAC
                Delete(Path.Combine(targetPath, "Mono.Security.dll"));

                if (httpServiceExists)
                {
                    Copy(
                        Path.Combine(npgsqlMonoSource, "Npgsql.dll"),
                        PathX.Combine(targetPath, "HttpService", "bin", "Npgsql.dll"),
                        true);
                    // installed in mono's GAC
                    Delete(PathX.Combine(targetPath, "HttpService", "bin", "Mono.Security.dll"));
                }
                break;

            case PlatformID.Win32NT:
                if (string.IsNullOrEmpty(npgsqlMonoSource))
                {
                    LogAction(string.Format("Missing source path for MS Npgsql: {0}\\Server\\Npgsql.Microsoft", sourcePath));
                    return;
                }
                Copy(
                    Path.Combine(npgsqlMsSource, "Npgsql.dll"),
                    Path.Combine(targetPath, "Npgsql.dll"),
                    true);
                Copy(
                    Path.Combine(npgsqlMsSource, "Mono.Security.dll"),
                    Path.Combine(targetPath, "Mono.Security.dll"),
                    true);
                if (httpServiceExists)
                {
                    Copy(
                        Path.Combine(npgsqlMsSource, "Npgsql.dll"),
                        PathX.Combine(targetPath, "HttpService", "bin", "Npgsql.dll"),
                        true);
                    Copy(
                        Path.Combine(npgsqlMsSource, "Mono.Security.dll"),
                        PathX.Combine(targetPath, "HttpService", "bin", "Mono.Security.dll"),
                        true);
                }
                break;

            default:
                LogAction("Unknown platform '{0}'", Environment.OSVersion.Platform);
                return;
            }
        }