Sha256: 33685ef52b49a422ee28f1b548d2bc9bb8501c22e2941c619f5b93326efd8591

Contents?: true

Size: 971 Bytes

Versions: 7

Compression:

Stored size: 971 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 mirror.type == "git-clone"
            return
          end

          if git.remote_url(mirror.remote)
            msg "Setup: Mirror '#{mirror.path}' already has a remote. Reusing it." if verbose?
            return
          end

          msg "Setup: Creating 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

7 entries across 7 versions & 1 rubygems

Version Path
dreamcat4-braid-0.5.1 lib/braid/commands/setup.rb
dreamcat4-braid-0.5.2 lib/braid/commands/setup.rb
dreamcat4-braid-0.52 lib/braid/commands/setup.rb
dreamcat4-braid-0.53 lib/braid/commands/setup.rb
dreamcat4-braid-0.531 lib/braid/commands/setup.rb
dreamcat4-braid-0.533 lib/braid/commands/setup.rb
dreamcat4-braid-0.534 lib/braid/commands/setup.rb