Module: Ufo::Core
- Extended by:
- Memoist
- Includes:
- Settings
- Included in:
- Ufo
- Defined in:
- lib/ufo/core.rb
Instance Method Summary
collapse
Methods included from Settings
#cfn, #network, #settings
Instance Method Details
#check_task_definition!(task_definition) ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/ufo/core.rb', line 9
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}.".color(:red)
puts "Are you sure you have defined it in .ufo/task_definitions.rb and it has been generated correctly in .ufo/output?".color(:red)
puts "If you are calling `ufo deploy` directly, you might want to generate the task definition first with `ufo tasks build`."
exit 1
end
end
|
#check_ufo_project! ⇒ Object
53
54
55
56
57
58
59
60
61
|
# File 'lib/ufo/core.rb', line 53
def check_ufo_project!
check_path = "#{Ufo.root}/.ufo/settings.yml"
unless File.exist?(check_path)
puts "ERROR: No settings file at #{check_path}. Are you sure you are in a project with ufo setup?".color(:red)
puts "Current directory: #{Dir.pwd}"
puts "If you want to set up ufo for this prjoect, please create a settings file via: ufo init"
exit 1 unless ENV['TEST']
end
end
|
#env ⇒ Object
24
25
26
27
28
29
|
# File 'lib/ufo/core.rb', line 24
def env
ufo_env = env_from_profile || 'development'
ufo_env = ENV['UFO_ENV'] if ENV['UFO_ENV'] ufo_env
end
|
32
33
34
35
36
37
|
# File 'lib/ufo/core.rb', line 32
def
= Current.
= ENV['UFO_ENV_EXTRA'] if ENV['UFO_ENV_EXTRA'] return if &.empty?
end
|
#root ⇒ Object
19
20
21
22
|
# File 'lib/ufo/core.rb', line 19
def root
path = ENV['UFO_ROOT'] || '.'
Pathname.new(path)
end
|
#set_aws_profile! ⇒ Object
Overrides AWS_PROFILE based on the Ufo.env if set in .ufo/settings.yml 2-way binding.
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/ufo/core.rb', line 42
def set_aws_profile!
return if ENV['TEST']
return unless File.exist?("#{Ufo.root}/.ufo/settings.yml") return unless settings data = settings || {}
if data[:aws_profile]
puts "Using AWS_PROFILE=#{data[:aws_profile]} from UFO_ENV=#{Ufo.env} in config/settings.yml"
ENV['AWS_PROFILE'] = data[:aws_profile]
end
end
|