Module: Ufo::Core
Instance Method Summary collapse
- #cfn_profile ⇒ Object
- #check_task_definition!(task_definition) ⇒ Object
- #check_ufo_project! ⇒ Object
- #env ⇒ Object
- #env_extra ⇒ Object
- #pretty_service_name(service) ⇒ Object
- #root ⇒ Object
- #settings ⇒ Object
Instance Method Details
#cfn_profile ⇒ Object
47 48 49 |
# File 'lib/ufo/core.rb', line 47 def cfn_profile settings[:cfn_profile] || "default" end |
#check_task_definition!(task_definition) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/ufo/core.rb', line 8 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/template_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 end end |
#check_ufo_project! ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/ufo/core.rb', line 51 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
23 24 25 26 27 |
# File 'lib/ufo/core.rb', line 23 def env ufo_env = env_from_profile(ENV['AWS_PROFILE']) || 'development' ufo_env = ENV['UFO_ENV'] if ENV['UFO_ENV'] # highest precedence ufo_env end |
#env_extra ⇒ Object
30 31 32 33 34 35 |
# File 'lib/ufo/core.rb', line 30 def env_extra env_extra = Current.env_extra env_extra = ENV['UFO_ENV_EXTRA'] if ENV['UFO_ENV_EXTRA'] # highest precedence return if env_extra&.empty? env_extra end |
#pretty_service_name(service) ⇒ Object
38 39 40 |
# File 'lib/ufo/core.rb', line 38 def pretty_service_name(service) [service, Ufo.env_extra].reject {|x| x==''}.compact.join('-') end |
#root ⇒ Object
18 19 20 21 |
# File 'lib/ufo/core.rb', line 18 def root path = ENV['UFO_ROOT'] || '.' Pathname.new(path) end |