Sha256: ec29d63b7c045466cbff288173d50c1f0f2adc2107f2890102c02f34d8ac3ea1

Contents?: true

Size: 1.62 KB

Versions: 13

Compression:

Stored size: 1.62 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 app_template_path(app_class)
      underscored = underscore(app_class)
      "#{template_path_prefix}-app-#{underscored}.yml"
    end

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

    def template_path_prefix
      "#{Jets.build_root}/templates/#{Jets.config.project_namespace}"
    end

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

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

    def api_resources_template_path(page)
      "#{template_path_prefix}-api-resources-#{page}.yml"
    end

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

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

    def parent_stack_name
      File.basename(parent_template_path, ".yml")
    end

    def gateway_api_name
      "#{Jets.config.project_namespace}"
    end

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

    def underscore(s)
      s.to_s.underscore.sub(/\.rb$/,'').gsub('/','-')
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
jets-4.0.12 lib/jets/names.rb
jets-4.0.11 lib/jets/names.rb
jets-4.0.10 lib/jets/names.rb
jets-4.0.9 lib/jets/names.rb
jets-4.0.8 lib/jets/names.rb
jets-4.0.7 lib/jets/names.rb
jets-4.0.6 lib/jets/names.rb
jets-4.0.5 lib/jets/names.rb
jets-4.0.4 lib/jets/names.rb
jets-4.0.3 lib/jets/names.rb
jets-4.0.2 lib/jets/names.rb
jets-4.0.1 lib/jets/names.rb
jets-4.0.0 lib/jets/names.rb