class Dapp::Dimg::GitRepo::Base

Base class for any Git repo (remote, gitkeeper, etc)

Attributes

dapp[R]
name[R]

Public Class Methods

new(dapp, name) click to toggle source
# File lib/dapp/dimg/git_repo/base.rb, line 11
def initialize(dapp, name)
  @dapp = dapp
  @name = name
end

Public Instance Methods

commit_exists?(commit) click to toggle source
# File lib/dapp/dimg/git_repo/base.rb, line 40
def commit_exists?(commit)
  ruby2go_method("IsCommitExists", "commit" => commit)
end
empty?() click to toggle source
# File lib/dapp/dimg/git_repo/base.rb, line 30
def empty?
  return @empty if !@empty.nil?
  @empty = ruby2go_method("IsEmpty")
  @empty
end
exclude_paths() click to toggle source
# File lib/dapp/dimg/git_repo/base.rb, line 16
def exclude_paths
  []
end
find_commit_id_by_message(regex) click to toggle source
# File lib/dapp/dimg/git_repo/base.rb, line 36
def find_commit_id_by_message(regex)
  ruby2go_method("FindCommitIdByMessage", "regex" => regex)
end
get_ruby2go_state_hash() click to toggle source
# File lib/dapp/dimg/git_repo/base.rb, line 20
def get_ruby2go_state_hash
  {
    "Name" => @name.to_s,
  }
end
head_branch_name() click to toggle source
# File lib/dapp/dimg/git_repo/base.rb, line 66
def head_branch_name
  return @branch if !@branch.nil?
  @branch = ruby2go_method("HeadBranchName")
  @branch
end
head_commit() click to toggle source
# File lib/dapp/dimg/git_repo/base.rb, line 60
def head_commit
  return @head_commit if !@head_commit.nil?
  @head_commit = ruby2go_method("HeadCommit")
  @head_commit
end
latest_branch_commit(branch) click to toggle source
# File lib/dapp/dimg/git_repo/base.rb, line 56
def latest_branch_commit(branch)
  ruby2go_method("LatestBranchCommit", "branch" => branch)
end
lookup_commit(commit) click to toggle source
# File lib/dapp/dimg/git_repo/base.rb, line 79
def lookup_commit(commit)
  git.lookup(commit)
end
lookup_object(oid) click to toggle source

TODO Below operations does not affect build process, only used in sample. TODO Should be ported to golang without git_repo.GitRepo interface.

# File lib/dapp/dimg/git_repo/base.rb, line 75
def lookup_object(oid)
  git.lookup(oid)
end
remote_origin_url() click to toggle source
# File lib/dapp/dimg/git_repo/base.rb, line 44
def remote_origin_url
  return @remote_origin_url if @remote_origin_url_set

  res = ruby2go_method("RemoteOriginUrl")
  if res != ""
    @remote_origin_url = res
  end
  @remote_origin_url_set = true

  @remote_origin_url
end
set_ruby2go_state_hash(state) click to toggle source
# File lib/dapp/dimg/git_repo/base.rb, line 26
def set_ruby2go_state_hash(state)
  @name = state["Name"]
end

Protected Instance Methods

git(**kwargs) click to toggle source
# File lib/dapp/dimg/git_repo/base.rb, line 89
def git(**kwargs) # TODO remove
  @git ||= Rugged::Repository.new(path.to_s, **kwargs)
end
ruby2go_method(method, args_hash={}) click to toggle source
# File lib/dapp/dimg/git_repo/base.rb, line 85
def ruby2go_method(method, args_hash={})
  raise
end