Class: Ufo::Param

Inherits:
Object
  • Object
show all
Extended by:
Memoist
Defined in:
lib/ufo/param.rb

Instance Method Summary collapse

Constructor Details

#initializeParam

Returns a new instance of Param.



8
9
10
# File 'lib/ufo/param.rb', line 8

def initialize
  @params_path = "#{Ufo.root}/.ufo/params.yml"
end

Instance Method Details

#dataObject



12
13
14
15
16
17
# File 'lib/ufo/param.rb', line 12

def data
  upgrade_message!

  result = RenderMePretty.result(@params_path, context: template_scope)
  YAML.load(result)
end

#template_scopeObject



20
21
22
# File 'lib/ufo/param.rb', line 20

def template_scope
  @template_scope ||= Ufo::TemplateScope.new(Ufo::DSL::Helper.new, nil)
end

#upgrade_message!Object

Ufo version 3.3 to 3.4 added a concept of a .ufo/params.yml file to support fargate: github.com/tongueroo/ufo/pull/31

Warn user and tell them to run the ‘ufo upgrade3_3_to_3_4` command to upgrade.



28
29
30
31
32
33
34
35
36
37
# File 'lib/ufo/param.rb', line 28

def upgrade_message!
  return if File.exist?(@params_path)

  puts "ERROR: Your project is missing the .ufo/params.yml.".colorize(:red)
  puts "This was added in ufo version 3.4 for Fargate support: https://github.com/tongueroo/ufo/pull/31"
  puts "You can find more info about the params file here: http://ufoships.com/docs/params/"
  puts "To upgrade run:"
  puts "  ufo upgrade3_3_to_3_4"
  exit 1
end