Sha256: f577a4842a84540323bc2b19fef6deec12f0eb46866830ecb3fc01a64249d72d
Contents?: true
Size: 1.42 KB
Versions: 21
Compression:
Stored size: 1.42 KB
Contents
require "shopify_cli" module ShopifyCLI module Tasks class TaskRegistry def initialize @tasks = {} end def add(const, name) @tasks[name] = const end def [](name) class_or_proc = @tasks[name] if class_or_proc.is_a?(Class) class_or_proc elsif class_or_proc.respond_to?(:call) class_or_proc.call else class_or_proc end end end Registry = TaskRegistry.new def self.register(task, name, path = nil) autoload(task, path) if path Registry.add(-> () { const_get(task) }, name) end register :ConfirmStore, :confirm_store, "shopify_cli/tasks/confirm_store" register :CreateApiClient, :create_api_client, "shopify_cli/tasks/create_api_client" register :EnsureAuthenticated, :ensure_authenticated, "shopify_cli/tasks/ensure_authenticated" register :EnsureEnv, :ensure_env, "shopify_cli/tasks/ensure_env" register :EnsureLoopbackURL, :ensure_loopback_url, "shopify_cli/tasks/ensure_loopback_url" register :EnsureProjectType, :ensure_project_type, "shopify_cli/tasks/ensure_project_type" register :EnsureDevStore, :ensure_dev_store, "shopify_cli/tasks/ensure_dev_store" register :SelectOrgAndShop, :select_org_and_shop, "shopify_cli/tasks/select_org_and_shop" register :UpdateDashboardURLS, :update_dashboard_urls, "shopify_cli/tasks/update_dashboard_urls" end end
Version data entries
21 entries across 21 versions & 1 rubygems
Version | Path |
---|---|
shopify-cli-2.5.0 | lib/shopify_cli/tasks.rb |