Sha256: 816d17b9bf3d4238841e2d1eed1ce98e456d17f9b351d0899cfead81ff0f11c0

Contents?: true

Size: 1.14 KB

Versions: 25

Compression:

Stored size: 1.14 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
        property  :extension_points, accepts: Array
        property  :version, accepts: String
        property  :title, accepts: String

        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

25 entries across 25 versions & 1 rubygems

Version Path
shopify-cli-2.16.1 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.16.0 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.15.6 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.15.5 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.15.4 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.15.3 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.15.2 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.15.1 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.15.0 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.14.0 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.13.0 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.12.0 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.11.2 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.11.1 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.11.0 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.10.2 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.10.1 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.10.0 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.9.0 lib/project_types/extension/models/server_config/extension.rb
shopify-cli-2.8.0 lib/project_types/extension/models/server_config/extension.rb