Skip to content

Commit e1402ca

Browse files
committed
Preserve trailing newline
1 parent 2b50ab1 commit e1402ca

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ Do not edit this file. Edit 'docs/templates/README.md.j2' instead and run 'make
2626

2727
| OS | Arch | Version | |
2828
| ------------ | ------- | --------------------- | ---- |
29-
| OSX (Darwin) | x86_64 | 1.0.1 (latest) | [Download](https://github.com/busyloop/envcat/releases/tag/v1.0.1) |
30-
| Linux | x86_64 | 1.0.1 (latest) | [Download](https://github.com/busyloop/envcat/releases/tag/v1.0.1) |
31-
| Linux | aarch64 | 1.0.1 (latest) | [Download](https://github.com/busyloop/envcat/releases/tag/v1.0.1) |
29+
| OSX (Darwin) | x86_64 | 1.0.2 (latest) | [Download](https://github.com/busyloop/envcat/releases/tag/v1.0.2) |
30+
| Linux | x86_64 | 1.0.2 (latest) | [Download](https://github.com/busyloop/envcat/releases/tag/v1.0.2) |
31+
| Linux | aarch64 | 1.0.2 (latest) | [Download](https://github.com/busyloop/envcat/releases/tag/v1.0.2) |
3232

3333
#### Dockerfile
3434

35-
See the [download page](https://github.com/busyloop/envcat/releases/tag/v1.0.1) for an example Dockerfile. :whale:
35+
See the [download page](https://github.com/busyloop/envcat/releases/tag/v1.0.2) for an example Dockerfile. :whale:
3636

3737

3838
## Usage
@@ -261,3 +261,4 @@ export B=world
261261
3. Commit your changes (`git commit -am 'Add some feature'`)
262262
4. Push to the branch (`git push origin my-new-feature`)
263263
5. Create a new Pull Request
264+

shard.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: envcat
2-
version: 1.0.1
2+
version: 1.0.2
33

44
authors:
55

src/envcat/format/j2.cr

+4-2
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@ module Envcat
3737
def write(env)
3838
Crinja::Undefined.strict = @@strict
3939

40-
crinja = Crinja.new
40+
crinja = Crinja.new(Crinja::Config.new(keep_trailing_newline: true))
4141

4242
crinja.filters["split"] = Crinja.filter({on: nil}) { target.to_s.split(arguments["on"].to_s) }
4343
crinja.filters["b64encode"] = Crinja.filter { Base64.strict_encode(target.to_s) }
4444
crinja.filters["b64encode_urlsafe"] = Crinja.filter { Base64.urlsafe_encode(target.to_s) }
4545
crinja.filters["b64decode"] = Crinja.filter { Base64.decode_string(target.to_s) }
4646

47-
crinja.from_string(@io_in.gets_to_end).render(@io, env.as(Envcat::Env))
47+
buf = IO::Memory.new(16384)
48+
IO.copy(@io_in, buf)
49+
crinja.from_string(buf.to_s).render(@io, env.as(Envcat::Env))
4850
end
4951
end
5052
end

0 commit comments

Comments
 (0)