Sha256: 7abf627eadf53ef58f181b2a79ee8b9ad47b6f53cdcf61aee0e98d251d204d11

Contents?: true

Size: 856 Bytes

Versions: 19

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 = 128

      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

19 entries across 19 versions & 2 rubygems

Version Path
eac_tools-0.55.3 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.55.2 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.55.1 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.55.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.54.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.53.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.52.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.51.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.50.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.49.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.48.1 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.48.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.47.2 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.47.1 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.47.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.46.0 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.45.2 sub/eac_git/lib/eac_git/local/remote.rb
eac_tools-0.45.1 sub/eac_git/lib/eac_git/local/remote.rb
eac_git-0.14.0 lib/eac_git/local/remote.rb