Conditionals for file creation
See original GitHub issueThe current version supports conditionals inside files, but not about files. That is, I can include or exclude blocks of text depending on the truthiness of a value. I cannot, however, create files only if a certain value is truthy.
This would be hugely helpful in at least one case: the template I’m working on will support multiple deployment options (raw JAR, AWS, debian package…). Each method needs different files to be present in different paths.
Currently, I can either include everything and ask developers to manually delete what’s irrelevant, or include nothing and point them to a repo that contains the right files.
Ideally, they’d just answer a question (use AWS? [YES/no]
) and everything would be set up.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:14 (4 by maintainers)
Top Results From Across the Web
File input and output and conditionals - Elhanan Borenstein Lab
Take as arguments: 1) a string to find, 2) a string to replace with, 3) input file name, 4) output file name. You...
Read more >Conditional Create File - NI Community - National Instruments
I would like to somehow create a conditional create file. Like this way a user can press a boolean button and that will...
Read more >Lab 2: Conditionals and File I/O - University of Pittsburgh
In this lab you will learn about file i/o and at the same, you'll apply what you've already learned about conditional execution. OBJECTIVES....
Read more >Conditional creation of files - global or scoped filehandle
You want to open a handle in a condition, then use the handle globally elsewhere. What if you don't open the file? Do...
Read more >Document how to do conditional files/directories #723 - GitHub
Use logic in directory names to set whether or not something is created. (Only works in Linux/OSX).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@notmu Thanks for the example, but it doesn’t seem to work for me. I see some strange behavior. I have this layout:
If I set
use_sql
toyes
during project creation I see the expected layout:resources/sql_scripts/db_script.sql
. However, if I useno
to set the value ofuse_sql
I see the following layout in the output project:resources/db_script.sql
. The filedb_script.sql
still gets included in the project, directly underresources
.Am I misunderstanding your example, or doing something wrong?
@ihostage I see, sorry for disturb actually my bad - I was using sbt which was older version since it was installed long time ago (1.3.3) running as
sbt -sbt-version 1.5.3 new ...
solves the problem