Sha256: 83dece49a56af3750a9e758ab0252f1e345823fc333df6f328f1e222c8caa60c

Contents?: true

Size: 867 Bytes

Versions: 2

Compression:

Stored size: 867 Bytes

Contents

module Braid
  module Commands
    class Remove < Command
      def run(path, options = {})
        mirror = config.get!(path)

        bail_on_local_changes!

        with_reset_on_error do
          msg "Removing mirror from '#{mirror.path}'."

          git.rm_r(mirror.path)

          config.remove(mirror)
          add_config_file

          if options[:keep]
            msg "Not removing remote '#{mirror.remote}'" if verbose?
          elsif git.remote_url(mirror.remote)
            msg "Removed remote '#{mirror.path}'" if verbose?
            git.remote_rm mirror.remote
          else
            msg "Remote '#{mirror.remote}' not found, nothing to cleanup" if verbose?
          end

          commit_message = "Removed mirror '#{mirror.path}'"
          git.commit(commit_message)
          msg commit_message
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
dreamcat4-braid-0.50 lib/braid/commands/remove.rb
mlightner-braid-0.5.1 lib/braid/commands/remove.rb