Sha256: d97985896ec26c14c29cbbc6b7e803bf2647524425f64e2559232599521706a7
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
# typed: strict module Braid module Commands class Setup < Command sig {params(path: T.nilable(String)).void} def initialize(path = nil) @path = path end private sig {void} def run_internal @path ? setup_one(@path) : setup_all end sig {void} def setup_all msg 'Setting up all mirrors.' config.mirrors.each do |path| setup_one(path) end end sig {params(path: String).void} def setup_one(path) mirror = config.get!(path) if git.remote_url(mirror.remote) if force? msg "Setup: Mirror '#{mirror.path}' already has a remote. Replacing it (force)" if verbose? git.remote_rm(mirror.remote) else msg "Setup: Mirror '#{mirror.path}' already has a remote. Reusing it." if verbose? return end end msg "Setup: Creating remote for '#{mirror.path}'." if verbose? url = use_local_cache? ? git_cache.path(mirror.url) : mirror.url git.remote_add(mirror.remote, url) end sig {returns(Config::ConfigMode)} def config_mode Config::MODE_READ_ONLY end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
braid-1.1.10 | lib/braid/commands/setup.rb |