How to skip certain files when running `cookiecutter --replay`? - cookiecutter

If I make a change to my cookiecutter template I like to use cookiecutter --replay (or --replay-file) to update my existing projects with the new template changes. When doing this, how can I skip certain files?
For example one thing my template contains is a requirements/ directory containing Python requirements files:
requirements/
main.in
main.txt
tests.in
tests.txt
It's useful for the template to output a starter set of requirements files when generating a new project. But the project will almost certainly modify these files whenever it adds or upgrades requirements so when replaying the template I would not want to overwrite the requirements files with the original starter ones. That would just delete any dependencies that've been added to the project since its inception.
I'm aware of --skip-if-file-exists but I don't want to skip all existing files, only the ones in the requirements/ dir.
The only solution that comes to mind immediately is to omit the requirements dir from the project template and use a post-generate hook to write out the starter requirements files only if they don't already exist.
But I wonder if there's a way to get cookiecutter to do this for me, without having to write it in Python myself?
For example is there some way to give cookiecutter --replay a list of files and directories to skip if they already exist?

Related

How to delete files with `cookiecutter --replay`?

If I modify my cookiecutter template and remove a file from the template, is it possible to get cookiecutter --replay to delete the removed file from projects when I replay the template over them?
I didn't see anything about this in the docs. I suppose I could write a post-generate hook to delete the file (each time you delete a file from the template, add it to the list of files that the post generate hook will delete from projects).
But I wonder if there's a way to get cookiecutter to do this for me?

Installshield: file duplicate because of merge module

I have an InstallShield (2018, also happens in IS 11) setup with a lot of 3th party libraries. Among other things a merge module. This merge module have a file (call F).
Now, there is an other library as a directory with a bunch of different files, sadly also a file with the name "F".
I can't add this file:
A work around is creating a new merge module just containing this file and adding it to the feature. But the drawback is: When updating the libary directory, the merge module has also to be updated. But do I remember at this moment to this? What if other persons are doing this? So I want to avoid this work around. Is there a better way?
what worked for me is i removed merge module from the project and re-added them after adding files to the project.

Can you remove NetSuite Bundles after installation

I am working on a NetSuite instance that had custom(contractor/SuiteScript) work installed via a bundle, but it is not a third party product but made for this system. Now there are 2 listings in the dropdown for each file. In other words, if I am adding a file as a library, it shows up twice and I don't know which reference is the correct one to choose. I used search to find the duplicate file name is in the bundle install. Can I safely remove or delete the bundle? thanks any help is appreciated.
You cannot typically remove individual files from a bundle. If you do not need the functionality of the bundle anymore than you can remove it at your discretion by going to Customization>SuiteBundler>Search & Install Bundles>List, then under the action icon click 'Uninstall'.
I wouldn't try to delete a script library from a bundle folder. Even if you are uploading an identical library there may be references in the bundle scripts to the original library that will be broken when if you delete it.
If you are wondering which one you are selecting from the drop down one thing you could do is figure out the internal id of your library file then run a search on your script file that pulls in the library file id's and make sure that they match.

Installshield Installscript properties

We have Installshield 2009 for our product. I am trying to muddle my way through it to make some updates (obviously, I am not the original author).
Within, there is a fairly complex arrangement of components and files, plus, there is a script section for some custom work.
I need to accomplish the following, without creating a blank object in the repository.
One of the components needs to create a directory tree (two folders deep).
Within that tree (deepest folder), I need to create a blank file.
Questions:
Do I need to create two components, one for each directory level, or will the tree be created if I specify [INSTALLDIR]folder1\folder2?
I am thinking that the installscript would be the place to create the empty file, based on the CreateFile example in the help. I notice that, in the components page, that, once I typed the value for the Destination property, that a little "tag" of sorts appeared at the start {FOLDER2}. Can I used that tag as an argument to CreateFile and how would I reference it?
Regardless of the project type, I would probably suggest creating the folder structure in the Files and Folders view, and adding the empty file there. It's just simple and you'd be done with fewer chances of error.
As to the questions you asked, neither Basic MSI nor InstallScript projects require components for every folder level on the system. Note that if the folder isn't already there when it executes, the CreateFile approach is unlikely to create the folders for you.
In a Basic MSI project, {FOLDER2} indicates that FOLDER2 is the name of the directory entry, and after CostFinalize there will be a property of the same name that contains its run-time location. You can retrieve it in an InstallScript custom action with MsiGetProperty. In a pure InstallScript project the approach would be a little different, worst case it would be something like TARGETDIR ^ "folder1" ^ "folder2" (my InstallScript is rusty).

how to add directory to SupportFiles in InstallShield

Is there a possibility to add directory (with sub directories) to SupportFiles section in installshield. I have dynamically created content (list of files changes constantly) that I use to support my installation.
Is there any other method to add dynamically whole directory to installation package. I need files from this directory only during installation process. At the end of the installation I want IS to remove these files automatically ?
The ISSetupFile table ( which drives the Support Files pattern ) only supports extracting files to a single directory. There is no way in the UI to tell it to be dynamic although you could have a build automation step that reflects the contents of a directory and wires it up to the table using the automation interface. This still couldn't do sub directories though.
What you probably want to do is creating a self-extracting zip of the files you need as part of your build and add that EXE to Support Files. Then write custom actions that call the EXE to extract the payload to Support Files and another CA to clean it up. Look for the custom action ISSetupFilesExtract and ISSetupFilesCleanup to figure out the best way to do this.
Although I'm late to the party: #BuvinJ mentioned in a comment that you can add directories to "Advanced Files" under "Disk1." In this case, they do appear in the temporary directory (support directory), eg. SUPPORTDIR\Disk1
SUPPORTDIR is a temporary location where the installer dumps files, and cleans them up afterward. An example is C:\Users\<your user name>\AppData\Local\Temp\2\{F6B9B2D6-2A5A-4146-9297-E80A199CB0CB}.
This could be a quicker/cheaper/faster solution to writing custom actions and/or packaging up files by hand in, say, a self-extracting zip file.

Resources