Sha256: 4172c85b1c2994eaad159f0c5e6e2a04654db31a92eabcd434c3607add522d0f

Contents?: true

Size: 856 Bytes

Versions: 51

Compression:

Stored size: 856 Bytes

Contents

# frozen_string_literal: true

require 'eac_git/remote_like'
require 'eac_ruby_utils/core_ext'

module EacGit
  class Local
    class Remote
      NO_SUCH_REMOTE_CODE = 512

      enable_simple_cache
      include ::EacGit::RemoteLike

      common_constructor :local, :name

      def exist?
        url
      end

      # @return [EacRubyUtils::Envs::Command
      def git_command(*args)
        local.command(*args)
      end

      # @return [String]
      def remote_reference
        name
      end

      # @return [String, nil]
      def url
        local.command('remote', 'get-url', name)
          .execute!(exit_outputs: { NO_SUCH_REMOTE_CODE => nil })
          .if_present(nil, &:strip)
      end

      # @return [String]
      def url=(new_url)
        local.command('remote', 'set-url', name, new_url).execute!
      end
    end
  end
end

Version data entries

51 entries across 51 versions & 2 rubygems

Version Path
eac_git-0.15.0 lib/eac_git/local/remote.rb
eac_tools-0.84.2 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.84.1 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.84.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.83.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.82.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.81.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.80.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.79.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.78.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.77.1 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.77.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.76.1 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.76.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.75.2 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.75.1 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.75.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.74.1 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.74.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.73.0 sub/eac_git/lib/eac_git/local/remote.rb