Sha256: 9e8600ca534999f609b5f03f6f72feaf58e01a9dbfa13a21ccc6b08329979cb0

Contents?: true

Size: 873 Bytes

Versions: 2

Compression:

Stored size: 873 Bytes

Contents

module Braid
  module Commands
    class Setup < Command
      def run(path = nil)
        path ? setup_one(path) : setup_all
      end

      protected
        def setup_all
          msg "Setting up all mirrors."
          config.mirrors.each do |path|
            setup_one(path)
          end
        end

        def setup_one(path)
          mirror = config.get!(path)

          if git.remote_url(mirror.remote)
            msg "Mirror '#{mirror.path}/' already has a remote. Skipping."
            return
          end

          msg "Setting up remote for '#{mirror.path}/'."
          unless mirror.type == "svn"
            url = use_local_cache? ? git_cache.path(mirror.url) : mirror.url
            git.remote_add(mirror.remote, url, mirror.branch)
          else
            git_svn.init(mirror.remote, mirror.url)
          end
        end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
evilchelu-braid-0.4.13 lib/braid/commands/setup.rb
norbert-braid-0.4.13 lib/braid/commands/setup.rb