jsontemplate 0.2.0 → 0.3.0

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: 341367051a162f6aa01706ffa58ea3a298870438
4
- data.tar.gz: db0ebf309531391d9b8de428582202bbd1cbb746
3
+ metadata.gz: e973f4782b9b49398b971d7a06d9c2e4bd650507
4
+ data.tar.gz: cba28240636fd024c12ff89dcbf36ea59af936f6
5
5
  SHA512:
6
- metadata.gz: 49d81e57206b00c714e20f17c88b10089f9f877f41f07469076c09f17b869f7752426151a63e27b68939bd7ddd6e18cd90e20f3e3836f88d51fa2b3117e8ac1e
7
- data.tar.gz: b2de6bc3d5f681e751e9ff5e0b2bfbb22ee4627aa4f8ce99a93435128d43717a77e69f553d4634fb0c952ba9762172c7ea642aa90a53d61b5f26fdb972f9adda
6
+ metadata.gz: 74c098eb69e20f99ee8fae5ad5aef728a777468626dcb2f5c61c6a7e9971ab45e09598f40cf39608c7ca64adf02247a3b4e0c94c1f2cde8338a598968aa8a7c6
7
+ data.tar.gz: 1da023d5075fd4f43ab9ace8f98207ae5acb8d84d492857dae358a62f8f4c25dc188df4f204c87754513223a2c0dffbb98c65b9c8b680339b8dd7967a4b1468d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jsontemplate (0.2.0)
4
+ jsontemplate (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  class JsonTemplate
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/jsontemplate.rb CHANGED
@@ -3,12 +3,16 @@ require "jsontemplate/version"
3
3
 
4
4
  class JsonTemplate
5
5
  attr_reader :json
6
+ attr_accessor :properties_file, :secrets_file
6
7
 
7
8
  def initialize(src, path=nil)
8
9
  path ||= src.kind_of?(String) ? src : nil
9
10
  @path = path || (src.respond_to?(:path) ? src.path : nil)
10
11
  @dir = File.expand_path(path ? File.dirname(path) : ".")
11
12
 
13
+ @properties_file = File.join(@dir,"properties.json")
14
+ @secrets_file = File.join(@dir,"secrets.json")
15
+
12
16
  data = src.respond_to?(:read) ? src.read : File.read(src)
13
17
  @json = JSON.load(data)
14
18
  end
@@ -39,6 +43,10 @@ class JsonTemplate
39
43
  process_dirmerge(v)
40
44
  elsif k == "$FLookup"
41
45
  process_flookup(*v)
46
+ elsif k == "$Prop"
47
+ process_flookup(@properties_file, v)
48
+ elsif k == "$Secret"
49
+ process_flookup(@secrets_file, v)
42
50
  elsif k[0] == "$"
43
51
  raise "Unknown directive #{k}"
44
52
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsontemplate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vidar Hokstad
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-15 00:00:00.000000000 Z
11
+ date: 2016-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry