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 +4 -4
- data/lib/canzea/version.rb +1 -1
- data/lib/canzea.rb +6 -0
- data/lib/template-runner.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91cd9e9146a2faf57e2e946c390dadee9d123f06
|
4
|
+
data.tar.gz: 462290877c5c4d69ef7e379d7f54da0bb6b0f25b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3026e8ae33d4c6b90c364b191f3ee4a883360f67bf4dec441a06ef51c9387c3302e6f7185b48bcba0c2a272d1c26bb21c9d3d6f2036deeca67b8113cdb8c2663
|
7
|
+
data.tar.gz: c78d9556327abc9905a794f7a2644b4bd61b39b3768522cd44a7aa0fdbc7e017ca0bf0dc42c2fd3f495bef5b38bf2c483533589ae7f2824aa16a6ab000aa0cbb
|
data/lib/canzea/version.rb
CHANGED
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
|
data/lib/template-runner.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2018-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|