Skip to content

Utilising kamsar\Unicorn to auto-install Sitecore items after NuGet package installation.

License

Notifications You must be signed in to change notification settings

cassidydotdk/Unicorn.Bootstrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unicorn.Bootstrap

Utilising kamsar\Unicorn to auto-install Sitecore items automatically when including a Unicorn.Bootstrap enabled NuGet package to your solution.

For module installers:

  1. Add Unicorn.Bootstrap enabled module (NuGet Package) to your solution with NuGet Package Manager. You don't need to add a reference to Unicorn.Bootstrap directly, unless you are creating a Sitecore module.
  2. Start Sitecore
  3. Done.

For module creators:

  1. Add a reference to Unicorn.Bootstrap via NuGet Package Manager.
  2. Create a Unicorn configuration for your module and place it in \App_Config\Include\Unicorn.Bootstrap.YourModuleName.config. Configure the repository folder as $(dataFolder)\Unicorn.Bootstrap\$(configurationName). (see example).
  3. Work on your module as normal; Unicorn will serialise in the background as usual.
  4. When packaging your module; keep the Unicorn.Bootstrap dependency and make sure to add your .config and contents of the serialisation folder to your NuGet package.
    1. Unicorn.Bootstrap.YourModule.config => content\App_Config\Include
    2. Unciorn Target DataStore root folder => content\Unicorn.Bootstrap
    3. Unicorn.Bootstrap will move folders under ~\Unicorn.Bootstrap to their matching Target Data Store folders during startup, and perform a sync operation.
  5. Publish the module as YourModuleName.Bootstrap
  6. Done.

Example Configuration

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
	<unicorn>
	  <configurations>
		<configuration name="Example Module" description="Unicorn.Bootstrap Example Module configuration">
		  <predicate type="Unicorn.Predicates.SerializationPresetPredicate, Unicorn" singleInstance="true">
          	<include database="master" path="/sitecore/system/modules/Example Module" />
		  </predicate>

		  <targetDataStore type="Rainbow.Storage.SerializationFileSystemDataStore, Rainbow" physicalRootPath="$(dataFolder)\Unicorn.Bootstrap\$(configurationName)" useDataCache="false" singleInstance="true"/>
   		</configuration>
	  </configurations>
	</unicorn>
  </sitecore>
</configuration>

Caveats

Make sure to keep your Target Data Store root folder name the same as your configuration name a all times. Unicorn.Bootstrap relies on this, to figure out which configurations to sync at startup. Absolutely make sure your Data Store root folder is unique, but Unicorn should also throw an exception if this is not the case. Place this alongside your regular Unicorn storage path, not inside it.

TL;DR

Unicorn.Bootstrap will install itself as a processor in your <initialize> Sitecore pipeline, and force a sync of all configurations found in \Unicorn.Bootstrap\.

Further information

To be fair, knowledge of how Unicorn works is probably required at this stage. I just don't have time to write a long documentation with examples, animated gifs, fireworks and memes right now.

DISCLAIMER

Unicorn.Bootstrap is currently under evaluation and has been released to public for comments. Absolutely use at your own risk. Also see license.

About

Utilising kamsar\Unicorn to auto-install Sitecore items after NuGet package installation.

Resources

License

Stars

Watchers

Forks

Packages

No packages published