Class: EacGit::Local::Remote

Inherits:
Object
  • Object
show all
Includes:
RemoteLike
Defined in:
lib/eac_git/local/remote.rb,
lib/eac_git/local/remote/push.rb

Defined Under Namespace

Classes: Push

Constant Summary collapse

NO_SUCH_REMOTE_CODE =
512

Instance Method Summary collapse

Methods included from RemoteLike

#fetch, #ls

Instance Method Details

#exist?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/eac_git/local/remote.rb', line 16

def exist?
  url
end

#git_command(*args) ⇒ EacRubyUtils::Envs::Command

Returns EacRubyUtils::Envs::Command.

Returns:

  • (EacRubyUtils::Envs::Command)

    EacRubyUtils::Envs::Command



21
22
23
# File 'lib/eac_git/local/remote.rb', line 21

def git_command(*args)
  local.command(*args)
end

#pushEacGit::Local::Remote::Push



26
27
28
# File 'lib/eac_git/local/remote.rb', line 26

def push
  ::EacGit::Local::Remote::Push.new(self)
end

#remote_referenceString

Returns:

  • (String)


31
32
33
# File 'lib/eac_git/local/remote.rb', line 31

def remote_reference
  name
end

#urlString?

Returns:

  • (String, nil)


36
37
38
39
40
# File 'lib/eac_git/local/remote.rb', line 36

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

#url=(new_url) ⇒ String

Returns:

  • (String)


43
44
45
# File 'lib/eac_git/local/remote.rb', line 43

def url=(new_url)
  local.command('remote', 'set-url', name, new_url).execute!
end