class Shiplane::ConvertComposeFile

Attributes

project_folder[RW]
sha[RW]

Public Class Methods

convert_output!(project_folder, sha) click to toggle source
# File lib/shiplane/convert_compose_file.rb, line 51
def self.convert_output!(project_folder, sha)
  new(project_folder, sha).convert_output!
end
new(project_folder, sha) click to toggle source
# File lib/shiplane/convert_compose_file.rb, line 12
def initialize(project_folder, sha)
  @project_folder = project_folder
  @sha = sha
end

Public Instance Methods

compose_config() click to toggle source
# File lib/shiplane/convert_compose_file.rb, line 21
def compose_config
  @compose_config ||= build_config.fetch('compose', {})
end
compose_filepath() click to toggle source
# File lib/shiplane/convert_compose_file.rb, line 25
def compose_filepath
  @compose_filepath ||= File.join(project_folder, build_config.fetch('compose_filepath', Shiplane::DEFAULT_COMPOSEFILE_FILEPATH))
end
convert_output!() click to toggle source
# File lib/shiplane/convert_compose_file.rb, line 45
def convert_output!
  puts "Converting Compose File..."
  File.write(compose_filepath, converted_output.to_yaml)
  puts "Compose File Converted..."
end
converted_compose_hash() click to toggle source
# File lib/shiplane/convert_compose_file.rb, line 29
def converted_compose_hash
  @converted_compose_hash ||= Shiplane::ComposeHash.new(File.new(compose_filepath), compose_config).production_yml
end
converted_output() click to toggle source
# File lib/shiplane/convert_compose_file.rb, line 33
def converted_output
  @converted_output ||= converted_compose_hash.dup.tap do |hash|
    hash.traverse! do |key, value|
      if (key == 'env_file' && value == '.env.development')
        [key, '.env.production']
      else
        [key, value]
      end
    end
  end
end
shiplane_config() click to toggle source
# File lib/shiplane/convert_compose_file.rb, line 17
def shiplane_config
  @shiplane_config ||= Shiplane::Configuration.new
end