Sha256: e5ddc7aeef86516cacd23f2d808a7fe96043466896391ea59d9103784d4378e9

Contents?: true

Size: 834 Bytes

Versions: 3

Compression:

Stored size: 834 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

3 entries across 3 versions & 1 rubygems

Version Path
git_wrapper-1.0.2 lib/git_wrapper/commands/remote.rb
git_wrapper-1.0.1 lib/git_wrapper/commands/remote.rb
git_wrapper-1.0.0 lib/git_wrapper/commands/remote.rb