Conversation
!feature * **Add `file::with_tmpfile()` function** Create a temporary file and execute the block with the filename created as an argument. The file is deleted after the block execution. This will only operate on the machine you run Bolt on.
|
|
|
Interesting. We have something similar in BoltSpec bolt/spec/lib/bolt_spec/files.rb Line 7 in 4b30c39 |
Consider the case: There are 2 things:
If we can deal with both cases I'm fine to reuse the BoltSpec code :-D Actually I'm totally ok to not include this function into the Boltlib ( |
|
I dont understand the example? What do you need with an empty file in run_command? I guess, for me the only use case I can think of for a "with temp file" you would know the content of the file (or be generating it) explicitly for consumption by something else. Therefore, why would we need a temp file to exist with no way to modify the content? As far as the return type etc, yeah that would be changed, i was more getting at the use case here and pointing out that we probably would want to have the argument to write content. |
I mean that the file content may be generated by a command, taking the file name as an argument. In this case the file content is not known in advance. Though, to be honest, for now it's purely "synthetic" case. I'm not sure how many ppl might have this requirement. |
!feature
file::with_tmpfile()function Create a temporary file and execute the block with the filename created as an argument. The file is deleted after the block execution. This will only operate on the machine you run Bolt on.