Class: Ufo::Setting::Profile
- Inherits:
-
Object
- Object
- Ufo::Setting::Profile
- Extended by:
- Memoist
- Defined in:
- lib/ufo/setting/profile.rb
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(type, profile = nil) ⇒ Profile
constructor
A new instance of Profile.
Constructor Details
#initialize(type, profile = nil) ⇒ Profile
Returns a new instance of Profile.
5 6 7 8 |
# File 'lib/ufo/setting/profile.rb', line 5 def initialize(type, profile=nil) @type = type.to_s # cfn or network @profile = profile end |
Instance Method Details
#data ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ufo/setting/profile.rb', line 10 def data names = [ @profile, # user specified Ufo.env, # conventional based on env "default", # fallback to default ].compact.uniq paths = names.map { |name| "#{Ufo.root}/.ufo/settings/#{@type}/#{name}.yml" } found = paths.find { |p| File.exist?(p) } unless found puts "#{@type.camelize} profile not found. Please double check that it exists. Checked paths: #{paths}" exit 1 end text = RenderMePretty.result(found) YAML.load(text).deep_symbolize_keys end |