Sha256: b1e4ae69ea446bd996ea198eae2ed726f0b77cd8e1ec1a78d4c16f4250f781fa

Contents?: true

Size: 1.59 KB

Versions: 4

Compression:

Stored size: 1.59 KB

Contents

# This class groups the names in one place.
# Some names are for CloudFormation
# Some are for the Build process
class Jets::Names
  # Mainly used by build.rb
  class << self
    extend Memoist

    def templates_folder
      "#{Jets.build_root}/templates"
    end

    def one_controller_template_path
      "#{templates_folder}/controller.yml"
    end

    def app_template_path(app_class)
      underscored = underscore(app_class)
      "#{templates_folder}/app-#{underscored}.yml"
    end

    def shared_template_path(shared_class)
      underscored = underscore(shared_class)
      "#{templates_folder}/shared-#{underscored}.yml"
    end

    # consider moving these methods into cfn/builder/helpers.rb or that area.
    def parent_template_path
      "#{templates_folder}/parent.yml"
    end

    # consider moving these methods into cfn/builder/helpers.rb or that area.
    def api_gateway_template_path
      "#{templates_folder}/api-gateway.yml"
    end

    def api_deployment_template_path
      "#{templates_folder}/api-deployment.yml"
    end

    def api_mapping_template_path
      "#{templates_folder}/api-mapping.yml"
    end

    def shared_resources_template_path
      "#{templates_folder}/shared-resources.yml"
    end

    def parent_stack_name
      Jets.project.namespace
    end

    def gateway_api_name
      Jets.project.namespace
    end

    def authorizer_template_path(path)
      underscored = underscore(path)
      underscored.sub!(/^app-/, "")
      "#{templates_folder}/#{underscored}.yml"
    end

    def underscore(s)
      s.to_s.underscore.sub(/\.rb$/, "").tr("/", "-")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jets-6.0.5 lib/jets/names.rb
jets-6.0.4 lib/jets/names.rb
jets-6.0.3 lib/jets/names.rb
jets-6.0.2 lib/jets/names.rb