dsolovay / Sitecore-Instance-Manager

Dans's fork for hacking out a SOLR feature.
MIT License
0 stars 1 forks source link

Add a conditional feature to the Manifest syntax #15

Closed dsolovay closed 9 years ago

dsolovay commented 9 years ago

It would be helpful in managing the logic for different IOCs to have a conditional logic feature added to the Manifest syntax. I see two options here:

  1. Add an <if condition='some condition'> element, which could be used to wrap actions. Example:

    <if condition="{IOC Option} != 'Autofac' ">
     <editfile path="/Website/bin/SomeAutofacBinary.dll">  
         <move target="/Website/bin/SomeAutofacBinarry.dll.disabled" />  
     </editfile>  
    </if>
  2. Add a "condition" attribute directly to actions.

    <editfile path="/Website/bin/SomeAutofacBinary.dll" condition="{IOC Service} != 'Autofac'" >
     <move target="/Website/bin/SomeAutofacBinarry.dll.disabled" />
    </editfile>

The second option looks like the simplest to implement, so I lean towards it. I recommend we stick with just "=" and "!=" with strings right now, but we may be able to leverage a library to extend this later on.

@AlenPelin, please let me know if you agree with this approach, and which option to choose. If you agree, I'll flip this over to a Task.

AlenPelin commented 9 years ago

@dsolovay I agree that we need some conditioning support in manifests, but I suggest slightly different format that is easier to implement:

<editfile path="/Website/bin/SomeAutofacBinary.dll" condition="equals" conditionArg1="{IOC Service}" conditionArg2="Autofac">
  <move target="/Website/bin/SomeAutofacBinarry.dll.disabled" />
</editfile>

where condition can be equals|not equals for now, but we can add like and not like in future. Ideally to add condition functionality to all nodes, not only specific ones.