Sha256: 0ea6f0fe3a6bf55c23ef23fdfb5a42f68a8daac5bbf31065a036e4d7dd1f4b43
Contents?: true
Size: 868 Bytes
Versions: 9
Compression:
Stored size: 868 Bytes
Contents
require "shopify_cli" module ShopifyCli class Connect def initialize(ctx) @ctx = ctx end def default_connect(project_type) if Project.current&.env @ctx.puts(@ctx.message("core.connect.already_connected_warning")) end org = ShopifyCli::Tasks::EnsureEnv.call(@ctx, regenerate: true) write_cli_yml(project_type, org["id"]) unless Project.has_current? api_key = Project.current(force_reload: true).env["api_key"] get_app(org["apps"], api_key).first["title"] end def write_cli_yml(project_type, org_id) ShopifyCli::Project.write( @ctx, project_type: project_type, organization_id: org_id, ) @ctx.done(@ctx.message("core.connect.cli_yml_saved")) end def get_app(apps, api_key) apps.select { |app| app["apiKey"] == api_key } end end end
Version data entries
9 entries across 9 versions & 1 rubygems