How to get latest filename from a folder using PAF - ipaf

How to get the latest filename from a folder using pace automation framework

Use a custom tag :
#Tag=getLastModifiedFile, Att1=path, Att2=keyName
getLastModifiedFile=com.tr.execution.activities.GetLastModifiedFile
<getLastModifiedFile path="./sample_xml" keyName="file"></getLastModifiedFile>
<variable keyName="file_name" expression="'${file}'.split('.').slice(0, -1).join('.')" ></variable>

Related

Can I set the name of the generated IPA file?

I have a user-defined attribute that I set for CFBundleName:
<key>CFBundleName</key>
<string>$(APP_DISPLAY_NAME)</string>
APP_DISPLAY_NAME == THIS IS MY APP <-- it is the app name that I can see on my iPhone after I installed the app,
The problem is that also the IPA file name will be THIS IS MY APP.ipa. What is the problem with all the spaces while working with this file in the pipeline?
Is there a way to version this as my_app_prod_1_2_1 or my_app_dev_1_2_1 for the name of the file produced?
In your app's Build Settings, change the PRODUCT_NAME.

Create a python distribution directly using PTVS

Can I create a 'Python Distribution' with my module directly using PTVS(Python Tools for Visual Studio) ? I have done this before using command line but not using PTVS. If yes, how ?
Thanks!
Currently no. I think the feature you'd like to vote on is Feature: build package. If you've done this with py2exe or other packages in the past then you could wire this directly into PTVS with our 2.1 release. This will give you a context menu on your project which will let you run the command from within the IDE.
To do this you'd modify your .pyproj file and add something like:
<PropertyGroup>
<PythonCommands>$(PythonCommands);PythonRunPyLintCommand</PythonCommands>
<PyLintWarningRegex>
<![CDATA[^(?<filename>.+?)\((?<line>\d+),(?<column>\d+)\): warning (?<msg_id>.+?): (?<message>.+?)$]]>
</PyLintWarningRegex>
</PropertyGroup>
<Target Name="PythonRunPyLintCommand"
Label="Run PyLint"
DependsOnTargets="ResolveStartupPath"
Returns="#(Commands)">
<CreatePythonCommandItem Target="pylint.lint"
TargetType="module"
Arguments=""--msg-template={abspath}({line},{column}): warning {msg_id}: {msg}" -r n #(Compile, ' ')"
WorkingDirectory="$(WorkingDirectory)"
ExecuteIn="output"
RequiredPackages="pylint>=1.0.0"
WarningRegex="$(PyLintWarningRegex)">
<Output TaskParameter="Command" ItemName="Commands" />
</CreatePythonCommandItem>
</Target>
This example is shelling out to PyLint but you can change TargetType to executable/script/code or pip to execute different things. And you can change ExecuteIn to console, output, or repl to have the output show up in various different locations.

Deploying custom resource through DSC PullServer fails to extract the module

I've set up a DSC PullServer on Server 2008 R2 and I've run into an issue deploying a custom module. The module on the PullServer is in C:\Program Files\WindowsPowerShell\Modules\NTFSPermission, I've zipped everything using Windows Explorer (and 7-zip) and placed the zip in C:\Program Files\WindowsPowerShell\DscService\Modules\NTFSPermission_1.0.zip, I create a checksum using NEW-DSCChecksum for the zip file and I've got Import-DSCResource NTFSPermission in my node configuration. When I run the Invoke-CimMethod to push the config to a node it errors out with:
Invoke-CimMethod : Failed to extract the module from zip file
C:\Windows\TEMP\\635291179507191263\NTFSPermission_1.0.zip downloaded by Download
Manager WebDownloadManager.
The node logs a 4104 error in the event viewer reading:
This event indicates that failure happens when LCM is trying to get the configuration from pull server using download manager WebDownloadManager. ErrorId is 0x1. ErrorDetail is Failed to extract the module from zip file C:\Windows\TEMP\\635291179507191263\NTFSPermission_1.0.zip downloaded by Download Manager WebDownloadManager.
Has anyone else run into this? I'm not sure if there's a config file somewhere that is literally piping in an extra backslash and causing an invalid download/extraction path or if there is something wrong with the zipped module. If I move the module over manually the config will be pushed and apply successfully, which leads me to believe it's not the module.
There is a known issue with extracting zip files created using .NET compression class in 4.5. The workaround is to use the shell method of compressing files. That is, send to compressed archive option in right-click context menu or using Shell COM object.
I tested one of the modules from the DSC Resource Kit and it extracted with no problems on the desired node. I tracked the problem down to the psd file that the author created for their DSC-Resource. I updated the CLRVersion to require 4.0 and removed RequiredModules, RequiredAssemblies, ScriptsToProcess, TypesToProcess,FormatsToProcess and NestedModules (all were empty values anyway), pushed the config without the workaround and it downloaded and extracted the resource.

Running phpdoc through Phing, phpdocumentor.ini location

I'm rebuilding my xampp and CI environment (on win7) from scratch but am having trouble running phpdoc through phing. In particular, Phing is looking to phpdocumentor.ini in a place that doesn't exist (and never has).
Phing and PhpDocumentor have both been installed through Pear, paths setup seems fine, and have these versions:
php version 5.4.7
pear version 1.9.4
phpdoc version 2.0.1
phing version 2.6.1
Relevant paths on the system are:
H:\xampp\php;
H:\xampp\php\pear;
On my sample project:
I can run phpdoc without a hitch, for example: phpdoc -d apps -t docs runs fine.
Here's my phpdoc task, which has worked well in the past:
<phpdoc title=Docs" destdir="${docsdir}" sourcecode="false" output="HTML:frames:earthli">
<fileset dir="./apps">
<include name="**/*.php" />
</fileset>
<projdocfileset dir=".">
<include name="README" />
<include name="INSTALL" />
<include name="CHANGELOG" />
</projdocfileset>
</phpdoc>
When I run Phing, phpdoc fails with the following notice:
Parsing configuration file phpDocumentor.ini...
(found in C:\php\pear\data/PhpDocumentor/)...
ERROR: cannot open phpDocumentor.ini in directory
-Is phpdoc in either the path or include_path in your php.ini file?
There is no c:\php... directory, and never has been, so I don't know where this has come from.
I can only get this working if I create the whole PHPDocumentor structure Phing anticipates on C: but I'd ideally like to get the ini file's anticipated location changed so I have everything on the one drive.
Is there any way I can inform Phing of the true location of my phpdocumentor.ini?
I've not found this specific problem listed on SO, but am hopeful someone else has seen and rectified this. The Phing site docs/forum/trac don't list any recent reports of this problem.
Thanks all
It looks like you're trying to use phpDocumentor 2.x and seeing some behavior from what looks like phpDocumentor 1.x. Perhaps there is some 1.x code that came with the XAMPP source that is lingering and affecting your ability to run 2.x cleanly.
In considering the Phing angle, in glancing at the Phing manual, it looks like the correct Phing task to use for phpDocumentor 2.x is the DocBlox task [1] rather than the old PhpDoc task.
[1] -- http://www.phing.info/docs/guide/stable/apcs52.html.
Downloading the latest zip archive release of XAMPP for Windows I see that the file:
\xampp\php\pear\PhpDocumentor\phpDocumentor\Setup.inc.php
the function parseIni() refers directly to the aforementioned path:
enter code herephpDocumentor_out(" (found in " . 'C:\php\pear\data/PhpDocumentor' . PATH_DELIMITER . ")...\n");
So its more likely to be a XAMPP problem than any of the components I've been upgrading or force-reinstalling.

Phing - Deploy with FTP but only overwrite when size has changed

I am using Phing and right now I am using this code to upload my files to FTP:
<target name="ftp.upload">
<echo>Uploading files to FTP</echo>
<ftpdeploy
host="${ftp.destination.host}"
port="${ftp.destination.port}"
username="${ftp.destination.username}"
password="${ftp.destination.password}"
dir="${ftp.destination.dir}"
mode="${ftp.destination.mode}">
<fileset refid="TheFiles" />
</ftpdeploy>
<echo>FTP Upload Finished!</echo>
</target>
It takes a long time to load, and I have a lot of images - so every time I make a small text change, I don't want it to re-upload everything. Is there a way to detect which files has been changed and only upload those?
Thanks!
This is a little late ... but you CAN actually do this with Phing. This requires a few steps:
Define a date property to go off from. This will be necessary at the end when you're saving last build date for future builds
< tstamp>
< format property="builddate" pattern="%m/%d/%Y" />
< format property="buildtime" pattern="%I:%M %p" />
< /tstamp>
Define lastbuilddate property. Define it to something way back. Then include a file (will be created at the end of your run) with the same property. If file exists (2nd run and after), it will override the setting you defined with whatever the last date was
< property name="lastbuilddate" value="01/01/1970 12:00 AM" />
< property file="$.\lastbuild.properties" override="true"/>
Include date task in your fileset definition. That specifies to only pick files that have last modified date AFTER your last build date
< fileset id="TheFiles" > < date datetime="${lastbuilddate}"
when="after"/> < / fileset>
Run your ftp for the TheFiles fileset
Update the lastbuild.properties file with the latest run date. Noticed that we're using date/time properties defined initially.
< echo msg="lastbuilddate=${builddate} ${buildtime}" file="$./lastbuild.properties" append="false" />
Every time you run your target, it will only ftp files that were changed since the date specified in lastbuilddate property
I'm afraid there's no way to achieve this using FTP unless YOU maintain some kind of list of modified files. So you'd be better off using rsync. There's a solution already available for phing: http://blog.fedecarg.com/2008/07/21/filesynctask-using-phing-to-synchronize-files-and-directories/
I wrote down a perl script that does it with a svn repository
( http://svnftpdeploy.sourceforge.net/ ... I do not know what I wrote in english)
It requires a local directory to get files from svn, another to to get files from ftp (the changed in the next svn release), a local file for store last uploaded svn release, a local directory to store changed file list from ftp. And it interactively ask for action in case of conflict (someone changed file in server independently from your deploy script).
Now I am switching to phing and git, the hard part would be to manage interactivity, I think I would manage it with -D= for the target deploy (with -Dconflictaction=stop,viewdiff,viewdiffanddeploy,ignore or such a thing).
You can use git-ftp or dandelion to upload just the changes via ftp. I guess it is not so hard to use one of them with phing...
Have you tried using the depends="true" attribute of FtpDeployTask?
If depends is set to true, the task will only update files with a local modification timestamp that is newer than the corresponding timestamp on the server.
Sadly, this doesn't seem to work for me: all files are being transferred.

Resources