-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
filer.Filer
to write template instantiation (#1911)
## Changes Prior to this change, the output directory was part of the `renderer` type and passed down to every `file` it produced. Every file knew its absolute destination path. This is incompatible with the use of a filer, where all operations are automatically anchored to some base path. To make this compatible, this change updates: * the `file` type to only know its own path relative to the instantiation root, * the `renderer` type to no longer require or pass along the output directory, * the `persistToDisk` function to take a context and filer argument, * the `filer.WriteMode` to represent permission bits ## Tests * Existing tests pass. * Manually confirmed template initialization works as expected.
- Loading branch information
Showing
10 changed files
with
161 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package filer | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestWriteMode(t *testing.T) { | ||
assert.Equal(t, 512, int(OverwriteIfExists)) | ||
assert.Equal(t, 1024, int(CreateParentDirectories)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.