Sha256: ed042b978f334a4b0636a26ba553c8994857f2b5b722f21d6d4059f2af1ac0f8
Contents?: true
Size: 1.06 KB
Versions: 36
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module Theme class Command class Init < ShopifyCLI::Command::SubCommand recommend_default_ruby_range options do |parser, flags| parser.on("-u", "--clone-url URL") { |url| flags[:clone_url] = url } end prerequisite_task :ensure_git_dependency DEFAULT_CLONE_URL = "https://github.com/Shopify/dawn.git" def call(args, _name) name = args.first || ask_name clone_url = options.flags[:clone_url] || DEFAULT_CLONE_URL clone(clone_url, name) end def self.help ShopifyCLI::Context.message("theme.init.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME) end private def ask_name CLI::UI::Prompt.ask(@ctx.message("theme.init.ask_name")) end def clone(url, name) ShopifyCLI::Git.clone(url, name) @ctx.root = File.join(@ctx.root, name) begin @ctx.rm_r(".git") @ctx.rm_r(".github") rescue Errno::ENOENT => e @ctx.debug(e) end end end end end
Version data entries
36 entries across 36 versions & 1 rubygems