Example #1
0
        private bool IsExtensionBinaryFile(Path path, string extensionName, ExtensionDeploymentOptions deploymentOptions)
        {
            bool isValidExtension = IsAssemblyFile(path);

            if (!isValidExtension)
            {
                return(false);
            }

            bool isAssemblyInWebAppBin = _knownBinAssemblies.Contains(path.FileNameWithoutExtension, StringComparer.OrdinalIgnoreCase);

            if (isAssemblyInWebAppBin)
            {
                return(false);
            }

            bool isExtensionAssembly   = IsOrchardExtensionFile(path);
            bool copyExtensionAssembly = (deploymentOptions & ExtensionDeploymentOptions.CompiledAssembly) == ExtensionDeploymentOptions.CompiledAssembly;

            if (isExtensionAssembly && !copyExtensionAssembly)
            {
                return(false);
            }

            return(true);
        }
Example #2
0
        public void CopyExtension(string extensionFolder, string extensionName, ExtensionDeploymentOptions deploymentOptions)
        {
            Log("Copy extension \"{0}\\{1}\" (options={2})", extensionFolder, extensionName, deploymentOptions);
            var sourceModule = _orchardWebPath.Combine(extensionFolder).Combine(extensionName);
            var targetModule = _tempSite.Combine(extensionFolder).Combine(extensionName);

            sourceModule.ShallowCopy("*.txt", targetModule);
            sourceModule.ShallowCopy("*.info", targetModule);

            if ((deploymentOptions & ExtensionDeploymentOptions.SourceCode) == ExtensionDeploymentOptions.SourceCode)
            {
                sourceModule.ShallowCopy("*.csproj", targetModule);
                sourceModule.DeepCopy("*.cs", targetModule);
            }

            if (sourceModule.Combine("bin").IsDirectory)
            {
                sourceModule.Combine("bin").ShallowCopy(path => IsExtensionBinaryFile(path, extensionName, deploymentOptions), targetModule.Combine("bin"));
            }

            if (sourceModule.Combine("Views").IsDirectory)
            {
                sourceModule.Combine("Views").DeepCopy(targetModule.Combine("Views"));
            }
        }
Example #3
0
 public void GivenIHaveChosenToLoadModulesUsingDynamicComilationOnly()
 {
     _moduleDeploymentOptions  = ExtensionDeploymentOptions.SourceCode;
     _dynamicCompilationOption = DynamicCompilationOption.Force;
 }
Example #4
0
 public void GivenIHaveChosenToDeployModulesAsSourceFilesOnly()
 {
     _moduleDeploymentOptions = ExtensionDeploymentOptions.SourceCode;
 }
Example #5
0
 public void GivenIHaveChosenToLoadModulesUsingDynamicComilationOnly() {
     _moduleDeploymentOptions = ExtensionDeploymentOptions.SourceCode;
     _dynamicCompilationOption = DynamicCompilationOption.Force;
 }
Example #6
0
 public void GivenIHaveChosenToDeployModulesAsSourceFilesOnly() {
     _moduleDeploymentOptions = ExtensionDeploymentOptions.SourceCode;
 }
        public void CopyExtensionAndRecipes(string extensionFolder, string extensionName, ExtensionDeploymentOptions deploymentOptions)
        {
            CopyExtension(extensionFolder, extensionName, deploymentOptions);

            var sourceModule = _orchardWebPath.Combine(extensionFolder).Combine(extensionName);
            var targetModule = _tempSite.Combine(extensionFolder).Combine(extensionName);

            sourceModule.ShallowCopy("*.recipe.xml", targetModule);

            if (sourceModule.Combine("Recipes").IsDirectory)
            {
                sourceModule.Combine("Recipes")
                .ShallowCopy("*.recipe.xml",
                             targetModule.Combine("Recipes"));
            }

            if (sourceModule.Combine("recipes").IsDirectory)
            {
                sourceModule.Combine("recipes")
                .ShallowCopy("*.recipe.xml",
                             targetModule.Combine("recipes"));
            }
        }