This repository has been archived by the owner on Dec 6, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from Sitecore/feature/gulp
Additional gulp automation
- Loading branch information
Showing
34 changed files
with
6,959 additions
and
2,090 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
module.exports = function () { | ||
var config = { | ||
var config = { | ||
websiteRoot: "C:\\websites\\Habitat.local\\Website", | ||
sitecoreLibraries: "C:\\websites\\Habitat.local\\Website\\bin", | ||
solutionName: "Habitat", | ||
buildConfiguration: "Debug" | ||
} | ||
return config; | ||
buildConfiguration: "Debug", | ||
runCleanBuilds: false | ||
} | ||
return config; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
param([string]$url, [string]$secret, [string]$configurations) | ||
$ErrorActionPreference = 'Stop' | ||
|
||
# This is an example PowerShell script that will remotely execute a Unicorn sync using the new CHAP authentication system. | ||
|
||
Import-Module .\Unicorn.psm1 | ||
$configs = $configurations.Split('^') | ||
|
||
Sync-Unicorn -ControlPanelUrl $url -SharedSecret $secret -Configurations $configs | ||
|
||
# Note: you may pass -Verb 'Reserialize' for remote reserialize. Usually not needed though. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"use strict"; | ||
var xml2js = require("xml2js"); | ||
var fs = require("fs"); | ||
|
||
var habitat = {}; | ||
|
||
habitat.getConfiguration = function getConfigFile(filename) { | ||
var data = fs.readFileSync(filename); | ||
|
||
var parser = new xml2js.Parser(); | ||
var content; | ||
parser.parseString(data, function (err, result) { | ||
if (err !== null) throw err; | ||
|
||
content = result; | ||
}); | ||
return content; | ||
}; | ||
|
||
habitat.getSiteUrl = function getSiteUrl(options) { | ||
if (!options) options = {}; | ||
|
||
var publishFile = options.publishingSettingsFile ? options.publishingSettingsFile : "./publishsettings.targets"; | ||
try { | ||
var configuration = habitat.getConfiguration(publishFile); | ||
return configuration.Project.PropertyGroup[0].publishUrl[0]; | ||
} catch(error) { | ||
error.message = "Could not get the Habitat site URL from '" + publishFile + "'. Error:" + error.message; | ||
throw(error); | ||
} | ||
}; | ||
|
||
module.exports = habitat; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
"use strict"; | ||
var exec = require("child_process").exec; | ||
var xml2js = require("xml2js"); | ||
var glob = require("glob"); | ||
var async = require("async"); | ||
var fs = require("fs"); | ||
|
||
module.exports = function (callback, options) { | ||
var getUnicornSecret = function () { | ||
if (options.secret) | ||
return options.secret; | ||
var unicornConfigFile = options.authenticationConfigFile; | ||
|
||
var data = fs.readFileSync(unicornConfigFile); | ||
|
||
var parser = new xml2js.Parser(); | ||
var secret; | ||
parser.parseString(data, function (err, result) { | ||
if (err !== null) throw err; | ||
|
||
secret = result.configuration.sitecore[0].unicorn[0].authenticationProvider[0].SharedSecret[0]; | ||
}); | ||
return secret; | ||
} | ||
|
||
var getUnicornConfiguration = function (configFile) { | ||
var data = fs.readFileSync(configFile); | ||
|
||
var configuration; | ||
var parser = new xml2js.Parser(); | ||
parser.parseString(data, function (err, result) { | ||
if (err !== null) throw err; | ||
|
||
var configurationNodes = result.configuration.sitecore[0].unicorn[0].configurations[0].configuration; | ||
for (var i = 0; i < configurationNodes.length; i++) { | ||
configuration = (configuration ? configuration + "^" : "") + configurationNodes[i].$.name; | ||
} | ||
}); | ||
return configuration; | ||
} | ||
|
||
var getUnicornConfigurations = function (filesGlob) { | ||
var configurations; | ||
|
||
var files = glob.sync(filesGlob); | ||
for (var i = 0; i < files.length; i++) { | ||
var file = files[i]; | ||
var configuration = getUnicornConfiguration(file); | ||
if (configuration) { | ||
configurations = (configurations ? configurations + "^" : "") + configuration; | ||
} | ||
} | ||
return configurations; | ||
}; | ||
|
||
var getOrderedUnicornConfigurations = function (filesGlobs) { | ||
if (options.configurations) | ||
return options.configurations; | ||
|
||
var allConfigurations; | ||
|
||
for (var i = 0; i < filesGlobs.length; i++) { | ||
var configurations = getUnicornConfigurations(filesGlobs[i]); | ||
if (configurations) { | ||
allConfigurations = (allConfigurations ? allConfigurations + "^" : "") + configurations; | ||
} | ||
} | ||
return allConfigurations; | ||
} | ||
|
||
var secret = getUnicornSecret(); | ||
var url = options.siteHostName + "/unicorn.aspx"; | ||
var configurations = getOrderedUnicornConfigurations(options.configurationConfigFiles); | ||
|
||
var syncScript = "./Sync.ps1 -secret " + secret + " -url " + url + " -configurations " + configurations; | ||
var options = { cwd: __dirname + "/Unicorn/" }; | ||
return exec("powershell \"" + syncScript + "\"", options, function(err, stdout, stderr) { | ||
if (err !== null) throw err; | ||
console.log(stdout); | ||
callback(); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.