bozo-scripts 0.18.4 → 0.18.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 285bd2051ad69e984a46e8043b0d45c26a101fc0
4
- data.tar.gz: 22b6f9098371e2aa17eccdd551f778b5a8a18739
3
+ metadata.gz: 70e2b7d9448abedc68f4a9f16234a13c73ba18b1
4
+ data.tar.gz: 5e4c688f3a2a905bad80a260924ce2afd2ce5d46
5
5
  SHA512:
6
- metadata.gz: 0dc41e8d21bd6f1821ffdc87225359568d2c19bbea9003122ecbf6223b89510bbcd2f4dd729b2a69ea3c8fc961aedc9f110397915e65762a94355db6b303ba85
7
- data.tar.gz: d5e356942be5e7e72a1db0f3a659c10d6f03863c249717fe4e77a822f5bce438637defd1c7639b46e9c756bc43be51835cc45198d236971cdb0478784f1b239b
6
+ metadata.gz: 1d501fdd61ae9a2a34127fb5f6d803f499bfd58c3fbc686e779b5f15873eff2975dbd79600a678524e6c09cdedf697e44f2bc55d1d345987a63b3ddb806b83f9
7
+ data.tar.gz: ba0482c12d6eb4c992674487ade96d7355798db0e8bcad3fc1bbbfd49a9a8c7d601dc18f215e81a232ba3de2f73b0a7a3704e0a6ae95ce374961083e931f196a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.18.4
1
+ 0.18.5
@@ -96,7 +96,16 @@ module Bozo
96
96
  # A block that will be called with the template path and target file
97
97
  # path when provided.
98
98
  def generate_files(&block)
99
- @templates.each {|template| generate_file template, block}
99
+ @templates.each {|template| generate_file template, block, false}
100
+ end
101
+
102
+ # Generate all the files matching the underlying configuration, preserving line-endings.
103
+ #
104
+ # @param [Proc] block
105
+ # A block that will be called with the template path and target file
106
+ # path when provided.
107
+ def generate_binary_files(&block)
108
+ @templates.each {|template| generate_file template, block, true}
100
109
  end
101
110
 
102
111
  private
@@ -110,7 +119,10 @@ module Bozo
110
119
  # @param [Proc] block
111
120
  # A block that will be called with the template path and target file
112
121
  # path when provided.
113
- def generate_file(template_path, block)
122
+ # @param [Boolean] write_binary
123
+ # Forces the output file to keep its line-endings as-is
124
+ #
125
+ def generate_file(template_path, block, write_binary = false)
114
126
  target_path = template_path.sub /\.[^\.]+$/, ''
115
127
 
116
128
  block.call(template_path, target_path) unless block.nil?
@@ -120,9 +132,13 @@ module Bozo
120
132
 
121
133
  content = @configuration.apply {|binding| template.result(binding)}
122
134
 
123
- File.open(target_path, 'w+') {|f| f.write(content)}
135
+ if write_binary
136
+ File.open(target_path, 'wb') {|f| f.write(content)}
137
+ else
138
+ File.open(target_path, 'w+') {|f| f.write(content)}
139
+ end
124
140
  end
125
141
 
126
142
  end
127
143
 
128
- end
144
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bozo-scripts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.4
4
+ version: 0.18.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garry Shutler
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-14 00:00:00.000000000 Z
12
+ date: 2017-08-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri