Sha256: 4dd13c1b8a3655d69e8398890bd7b5958ab84b16baae14a88ef04bf7377f49cc

Contents?: true

Size: 786 Bytes

Versions: 4

Compression:

Stored size: 786 Bytes

Contents

module GitWrapper
  module Commands
    class Remote < Git

      def name(name)
        @name = name
        self
      end

      def add(url)
        @url = url
        @mode = :add
        self
      end

      def remove
        @mode = :remove
        self
      end

      def list
        @mode = :list
        self
      end

      def command
        command = "remote "

        if @mode == :add
          command += "add #{@name} \"#{@url}\""
        elsif @mode == :remove
          command += "rm #{@name}"
        elsif @mode == :list
          command += "show"
        else
          raise "Unespecified remote mode"
        end

        command
      end

      def result
        return @output.split(/\n/) if @mode == :list
        super
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
git_wrapper-1.1.2 lib/git_wrapper/commands/remote.rb
git_wrapper-1.1.1 lib/git_wrapper/commands/remote.rb
git_wrapper-1.1.0 lib/git_wrapper/commands/remote.rb
git_wrapper-1.0.3 lib/git_wrapper/commands/remote.rb