Sha256: 3ecd86206304ed0f60bd68c689bc6882e5c5d180612fe459b0de9852b441d957

Contents?: true

Size: 1 KB

Versions: 8

Compression:

Stored size: 1 KB

Contents

require "securerandom"

module Extension
  module Models
    module ServerConfig
      class Extension < Base
        include SmartProperties
        property! :uuid, accepts: String
        property! :type, accepts: String
        property! :user, accepts: ServerConfig::User
        property! :development, accepts: ServerConfig::Development

        def self.build(uuid: "", template:, type:, root_dir:)
          renderer = ServerConfig::DevelopmentRenderer.find(type)
          entry = ServerConfig::DevelopmentEntries.find(template)
          new(
            uuid: uuid.empty? ? generate_dev_uuid : uuid,
            type: type.downcase,
            user: ServerConfig::User.new,
            development: ServerConfig::Development.new(
              root_dir: root_dir,
              template: template,
              renderer: renderer,
              entries: entry
            )
          )
        end

        def self.generate_dev_uuid
          "dev-#{SecureRandom.uuid}"
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
shopify-cli-2.6.5 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.6.4 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.6.3 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.6.2 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.6.1 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.6.0 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.5.0 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.4.0 lib/project_types/extension/models/server_config/extension.rb