canzea 0.1.158 → 0.1.159

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
  SHA1:
3
- metadata.gz: f0bc1447d6fd96a26700a0c165699ec57e2cb83a
4
- data.tar.gz: 7c538e4f8d608f0a714f930aeda8b6cf53623839
3
+ metadata.gz: 91cd9e9146a2faf57e2e946c390dadee9d123f06
4
+ data.tar.gz: 462290877c5c4d69ef7e379d7f54da0bb6b0f25b
5
5
  SHA512:
6
- metadata.gz: 034d18fc801c279626e7fd075a2b3ea0ffb7809ead60f76973b4ed2223d7ece5569951dff7cf3dbd9c90aa05899a74be18dd64cfbe1e41c5623ba71220a785f1
7
- data.tar.gz: ca0722ff4549fb9a501dee768b7e157b96a7c677cada60c3687aee7d0b32317bec1fe74cab7ca6a8fb2722315a0970059121e07a164d23f9b8a9071e8062bfc8
6
+ metadata.gz: 3026e8ae33d4c6b90c364b191f3ee4a883360f67bf4dec441a06ef51c9387c3302e6f7185b48bcba0c2a272d1c26bb21c9d3d6f2036deeca67b8113cdb8c2663
7
+ data.tar.gz: c78d9556327abc9905a794f7a2644b4bd61b39b3768522cd44a7aa0fdbc7e017ca0bf0dc42c2fd3f495bef5b38bf2c483533589ae7f2824aa16a6ab000aa0cbb
@@ -1,3 +1,3 @@
1
1
  module Canzea
2
- VERSION = "0.1.158"
2
+ VERSION = "0.1.159"
3
3
  end
data/lib/canzea.rb CHANGED
@@ -180,6 +180,12 @@ module Canzea
180
180
  }
181
181
  end
182
182
 
183
+ if (util == "gen-template")
184
+ t = Template.new
185
+ # canzea --util=gen-template --template="a={{#tf_name}}name{{/tf_name}} {{gravatar}}" --args='{"name":"grafana.mon"}'
186
+ puts t.processString opts[:template], JSON.parse(opts.fetch(:args, '{}'))
187
+ end
188
+
183
189
  if (util == "gen-user")
184
190
  GenUser.new.do(args[0])
185
191
  end
@@ -1,7 +1,17 @@
1
1
  require 'json'
2
2
  require 'mustache'
3
3
 
4
+
5
+ module ViewHelpers
6
+ # {{#tf_name}}name{{/tf_name}}
7
+ def tf_name(name)
8
+ self[name].sub! '.', '-'
9
+ end
10
+ end
11
+
4
12
  class Template < Mustache
13
+ include ViewHelpers
14
+
5
15
  def processAndWriteToFile (template, output, parameters)
6
16
  contents = process template, parameters
7
17
  File.write(output, contents)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canzea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.158
4
+ version: 0.1.159
5
5
  platform: ruby
6
6
  authors:
7
7
  - Canzea Technologies
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-14 00:00:00.000000000 Z
11
+ date: 2018-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler