Sha256: f68e7c8f6a933ad487cd46164138d78304b7654dd6e03e043cfaa1a65aea254d

Contents?: true

Size: 1.62 KB

Versions: 60

Compression:

Stored size: 1.62 KB

Contents

# This class groups the naming in one place.
# Some naming is for CloudFormation
# Some are for the Build process
class Jets::Naming
  # 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

60 entries across 60 versions & 2 rubygems

Version Path
jets-3.2.2 lib/jets/naming.rb
jets-3.2.1 lib/jets/naming.rb
jets.benforeva-3.0.17.pre.mount.pre.fix lib/jets/naming.rb
jets-3.2.0 lib/jets/naming.rb
jets-3.1.5 lib/jets/naming.rb
jets-3.1.4 lib/jets/naming.rb
jets-3.1.3 lib/jets/naming.rb
jets-3.1.2 lib/jets/naming.rb
jets-3.1.1 lib/jets/naming.rb
jets-3.1.0 lib/jets/naming.rb
jets-3.0.23 lib/jets/naming.rb
jets-3.0.22 lib/jets/naming.rb
jets-3.0.21 lib/jets/naming.rb
jets-3.0.20 lib/jets/naming.rb
jets-3.0.19 lib/jets/naming.rb
jets-3.0.18 lib/jets/naming.rb
jets-3.0.17 lib/jets/naming.rb
jets-3.0.16 lib/jets/naming.rb
jets-3.0.15 lib/jets/naming.rb
jets-3.0.14 lib/jets/naming.rb