Module: Ufo::Core

Included in:
Ufo
Defined in:
lib/ufo/core.rb

Constant Summary collapse

@@env =
nil

Instance Method Summary collapse

Instance Method Details

#check_task_definition!(task_definition) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/ufo/core.rb', line 6

def check_task_definition!(task_definition)
  task_definition_path = "#{Ufo.root}/.ufo/output/#{task_definition}.json"
  unless File.exist?(task_definition_path)
    puts "ERROR: Unable to find the task definition at #{task_definition_path}.".colorize(:red)
    puts "Are you sure you have defined it in ufo/template_definitions.rb and it has been generated correctly in .ufo/output?".colorize(:red)
    puts "If you are calling `ufo deploy` directly, you might want to generate the task definition first with `ufo tasks build`."
    exit
  end
end

#envObject



22
23
24
25
26
27
# File 'lib/ufo/core.rb', line 22

def env
  return @@env if @@env
  ufo_env = env_from_profile(ENV['AWS_PROFILE']) || 'development'
  ufo_env = ENV['UFO_ENV'] if ENV['UFO_ENV'] # highest precedence
  @@env = ufo_env
end

#rootObject



16
17
18
19
# File 'lib/ufo/core.rb', line 16

def root
  path = ENV['UFO_ROOT'] || '.'
  Pathname.new(path)
end