Sha256: 4c365c847f0e3c7b2e359b708178287034e4aaaf865cbb73494d321908319db8

Contents?: true

Size: 1.93 KB

Versions: 15

Compression:

Stored size: 1.93 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}/jets-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_resources_template_path(page_number)
      "#{templates_folder}/api-resources-#{page_number}.yml"
    end

    def api_cors_template_path(page_number)
      "#{templates_folder}/api-cors-#{page_number}.yml"
    end

    def api_methods_template_path(page_number)
      "#{templates_folder}/api-methods-#{page_number}.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$/,'').gsub('/','-')
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
jets-5.0.13 lib/jets/names.rb
jets-5.0.12 lib/jets/names.rb
jets-5.0.11 lib/jets/names.rb
jets-5.0.10 lib/jets/names.rb
jets-5.0.9 lib/jets/names.rb
jets-5.0.8 lib/jets/names.rb
jets-5.0.7 lib/jets/names.rb
jets-5.0.6 lib/jets/names.rb
jets-5.0.5 lib/jets/names.rb
jets-5.0.4 lib/jets/names.rb
jets-5.0.3 lib/jets/names.rb
jets-5.0.2 lib/jets/names.rb
jets-5.0.1 lib/jets/names.rb
jets-5.0.0 lib/jets/names.rb
jets-5.0.0.beta1 lib/jets/names.rb