Skip to content
This repository has been archived by the owner on Dec 6, 2019. It is now read-only.

Commit

Permalink
Merge pull request #475 from Sitecore/issue/474/sitecore-92
Browse files Browse the repository at this point in the history
Habitat v1.8
  • Loading branch information
nickwesselman authored Aug 6, 2019
2 parents afa7999 + b344038 commit edb9ed2
Show file tree
Hide file tree
Showing 122 changed files with 630 additions and 737 deletions.
27 changes: 14 additions & 13 deletions docs/01-Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

## Software Versions

This version of Habitat uses the following versions of this software:
This version of Habitat uses the following software versions:

| Software | Version |
| --- | --- |
| Sitecore | 9.1.0 |
| Solr | 7.2.1 |
| Sitecore Installation Framework | 2.0.0 |
| Sitecore | 9.2.0 |
| Solr | 7.5.0 |
| Sitecore Installation Framework | 2.1.0 |
| Visual Studio / MSBuild | 2019 / 16.x |

## Locations and settings

Expand All @@ -22,9 +23,9 @@ This project assumes the following settings:
| SQL Server | . | `settings.ps1` |
| SQL Server Admin | sa | `settings.ps1` |
| SQL Server Password | 12345 | `settings.ps1` |
| SOLR Location | c:\solr\ | `settings.ps1` |
| SOLR URL | [https://localhost:8983/solr](https://localhost:8983/solr) (*Note https*) | `settings.ps1` |
| SOLR Windows Service Name | Solr | `settings.ps1` |
| SOLR Location | C:\solr\solr-7.5.0 | `settings.ps1` |
| SOLR URL | [https://solr750:8750/solr](https://solr750:8750/solr) (*Note https*) | `settings.ps1` |
| SOLR Windows Service Name | Solr-7.5.0 | `settings.ps1` |

<sup>1</sup> Files referred are:

Expand Down Expand Up @@ -65,7 +66,7 @@ If your Solr environment is not currently running with HTTPS, you can create an

### 1. Installing Sitecore

1. **Clone** the [Habitat repository](https://github.com/Sitecore/Habitat/) to your local file system.
1. **Clone or Download** the [Habitat repository](https://github.com/Sitecore/Habitat/) to your local file system.
1. Download the correct version of Sitecore from [dev.sitecore.net](https://dev.sitecore.net/Downloads.aspx) and place it in the `.\build\assets` folder.
* Habitat will install by default on an *Sitecore XP Single*, i.e. a standalone version of Sitecore CMS including xConnect.
* The currently supported version is defined in the `.\settings.ps1` file
Expand Down Expand Up @@ -98,9 +99,9 @@ If your Solr environment is not currently running with HTTPS, you can create an
1. Build and publish the solution using either:
* Open an command prompt with elevated privileges and run **`gulp`** in the root of repository.
* Use Visual Studio:
* Open **Visual Studio 2017** in administrator mode by right-clicking on its icon and selecting **Run as administrator**.
* Open **Visual Studio 2019** in administrator mode by right-clicking on its icon and selecting **Run as administrator**.
* Open the Habitat solution.
* Open the **Visual Studio 2017** Task Runner Explorer pane (**View** | **Other Windows** | **Task Runner Explorer**).
* Open the **Visual Studio 2019** Task Runner Explorer pane (**View** | **Other Windows** | **Task Runner Explorer**).
* Switch to "Solution 'Habitat'"
* Run the "default" task

Expand All @@ -127,7 +128,6 @@ In the initial installation running the **default** task will execute all the co
* The **Auto-Publish-Css** automatically publishes .css files when changed (Configure Sass compilation in Visual Studio)
* The **Auto-Publish-Assemblies** task publishes assemblies as they are built using the standard Visual Studio build process
* The **Auto-Publish-Views** task publishes .cshtml files when they are changed.
* The **Publish-[...]** tasks helps you by manually publishing different types of files or project types to your website.

### SMTP Settings

Expand All @@ -150,6 +150,7 @@ For this to work, you need to set the SMTP settings in Sitecore.config.

Habitat demonstrates utilizing the Federated Authentication features of Sitecore to allow login via Facebook account. To enable this functionality:

1. Use IIS to add an SSL certificate and binding to your Habitat site (required by Facebook).
1. [Register a Facebook App](https://developers.facebook.com/docs/apps/register/) using a Facebook Developer Account.
2. Add the domain under which you are running Habitat to the *App Domains* setting of your Facebook App. By default this is `habitat.dev.local`.
3. Use the *App ID* and *App Secret* from your app settings to populate the `Sitecore.Feature.Accounts.Facebook.AppId` and `Sitecore.Feature.Accounts.Facebook.AppSecret` settings, by default found in `Feature\Accounts\code\App_Config\Include\Feature\Feature.Accounts.config`.
1. Add the domain under which you are running Habitat to the *App Domains* setting of your Facebook App. By default this is `habitat.dev.local`.
1. Use the *App ID* and *App Secret* from your app settings to populate the `Sitecore.Feature.Accounts.Facebook.AppId` and `Sitecore.Feature.Accounts.Facebook.AppSecret` settings, by default found in `Feature\Accounts\code\App_Config\Include\Feature\Feature.Accounts.config`.
9 changes: 4 additions & 5 deletions docs/02-Resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ You must install these before installing Habitat:

* [PowerShell version 5 or later](https://www.microsoft.com/en-us/download/details.aspx?id=50395)
* [.NET Framework 4.7.1 Developer Pack](https://www.microsoft.com/en-us/download/details.aspx?id=56119)
* [Visual Studio 2017](https://www.visualstudio.com/downloads/)
* **Be sure you are using VS17 v15.5 or higher in order to get necessary updates to MSBuild. Update your IDE if needed.**
* Within VS2017, install these extensions:
* [Visual Studio 2019](https://www.visualstudio.com/downloads/)
* **Be sure you are using VS19 v16.1.6 or higher. Update your IDE if needed.**
* Within VS2019, install these extensions:
* [Web Compiler](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.WebCompiler)
* ASP.NET MVC for the user interface patterns
* On Windows 10, this is enabled by going to:
Expand All @@ -22,8 +22,7 @@ These are additional tools used in Habitat's creation. You do not need to instal
* Front end framework: [Bootstrap 3](http://getbootstrap.com/)
* Package management: NuGet, [Node (npm)](https://nodejs.org/) and [Bower](https://www.bower.io/)
* Build scripts: [Gulp](http://gulpjs.com/)
* Item serialisation: [Unicorn 4](https://github.com/kamsar/Unicorn)
* Windows PowerShell 4.0+ required to sync Unicorn via Gulp task
* Item serialization: [Unicorn](https://github.com/kamsar/Unicorn)
* Bug-tracking: [GitHub](https://github.com/Sitecore/Habitat/issues)
* CI server: TeamCity
* Unit tests: xUnit
Expand Down
2 changes: 1 addition & 1 deletion gulp-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = function () {
packagePath: instanceRoot + "\\App_Data\\packages",
solutionName: "Habitat",
buildConfiguration: "Debug",
buildToolsVersion: 15.0,
buildToolsVersion: '16.0',
buildMaxCpuCount: 0,
buildVerbosity: "minimal",
buildPlatform: "Any CPU",
Expand Down
258 changes: 64 additions & 194 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <binding />
var gulp = require("gulp");
var msbuild = require("gulp-msbuild");
var _msbuild = require("msbuild");
var debug = require("gulp-debug");
var foreach = require("gulp-foreach");
var rename = require("gulp-rename");
Expand All @@ -16,6 +16,7 @@ var path = require("path");
var rimrafDir = require("rimraf");
var rimraf = require("gulp-rimraf");
var xmlpoke = require("xmlpoke");
var glob = require("glob");

var config;
if (fs.existsSync("./gulp-config.js.user")) {
Expand Down Expand Up @@ -79,43 +80,74 @@ gulp.task("References-Nuget",

gulp.task("Publish-All-Projects",
function(callback) {
return runSequence(
"Build-Solution",
"Publish-Foundation-Projects",
"Publish-Feature-Projects",
"Publish-Project-Projects",
callback);
var msbuild = new _msbuild(callback);
msbuild.solutionName = config.solutionName + '.sln';
var overrideParams = [];
overrideParams.push('/p:Configuration=' + config.buildConfiguration);
overrideParams.push('/p:DeployOnBuild=true');
overrideParams.push('/p:DeployDefaultTarget=WebPublish');
overrideParams.push('/p:WebPublishMethod=FileSystem');
overrideParams.push('/p:DeleteExistingFiles=false');
overrideParams.push('/p:publishUrl=' + config.websiteRoot);
overrideParams.push('/m');
overrideParams.push('/restore');
msbuild.config('overrideParams', overrideParams);
msbuild.config('version', config.buildToolsVersion);
msbuild.build();
});

gulp.task("Apply-Xml-Transform",
function() {
// Need to apply these synchronously or risk trying to write the same destination file in parallel
var layerPathFilters = [
"./src/Foundation/**/*.xdt", "./src/Feature/**/*.xdt", "./src/Project/**/*.xdt",
"!./src/**/obj/**/*.xdt", "!./src/**/bin/**/*.xdt"
"./src/Foundation/**/*.xdt", "./src/Feature/**/*.xdt", "./src/Project/**/*.xdt"
];
return gulp.src(layerPathFilters)
.pipe(foreach(function(stream, file) {
var fileToTransform = file.path.replace(/.+code\\(.+)\.xdt/, "$1");
util.log("Applying configuration transform: " + file.path);
return gulp.src("./scripts/applytransform.targets")
.pipe(msbuild({
targets: ["ApplyTransform"],
configuration: config.buildConfiguration,
logCommand: false,
verbosity: config.buildVerbosity,
stdout: true,
errorOnFail: true,
maxcpucount: config.buildMaxCpuCount,
nodeReuse: false,
toolsVersion: config.buildToolsVersion,
properties: {
Platform: config.buildPlatform,
WebConfigToTransform: config.websiteRoot,
TransformFile: file.path,
FileToTransform: fileToTransform
}
}));
}));
// Collect all the transforms into an array
var transforms = layerPathFilters.reduce(function (files, path) {
glob.sync(path, {absolute: true}).forEach(function(file) {
files.push(file);
});
return files;
}, []);
// Remove any transforms that ended up in compiled output
transforms = transforms.filter(function(path) {
return !path.includes('bin') && !path.includes('obj');
});
util.log("Discovered transforms: " + JSON.stringify(transforms));

// return a promise since we're not using gulp streams
return new Promise(function(resolve, reject) {

// use transform list as a queue and process each sequentially
var processTransforms = function() {
var next = transforms.shift();
if (next) {
applyTransform(next);
} else {
// no more transforms, let gulp know we're done
resolve('done');
}
}

var applyTransform = function(transformFile) {
var fileToTransform = transformFile.replace(/.+code\/(.+)\.xdt/, "$1");

// _msbuild will call back to the function above to apply the next transform when finished
var msbuild = new _msbuild(processTransforms);
msbuild.sourcePath = './scripts/applytransform.targets';
msbuild.targets = ['ApplyTransform'];
msbuild.configuration = config.buildConfiguration;
var overrideParams = [];
overrideParams.push('/p:WebConfigToTransform=' + config.websiteRoot);
overrideParams.push('/p:TransformFile=' + transformFile.replace(/\//g, "\\"));
overrideParams.push('/p:FileToTransform=' + fileToTransform.replace(/\//g, "\\"));
msbuild.config('overrideParams', overrideParams);
msbuild.config('version', config.buildToolsVersion);
msbuild.build();
};

processTransforms();
});
});

gulp.task("Publish-Transforms",
Expand All @@ -133,170 +165,8 @@ gulp.task("Sync-Unicorn",
unicorn(function() { return callback() }, options);
});

/*****************************
Copy assemblies to all local projects
*****************************/
gulp.task("Copy-Local-Assemblies",
function() {
console.log("Copying site assemblies to all local projects");
var files = config.sitecoreLibraries + "/**/*";

var root = "./src";
var projects = root + "/**/code/bin";
return gulp.src(projects, { base: root })
.pipe(foreach(function(stream, file) {
console.log("copying to " + file.path);
gulp.src(files)
.pipe(gulp.dest(file.path));
return stream;
}));
});

/*****************************
Publish
*****************************/
var publishStream = function(stream, dest) {
var targets = ["Build"];

return stream
.pipe(debug({ title: "Building project:" }))
.pipe(msbuild({
targets: targets,
configuration: config.buildConfiguration,
logCommand: false,
verbosity: config.buildVerbosity,
stdout: true,
errorOnFail: true,
maxcpucount: config.buildMaxCpuCount,
nodeReuse: false,
toolsVersion: config.buildToolsVersion,
properties: {
Platform: config.publishPlatform,
DeployOnBuild: "true",
DeployDefaultTarget: "WebPublish",
WebPublishMethod: "FileSystem",
BuildProjectReferences: "false",
DeleteExistingFiles: "false",
publishUrl: dest
}
}));
};
var publishProject = function(location, dest) {
dest = dest || config.websiteRoot;

console.log("publish to " + dest + " folder");
return gulp.src(["./src/" + location + "/code/*.csproj"])
.pipe(foreach(function(stream, file) {
return publishStream(stream, dest);
}));
};
var publishProjects = function(location, dest) {
dest = dest || config.websiteRoot;

console.log("publish to " + dest + " folder");
return gulp.src([location + "/**/code/*.csproj"])
.pipe(foreach(function(stream, file) {
return publishStream(stream, dest);
}));
};

gulp.task("Build-Solution",
function() {
var targets = ["Build"];
if (config.runCleanBuilds) {
targets = ["Clean", "Build"];
}

var solution = "./" + config.solutionName + ".sln";
return gulp.src(solution)
.pipe(msbuild({
targets: targets,
configuration: config.buildConfiguration,
logCommand: false,
verbosity: config.buildVerbosity,
stdout: true,
errorOnFail: true,
maxcpucount: config.buildMaxCpuCount,
nodeReuse: false,
toolsVersion: config.buildToolsVersion,
properties: {
Platform: config.buildPlatform
},
customArgs: [ "/restore" ]
}));
});

gulp.task("Publish-Foundation-Projects",
function() {
return publishProjects("./src/Foundation");
});

gulp.task("Publish-Feature-Projects",
function() {
return publishProjects("./src/Feature");
});

gulp.task("Publish-Project-Projects",
function() {
return publishProjects("./src/Project");
});

gulp.task("Publish-Project",
function() {
if (yargs && yargs.m && typeof(yargs.m) == "string") {
return publishProject(yargs.m);
} else {
throw "\n\n------\n USAGE: -m Layer/Module \n------\n\n";
}
});

gulp.task("Publish-Assemblies",
function() {
var root = "./src";
var binFiles = root + "/**/code/**/bin/Sitecore.{Feature,Foundation,Habitat}.*.{dll,pdb}";
var destination = config.websiteRoot + "/bin/";
return gulp.src(binFiles, { base: root })
.pipe(rename({ dirname: "" }))
.pipe(newer(destination))
.pipe(debug({ title: "Copying " }))
.pipe(gulp.dest(destination));
});

gulp.task("Publish-All-Views",
function() {
var root = "./src";
var roots = [root + "/**/Views", "!" + root + "/**/obj/**/Views"];
var files = "/**/*.cshtml";
var destination = config.websiteRoot + "\\Views";
return gulp.src(roots, { base: root }).pipe(
foreach(function(stream, file) {
console.log("Publishing from " + file.path);
gulp.src(file.path + files, { base: file.path })
.pipe(newer(destination))
.pipe(debug({ title: "Copying " }))
.pipe(gulp.dest(destination));
return stream;
})
);
});

gulp.task("Publish-All-Configs",
function() {
var root = "./src";
var roots = [root + "/**/App_Config", "!" + root + "/**/tests/App_Config", "!" + root + "/**/obj/**/App_Config"];
var files = "/**/*.config";
var destination = config.websiteRoot + "\\App_Config";
return gulp.src(roots, { base: root }).pipe(
foreach(function(stream, file) {
console.log("Publishing from " + file.path);
gulp.src(file.path + files, { base: file.path })
.pipe(newer(destination))
.pipe(debug({ title: "Copying " }))
.pipe(gulp.dest(destination));
return stream;
})
);
});

/*****************************
Watchers
Expand Down
Loading

0 comments on commit edb9ed2

Please sign in to comment.