BIML: FilySystemTask is missing UseDirectoryIfExists attribute for operation Create Directory - biml

I'm trying to create a directory if it does not exists, using BIML. The SSIS File System Task has an operation Create Directory which has an UseDirectoryIfExists attribute, that can be set to true.
I cannot find that attribute for the <FileSystem> in BIML.
How can I set that property to true?

I havent used FileSystem in BIML yet, however i can give it a shot. Though i havent tested it.
You can also read more about the FileSystemTask properties here. As i can see it doesnt directly have an UseDirectoryIfExists property. However you can try what i have written below this.
This here is how a manuel SSIS-package XML looks like when you create a FileSystemTask with UseDirectoryIFExists = true
<DTS:ObjectData> <FileSystemData TaskOperationType="CreateDirectory" TaskOverwriteDestFile="True" /> </DTS:ObjectData>
If UseDirectoryIfExists = false
Then it looks like this
<DTS:ObjectData> <FileSystemData TaskOperationType="CreateDirectory" /> </DTS:ObjectData>
So i think your BIML should look like this:
<Tasks> <FileSystem Operation="CreateDirectory" OverwriteDestination="true"> </FileSystem> </Tasks>

Related

Transformation of machineKey tag

We have to transform tag in which "decryptionKey" and "validationKey" will be different for our development and test environments.
We have tried to give different variables for validationKey and decryptionKey but confused with the xdt: Transform and xdt: Locator attribute as they will occur once in the same tag.
Suppose following is the web.config machineKey tag,
<machineKey decryptionKey="012345678910111213141516"
validation="SHA1" validationKey="235487512547896321458778996325456965542126364586965" />
We have to give transformation something like following,
<machineKey decryptionKey="#{DecryptionKey}#"
validation="SHA1"
validationKey="#{ValidationKey}#"
xdt:Transform="SetAttributes"
xdt:Locator="Match(decryptionKey)"
xdt:Transform="SetAttributes"
xdt:Locator="Match(validationKey)" />
Need this kind of a solution in which we have to give multiple variables within a single tag.
To set multiple attributes, you need to pass them into SetAttributes as a comma-delimited list.
This is documented here
However, if you are actually replacing all of the attributes, it might just be easier/cleaner to use xdt:Transform="Replace" and set the entire tag value in each configuration.

Setting a default list of items in project_attribute in a GNAT GPS Plugin

I'm working on a custom GNAT GPS plugin (for GPS 6.1.2).
My plugin XML creates a project attribute "example_list_of_files".
This is a list of strings, that correspond the names of Ada files in the project.
I want to default the entries in that list to "a.adb","b.adb","c.adb". However I've been unable to find the correct syntax for this. Instead i end up with a single string of all the values.
What i want to see is what happens when you manually add three elements, as shown below:
Here is the code for this example:
GPS.parse_xml('<?xml version="1.0" ?>' + """
<my_plugin>
<project_attribute
name="example_list_of_files"
label="example_list_of_files"
description="A description...."
package="MyPackage"
editor_page="MyPage"
editor_section="Build"
hide_in="wizard library_wizard"
omit_if_default="false"
list="true"
base_name_only="true">
<string type="file" filter="project" default="'a.adb','b.adb','c.adb' " />
</project_attribute>
</my_plugin>""");
Notice the string element with the project attribute default. Instead of a list of entries in the project manager it gives me a single entry, containing the string "'a.adb', 'b.adb', 'c.adb'".
Anyone got any ideas? I've also tried multiple string elements, adding brackets, braces, square-brackets, space separators, prefixing with 'array(' with no luck.
thanks
Matt
It seems indeed this is not supported. The standard plug-in projects.py has several list attributes, but all of them have a single value as the default. I'll check what can be done to improve here.
However, your approach might be wrong in the first place. The default you are setting only concerns the project editor. That means that if a user uses a default project (like project default is end default) and never goes through the project editor, your attribute example_list_of_files will in fact not exist (and have a default empty value). So it seems that this should in fact be handled in your plug-in, when you query the value of the attribute (like via GPS.Project.get_attribute_as_list). If that function returns an empty list, then use ("a.adb", "b.adb", "c.adb") instead. That way, things work fine even with a default, unedited project.
From the GPS User's Guide:
The tag accepts the following attributes:
[...]
list (boolean, default false)
If true, the project attribute contains a list of values, as opposed
to a single value. An example is the list of source directories in
standard projects.
In your example:
<string type="file" filter="project" default="'a.adb','b.adb','c.adb' " />
This is a single string value. Instead, you should specify a list of string values, like this:
<string type="file" filter="project" default="a.adb" />
<string type="file" filter="project" default="b.adb" />
<string type="file" filter="project" default="c.adb" />

Creating a working copy for Plone 4 custom content types

I have created a custom Plone content type in my package i.e. my.product.
I am in need of integrating a working copy support: so that a "published" document (in my case, a published content type) stays online while it is being edited. Basically, I want to take advantage of 'Working Copy Support (Iterate)' provided by plone.app.iterate to achieve what is explained here. This will provide me with ability to check-in/check-out my changes.
Is this possible in Plone 4 with custom content types using Archetypes? How would one go about it if yes?
I added the following two files inside my.product/my/product/profiles/default folder and it appears to work:
diff_tool.xml
<?xml version="1.0"?>
<object>
<difftypes>
<type portal_type="MyCustomType">
<field name="any" difftype="Compound Diff for AT types"/>
</type>
</difftypes>
</object>
repositorytool.xml
<?xml version="1.0"?>
<repositorytool>
<policymap>
<type name="MyCustomType">
<policy name="at_edit_autoversion"/>
<policy name="version_on_revert"/>
</type>
</policymap>
</repositorytool>
I have never used plone.app.iterate, but this is the generic approach how to solve the problem.
Actions are installed by plone.app.iterate GenericSetup profile. You can see actions here:
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/profiles/default/actions.xml
Pay note to the line *available_expr* which tells when to show the action or not. It points to helper view with the conditition.
The view is defined here
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/browser/configure.zcml#L7
The checks that are performed for the content item if it's archiveable
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/browser/control.py#L47
Most likely the failure comes from if not interfaces.IIterateAware.providedBy condition. Your custom contennt must declare this interface. However, you can confirm this putting a pdb breakpoint in checkin_allowed(self) and step it though line-by-line and see what happens with your content type.

WiX: Preserve on major upgrade, remove on uninstall

I have defined a component to cleanup a generated (not installed) file on uninstall but leave intact on a major upgrade after reading this post
<Component Id="C_RemoveOnUninstall" Guid="XXX">
<RemoveFile Id="DeleteGeneratedFile" Name="ProgramGeneratedFile" On="uninstall"/>
<Condition>REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE</Condition>
</Component>
With condition above, the file is left behind for both upgrade and uninstall.
Without the condition, the file is deleted for both upgrade and uinstall.
I have tried RemoveFile for each of On="install/uninstall/both" but it does not seem to matter. Have read this post but I am hoping to make component conditions work and avoid writing custom action for this.
Does this code look correct? Any solutions or work around?
This approach assumes the RemoveFiles action ignores an item in the RemoveFile table when the property DirProperty referrers to has a value of null. The property DirProperty referrers to will be set during uninstall though not during an upgrade.
Conditionally set the property:
<SetProperty Id="prop_GeneratedFileDir" Value="[GeneratedFileDir]" After="InstallInitialize" Sequence="execute">
REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE
</SetProperty>
Define an element for the RemoveFile table:
<Component Id="C_RemoveOnUninstall" Guid="XXX">
<RemoveFile Id="DeleteGeneratedFile" Property="prop_GeneratedFileDir" Name="ProgramGeneratedFile" On="uninstall"/>
<CreateFolder/>
</Component>
Some helpful links:
wix-users, RemoveFile Table, RemoveFile Element, RemoveFolderEx Element

Nant property cannot be overwritten eventhough not marked as readonly

I am using nant 0.85 version. I have defined a property in a file and have not specified like'read only=true". But where ever I try to change the value of the property , I get the warning saying that, property cannot be overwritten.
I have tried setting readonly="false" overwrite="true".But nothing seems to work. Any help would be greatly appreciated .
use unless attribute, it works.
<property name="msbuild.path" value="CONFIGURABLE" unless="${property::exists('msbuild.path')}" />
then as usual nant -D:msbuild.path=...
Need more details, especially if you "change the value of the property" from command line.
One thing that I have seen that causes some confusion is that when the property is overridden from command line ( -D:prop=value ), and if the same property is defined in the file (<property name="prop" value="value"/> ) it will say read only property cannot be overridden because the property set from command line is read only and it cannot be overridden by the property defined in the file.
It is not the other way around, which causes some confusion and people thinking that despite having no readonly set to true etc. still saying cannot be overridden.
So try to see if the property you set is actually using the value you wanted, if you are overriding from command line.
You can totally do this in NAnt 0.85. Let's say for example you have a property with the name "myvalue" that you want to be able to be passed in from the command line. You would first define the property in your NAnt script like this:
<property name="myvalue" value="0" overwrite="false" />
When you call NAnt you just need to use the -D parameter to pass in your new value like this:
nant.exe buildfile:myfile.build -logfile:mylog.log -D:myvalue=16
And your new value of "16" will be recognized in your build script which you can test by simply echoing the value like this:
<echo message="myvalue: ${myvalue}" />
For further information you can read the documentation and look at example "iv":
http://nant.sourceforge.net/release/0.85/help/tasks/property.html