Sha256: bdb01a42a300a56fcbaaa064e53390bc3f37e6248b770eef4bd4b81d9c7f2462
Contents?: true
Size: 1.97 KB
Versions: 4
Compression:
Stored size: 1.97 KB
Contents
if String.instance_methods.include?(:force_encoding) $string_encodings = true else # KCODE is gone in 1.9-like implementations, but we # still need to set it for 1.8. $KCODE = 'U' $string_encodings = false end $LOAD_PATH.unshift File.expand_path('vendor/thor/lib', File.dirname(__FILE__)) $LOAD_PATH.unshift File.expand_path('vendor/systemu/lib', File.dirname(__FILE__)) $LOAD_PATH.unshift File.expand_path('vendor/escape/lib', File.dirname(__FILE__)) $LOAD_PATH.unshift File.expand_path('vendor/multi_json/lib', File.dirname(__FILE__)) require 'escape' require 'multi_json' require 'engineyard-serverside/version' require 'engineyard-serverside/about' require 'engineyard-serverside/strategies/git' require 'engineyard-serverside/task' require 'engineyard-serverside/server' require 'engineyard-serverside/deploy' require 'engineyard-serverside/deploy_hook' require 'engineyard-serverside/cli' require 'engineyard-serverside/configuration' require 'engineyard-serverside/deprecation' require 'engineyard-serverside/shell' module EY module Serverside RemoteFailure = Class.new StandardError def self.node @node ||= deep_indifferentize(MultiJson.load(dna_json)) end def self.dna_json @dna_json ||= read_encoded_dna end private # doesn't work how people think, but hey.. def self.deep_indifferentize(thing) if thing.kind_of?(Hash) indifferent_hash = Thor::CoreExt::HashWithIndifferentAccess.new thing.each do |k, v| indifferent_hash[k] = deep_indifferentize(v) end indifferent_hash elsif thing.kind_of?(Array) thing.map {|x| deep_indifferentize(x)} else thing end end def self.dna_path '/etc/chef/dna.json' end def self.read_encoded_dna json = if File.exist?(dna_path) `sudo cat #{dna_path}` else '{}' end json.force_encoding('UTF-8') if $string_encodings json end end end
Version data entries
4 entries across 4 versions & 1 rubygems