consul-templaterb 1.8.0 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6f546cec480feae29069b3458138d65bdeacc686b5a0e2a0e6762a306ee7cbe
4
- data.tar.gz: edad0a361f2bfc627994e05ea590cb5c1f62c81a1f25aeaaad9c150110e0ed5c
3
+ metadata.gz: 4575bd9573abe22918149095549c1942aba92f447bc57c9bf466e3f4e692955f
4
+ data.tar.gz: e0f1daefa7fd071b16becceeb955acbf465a8c63f09a787161ea26786342be5e
5
5
  SHA512:
6
- metadata.gz: d4882996d68193413e3b9b2cacdb182c14cd6c952b6a53397488689d140e90ce0b6f7cefd898028d85e0cb22114c9a53b1c6333fd06aaa50d73dcc9158560836
7
- data.tar.gz: 8cbeeda5ae647a91fe9744a5240c0113f216c29613e802f58ec8ffcbb5b49d632192573fe0e4fd1dc357c498d48c81935d38f3f58886bd72c0d37270100efa7f
6
+ metadata.gz: d06c13276838fc70fd31beeac8875b89f9b80b9efde59614be9b6b0f272e8fba819ef40424ff3b6f0a300f1f17eb719f16b66dd697b86193e3a3c7b92ea79a11
7
+ data.tar.gz: 4664f4a357a97d5f3047a328aa4907b08d4dab11d570a961cde0e51d0ac4453649ddb97d76cda113509e93ed43f99c96f69b86d50872d1ab38e2285a811e0f60
data/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  ## (UNRELEASED)
4
4
 
5
+ ## 1.8.1 (December 12, 2018)
6
+
7
+ BUGFIX:
8
+
9
+ * Properly fill `template_info` strtucture when hot reload is performed so templates using
10
+ `template_info()` new function can behave nicely.
11
+
12
+ NEW FEATURES:
13
+
14
+ * template_info now includes `hot_reloading_in_progress: true` when the hotreloading is in progress.
15
+
5
16
  ## 1.8.0 (December 11, 2018)
6
17
 
7
18
  NEW FEATURES:
data/TemplateAPI.md CHANGED
@@ -383,15 +383,6 @@ secret('secret/foo', [force_ttl: intInSecond])
383
383
  It returns information about current template being rendered.
384
384
  The information returned has the following structure:
385
385
 
386
- ```json
387
- {
388
- 'destination': destination_file_for_root_template
389
- 'source': absolute_path_to_template_file.erb
390
- 'source_root': absolute_path_to_root_template.erb
391
- 'was_rendered_once': true|false
392
- }
393
- ```
394
-
395
386
  - `destination`: absolute path where the file is gonna be written
396
387
  - `source`: the template absolute path file, most of the time, if will be
397
388
  equal to `source_root`, except when the current template is included
@@ -413,12 +404,22 @@ I am the file <%= File.basename(template_info['source']) %><%
413
404
  %> rendered as <%= File.basename(template_info['destination']) %>
414
405
  ```
415
406
 
407
+ #### Simple rendering
408
+
416
409
  The command `consul-template template_info.erb` would render:
417
- `I am the file template_info.erb rendered as template_info`
410
+
411
+ ```
412
+ I am the file template_info.erb rendered as template_info`
413
+ ```
414
+
415
+ #### Rendering with template included into another
418
416
 
419
417
  If creating a file called include.erb with contents: `<%= render_file('template_info.erb') %>`,
420
418
  the command `consul-templaterb --template include.erb:destination_file.txt` would render:
421
- `I am the file template_info.erb included from template include.erb rendered as destination_file.txt`
419
+
420
+ ```
421
+ I am the file template_info.erb included from template include.erb rendered as destination_file.txt`
422
+ ```
422
423
 
423
424
  </div>
424
425
  </details>
@@ -80,13 +80,11 @@ module Consul
80
80
  new_time = File.ctime(template_file)
81
81
  if template_file_ctime != new_time
82
82
  begin
83
- current_template_info = {}
84
- current_template_info.!merge(current_template_info)
85
- current_template_info['ready'] = false
83
+ current_template_info = _build_default_template_info.merge('ready' => false, 'hot_reloading_in_progress' => true)
86
84
  @template_file_ctime = new_time
87
85
  return update_template(load_template, current_template_info: current_template_info)
88
86
  rescue Consul::Async::InvalidTemplateException => e
89
- STDERR.puts "****\n[ERROR] HOT Reload of template #{template_file} did fail due to:\n #{e}\n****\n"
87
+ STDERR.puts "****\n[ERROR] HOT Reload of template #{template_file} did fail due to:\n #{e}\n****\n template_info: #{current_template_info}\n****"
90
88
  raise e unless hot_reload_failure == 'keep'
91
89
  STDERR.puts "[WARN] Hot reload of #{template_file} was not taken into account, keep running with previous version"
92
90
  end
@@ -1,5 +1,5 @@
1
1
  module Consul
2
2
  module Async
3
- VERSION = '1.8.0'.freeze
3
+ VERSION = '1.8.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: consul-templaterb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - SRE Core Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-11 00:00:00.000000000 Z
11
+ date: 2018-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: em-http-request
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  version: '0'
229
229
  requirements: []
230
230
  rubyforge_project:
231
- rubygems_version: 2.7.7
231
+ rubygems_version: 2.7.8
232
232
  signing_key:
233
233
  specification_version: 4
234
234
  summary: Implementation of Consul template using Ruby and .erb templating language