class EnvironmentJsonDataSource
Constants
- VERSION_KEY
Public Instance Methods
global_values()
click to toggle source
# File lib/tiller/data/environment_json.rb, line 29 def global_values if @json_version < 2 @json_structure else if @json_structure.has_key?('global') @json_structure['global'] else Hash.new end end end
setup()
click to toggle source
# File lib/tiller/data/environment_json.rb, line 9 def setup if ENV.has_key?('tiller_json') begin parse = JSON.parse(ENV['tiller_json']) @json_structure = parse.is_a?(Hash) ? parse : Hash.new if @json_structure[VERSION_KEY].is_a? Integer @json_version = @json_structure[VERSION_KEY] Tiller::log.debug("Using v#{@json_version} tiller_json format") else @json_version = 1 end rescue JSON::ParserError Tiller::log.warn('Warning : Error parsing tiller_json environment variable') end else @json_structure = Hash.new @json_version = 1 end end
values(template_name)
click to toggle source
# File lib/tiller/data/environment_json.rb, line 41 def values(template_name) if @json_version < 2 return Hash.new end if @json_structure.has_key?(template_name) return @json_structure[template_name] else return Hash.new end end