Skip to content

Commit

Permalink
Merge pull request #67 from Sitecore/master
Browse files Browse the repository at this point in the history
merge Master 9.0.2.3 to release/9.0.2
  • Loading branch information
jeanfrancoislarente authored Oct 18, 2018
2 parents ce9bce3 + 7abab7a commit b170377
Show file tree
Hide file tree
Showing 47 changed files with 1,080 additions and 5,825 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ packages/
*.log
license.xml
lib/Modules/*
lib/Support/*
*.dll
*sc-internal*
publishTemp/

tools/*
!tools/packages.config
cake-config.user.json
116 changes: 116 additions & 0 deletions CakeScripts/helper-methods.cake
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
using System.Text.RegularExpressions;

/*===============================================
================= HELPER METHODS ================
===============================================*/

public class Configuration
{
private MSBuildToolVersion _msBuildToolVersion;

public string WebsiteRoot {get;set;}
public string InstanceUrl {get;set;}
public string SolutionName {get;set;}
public string ProjectFolder {get;set;}
public string BuildConfiguration {get;set;}
public bool RunCleanBuilds {get;set;}
public string MessageStatisticsApiKey {get;set;}
public string BuildToolVersions
{
set
{
if(!Enum.TryParse(value, out this._msBuildToolVersion))
{
this._msBuildToolVersion = MSBuildToolVersion.Default;
}
}
}

public string SourceFolder => $"{ProjectFolder}\\src";
public string FoundationSrcFolder => $"{SourceFolder}\\Foundation";
public string FeatureSrcFolder => $"{SourceFolder}\\Feature";
public string ProjectSrcFolder => $"{SourceFolder}\\Project";

public string SolutionFile => $"{ProjectFolder}\\{SolutionName}";
public MSBuildToolVersion MSBuildToolVersion => this._msBuildToolVersion;
public string BuildTargets => this.RunCleanBuilds ? "Clean;Build" : "Build";
public string SitecoreLibrariesPath => $"{WebsiteRoot}\\bin";
public string SitecoreLibModuleCommerce => $"{ProjectFolder}\\lib\\Modules\\Commerce";
}

public void PublishProjects(string rootFolder, string websiteRoot)
{
var projects = GetFiles($"{rootFolder}\\**\\website\\*.csproj");

foreach (var project in projects)
{
MSBuild(project, cfg => InitializeMSBuildSettings(cfg)
.WithTarget(configuration.BuildTargets)
.WithProperty("DeployOnBuild", "true")
.WithProperty("DeployDefaultTarget", "WebPublish")
.WithProperty("WebPublishMethod", "FileSystem")
.WithProperty("DeleteExistingFiles", "false")
.WithProperty("publishUrl", websiteRoot)
.WithProperty("BuildProjectReferences", "false"));
}
}

public FilePathCollection GetTransformFiles(string rootFolder)
{
Func<IFileSystemInfo, bool> exclude_obj_bin_folder = fileSystemInfo => !fileSystemInfo.Path.FullPath.Contains("/obj/") && !fileSystemInfo.Path.FullPath.Contains("/bin/");

var xdtFiles = GetFiles($"{rootFolder}/**/*.xdt", exclude_obj_bin_folder);

return xdtFiles;
}

public void Transform(string rootFolder) {
var xdtFiles = GetTransformFiles(rootFolder);

foreach (var file in xdtFiles)
{
Information($"Applying configuration transform:{file.FullPath}");
var fileToTransform = Regex.Replace(file.FullPath, ".+website/(.+)/*.xdt", "$1");
var sourceTransform = $"{configuration.WebsiteRoot}\\{fileToTransform}";
if (FileExists(sourceTransform))
{
XdtTransformConfig(sourceTransform // Source File
, file.FullPath // Tranforms file (*.xdt)
, sourceTransform); // Target File
}

}
}

public void RebuildIndex(string indexName)
{
cakeConsole.WriteLine($"Rebuild {indexName}");
var url = $"{configuration.InstanceUrl}utilities/indexrebuild.aspx?index={indexName}";
string responseBody = HttpGet(url);
}

public MSBuildSettings InitializeMSBuildSettings(MSBuildSettings settings)
{
settings.SetConfiguration(configuration.BuildConfiguration)
.SetVerbosity(Verbosity.Minimal)
.SetMSBuildPlatform(MSBuildPlatform.Automatic)
.SetPlatformTarget(PlatformTarget.MSIL)
.UseToolVersion(configuration.MSBuildToolVersion)
.WithRestore();
return settings;
}

public void CreateFolderIfNotExist(string folderPath)
{
if (!DirectoryExists(folderPath))
{
CreateDirectory(folderPath);
}
}

public void WriteError(string errorMessage)
{
cakeConsole.ForegroundColor = ConsoleColor.Red;
cakeConsole.WriteError(errorMessage);
cakeConsole.ResetColor();
}
41 changes: 20 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ The code, samples and/or solutions provided in this repository are for example p

# Getting Started

**This guide assumes you've cloned and deployed Sitecore.HabitatHome.Content. See the README.md file in the [Sitecore.HabitatHome.Content](https://github.com/sitecore/sitecore.habitathome.content) repository.**
**This guide assumes you've cloned and deployed Sitecore.HabitatHome.Platform. See the README.md file in the [Sitecore.HabitatHome.Platform](https://github.com/sitecore/sitecore.habitathome.platform) repository.**

## Prerequisites

### Sitecore Version

Prior to attempting the demo installation, ensure you have a working **Sitecore XC 9.0.1** instance. Detailed installation instructions can be found at [doc.sitecore.com](http://commercesdn.sitecore.net/SitecoreXC_9.0/Installation-Guide/Sitecore-XC-9.0_Installation_Guide(On-Prem).pdf).
Prior to attempting the demo installation, ensure you have a working **Sitecore XC 9.0.2** instance. Detailed installation instructions can be found at [doc.sitecore.com](http://commercesdn.sitecore.net/SitecoreXC_9.0/Installation-Guide/9.0.2/SitecoreXC-9.0_Installation_Guide(On-Prem).pdf).

You do not need to install the Storefront Theme

Expand All @@ -34,15 +34,12 @@ You do not need to install the Storefront Theme

## Custom Install - before you start

If you do **not want to use the default settings**, you need to adjust the appropriate values in the following files:
If you do **not want to use the default settings**, you need to adjust the appropriate values in the `/cake-config.json` file.

* `/gulp-config.js`
* `/publishsettings.targets`
* `src\Project\HabitatHome\website\App_Config\Include\Project\z.HabitatHome.Commerce.WebSite.DevSettings.config`

Note: If you've already deployed the HabitatHome Content demo, and you wish to run the HabitatHome Commerce demo in a new instance by customizing these sttings,
you would need to also customize the settings in the HabitatHome Content demo and deploy it to the new instance **before** deploying HabitatHome Commerce.
See README.md in Sitecore.HabitatHome.Content for custom settings.
Note: If you've already deployed the HabitatHome Platform demo, and you wish to run the HabitatHome Commerce demo in a new instance by customizing these sttings,
you would need to also customize the settings in the HabitatHome Platform demo and deploy it to the new instance **before** deploying HabitatHome Commerce.
See README.md in Sitecore.HabitatHome.Platform for custom settings.

## Installation
**All installation instructions assume using PowerShell 5.1 in administrative mode.**
Expand All @@ -54,23 +51,25 @@ Clone the Sitecore.HabitatHome.Commerce repository locally - default settings as
`git clone [email protected]:Sitecore/Sitecore.HabitatHome.Commerce.git`

### 2 Deploy Solution
Note: If you have not yet done so, deploy the base HabitatHome.Content solution. See README.md in Sitecore.HabitatHome.Content
You can run the `quick-deploy` gulp task from the root of the HabitatHome.Content solution for a quicker deploy that excludes post deploy actions or Unicorn synchronization.
Note: If you have not yet done so, deploy the base HabitatHome.Platform solution. See README.md in Sitecore.HabitatHome.Platform
You can run the `Quick-Deploy` gulp task from the root of the HabitatHome.Platform solution for a quicker deploy that excludes post deploy actions or Unicorn synchronization.

To deploy the HabitatHome.Commerce solution, from the root of the solution
To deploy the **HabitatHome.Commerce** solution, from the root of the solution

`npm install`
`node_modules\.bin\gulp initial`
> gulp **initial** only needs to be executed successfully during the initial deployment. Subsequent deployments can be made by running the default gulp task (gulp with no parameters).
`.\build.ps1 -Target Initial`

_Notes:_

- Build target **Initial** only needs to be executed successfully during the initial deployment. Subsequent deployments can be made by running the **Default** Cake build target: `.\build.ps1` (without target specification).

### 3 Deploy Engine

The next step will deploy Habitat Home's custom Commerce Engine with its relevant plugin and load the catalog, inventory and promotions.

_Notes:_
* If you want to use your own engine suffix rather than `habitat`, you need to update it in `deploy-commerce-engine.ps1`
* If you want to use your own databases rather than `habitat_Global`, you need to update it in `\src\Project\HabitatHome\engine\wwwroot\bootstrap\Global.json`
* If you want to use your own databases rather than `habitat_SharedEnvironments`, you need to update it in `\src\Project\HabitatHome\engine\wwwroot\data\Environments\Plugin.SQL.PolicySet-1.0.0.json`
* If you want to use your own engine suffix rather than `habitathome`, you need to update it in `deploy-commerce-engine.ps1`
* If you want to use your own databases rather than `habitathome_Global`, you need to update it in `\src\Project\HabitatHome\engine\wwwroot\bootstrap\Global.json`
* If you want to use your own databases rather than `habitathome_SharedEnvironments`, you need to update it in `\src\Project\HabitatHome\engine\wwwroot\data\Environments\Plugin.SQL.PolicySet-1.0.0.json`
The script is provided as an example and should be reviewed to understand its behavior prior to its execution. In summary, the script:

- Compiles and publishes the engine to a temporary location (default .\publishTemp)
Expand All @@ -86,10 +85,10 @@ The script is provided as an example and should be reviewed to understand its be

Assuming you have the default installation settings:

deploy-commerce-engine.ps1 -Boostrap -Initialize
`.\deploy-commerce-engine.ps1 -Bootstrap -Initialize`

> if you have made any changes to your settings, review the deploy-engine-commerce.ps1 script and override / modify the parameters as required.
> if you have made any changes to your settings, review the `deploy-engine-commerce.ps1` script and override / modify the parameters as required.

# Contribute or Issues
Please post any issues on Slack Community [#habitathome](https://sitecorechat.slack.com/messages/habitathome/) channel or create an issue on [GitHub](https://github.com/Sitecore/Sitecore.HabitatHome.Commerce/issues). Contributions are always welcome!
Please post any issues on Slack Community [#habitathome](https://sitecorechat.slack.com/messages/habitathome/) channel or create an issue on [GitHub](https://github.com/Sitecore/Sitecore.HabitatHome.Commerce/issues). Contributions are always welcome!
Loading

0 comments on commit b170377

Please sign in to comment.