Skip to content

Instantly share code, notes, and snippets.

@cassidydotdk
Last active July 1, 2019 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cassidydotdk/2e50be44933ce164efd9d724c73094af to your computer and use it in GitHub Desktop.
Save cassidydotdk/2e50be44933ce164efd9d724c73094af to your computer and use it in GitHub Desktop.
Managing Unicorn targetDataStore in Gulp pipeline
var rename = require('gulp-rename');
var replace = require('gulp-replace');
...
gulp.task("B04-Sync-Unicorn",
function(callback) {
console.log("Executing Unicorn Sync");
gulp.src([path.resolve(config.websiteRoot + '/App_Config/Include/zzz/Unicorn.TargetDataStore.config.EDITME')])
.pipe(replace('#repository#', path.resolve('.')))
.pipe(rename('Unicorn.TargetDataStore.config'))
.pipe(gulp.dest(config.websiteRoot + '/App_Config/Include/zzz/z'));
var options = {};
options.siteHostName = config.hostName;
options.authenticationConfigFile = config.websiteRoot + "/App_config/Include/[blah blah]/z.Unicorn/Unicorn.zSharedSecret.config";
unicorn(function() { return callback() }, options);
});
Keep this one in your solution under source control, and deploy it with Build Action Content
...
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<unicorn>
<defaults>
<targetDataStore>
<patch:attribute name="physicalRootPath">#repository#\unicorn\$(configurationName)</patch:attribute>
</targetDataStore>
<roleDataStore>
<patch:attribute name="physicalRootPath">#repository#\unicorn\Unicorn.Roles\$(configurationName)</patch:attribute>
</roleDataStore>
<userDataStore>
<patch:attribute name="physicalRootPath">#repository#\unicorn\Unicorn.Users\$(configurationName)</patch:attribute>
</userDataStore>
</defaults>
</unicorn>
</sitecore>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment