Class: Dapp::Dimg::GitRepo::Base

Inherits:
Object
  • Object
show all
Includes:
Helper::Trivia
Defined in:
lib/dapp/dimg/git_repo/base.rb

Overview

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

Direct Known Subclasses

Local, Remote

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper::Trivia

#check_path?, #check_subpath?, #class_to_lowercase, class_to_lowercase, #delete_file, #ignore_path?, #ignore_path_base, #kwargs, #make_path, #path_checker, #search_file_upward

Constructor Details

#initialize(dapp, name) ⇒ Base

Returns a new instance of Base.



11
12
13
14
# File 'lib/dapp/dimg/git_repo/base.rb', line 11

def initialize(dapp, name)
  @dapp = dapp
  @name = name
end

Instance Attribute Details

#dappObject (readonly)

Returns the value of attribute dapp.



9
10
11
# File 'lib/dapp/dimg/git_repo/base.rb', line 9

def dapp
  @dapp
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/dapp/dimg/git_repo/base.rb', line 8

def name
  @name
end

Instance Method Details

#commit_exists?(commit) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/dapp/dimg/git_repo/base.rb', line 40

def commit_exists?(commit)
  ruby2go_method("IsCommitExists", "commit" => commit)
end

#empty?Boolean

Returns:

  • (Boolean)


30
31
32
33
34
# File 'lib/dapp/dimg/git_repo/base.rb', line 30

def empty?
  return @empty if !@empty.nil?
  @empty = ruby2go_method("IsEmpty")
  @empty
end

#exclude_pathsObject



16
17
18
# File 'lib/dapp/dimg/git_repo/base.rb', line 16

def exclude_paths
  []
end

#find_commit_id_by_message(regex) ⇒ Object



36
37
38
# 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_hashObject



20
21
22
23
24
# File 'lib/dapp/dimg/git_repo/base.rb', line 20

def get_ruby2go_state_hash
  {
    "Name" => @name.to_s,
  }
end

#head_branch_nameObject



66
67
68
69
70
# 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_commitObject



60
61
62
63
64
# 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) ⇒ Object



56
57
58
# File 'lib/dapp/dimg/git_repo/base.rb', line 56

def latest_branch_commit(branch)
  ruby2go_method("LatestBranchCommit", "branch" => branch)
end

#lookup_commit(commit) ⇒ Object



79
80
81
# File 'lib/dapp/dimg/git_repo/base.rb', line 79

def lookup_commit(commit)
  git.lookup(commit)
end

#lookup_object(oid) ⇒ Object

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



75
76
77
# File 'lib/dapp/dimg/git_repo/base.rb', line 75

def lookup_object(oid)
  git.lookup(oid)
end

#remote_origin_urlObject



44
45
46
47
48
49
50
51
52
53
54
# 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) ⇒ Object



26
27
28
# File 'lib/dapp/dimg/git_repo/base.rb', line 26

def set_ruby2go_state_hash(state)
  @name = state["Name"]
end