Class: Dapp::Dimg::GitRepo::Local

Inherits:
Base
  • Object
show all
Defined in:
lib/dapp/dimg/git_repo/local.rb

Direct Known Subclasses

Own

Instance Attribute Summary collapse

Attributes inherited from Base

#dapp, #name

Instance Method Summary collapse

Methods inherited from Base

#commit_exists?, #empty?, #exclude_paths, #find_commit_id_by_message, #head_branch_name, #head_commit, #latest_branch_commit, #lookup_object, #remote_origin_url, #set_ruby2go_state_hash

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, path) ⇒ Local

Returns a new instance of Local.



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

def initialize(dapp, name, path)
  super(dapp, name)
  self.path = path
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



5
6
7
# File 'lib/dapp/dimg/git_repo/local.rb', line 5

def path
  @path
end

Instance Method Details

#get_ruby2go_state_hashObject



12
13
14
15
16
17
18
19
# File 'lib/dapp/dimg/git_repo/local.rb', line 12

def get_ruby2go_state_hash
  super.tap {|res|
    p = @path.to_s
    p = File.dirname(@path) if File.basename(@path) == ".git"
    res["Path"] = p
    res["GitDir"] = @path.to_s
  }
end

#lookup_commit(commit) ⇒ Object



37
38
39
40
41
# File 'lib/dapp/dimg/git_repo/local.rb', line 37

def lookup_commit(commit)
  super
rescue Rugged::OdbError, TypeError => _e
  raise Error::Rugged, code: :commit_not_found_in_local_git_repository, data: { commit: commit, path: path }
end

#ruby2go_method(method, args_hash = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/dapp/dimg/git_repo/local.rb', line 21

def ruby2go_method(method, args_hash={})
  res = dapp.ruby2go_git_repo(args_hash.merge("LocalGitRepo" => JSON.dump(get_ruby2go_state_hash), "method" => method))

  raise res["error"] if res["error"]

  self.set_ruby2go_state_hash(JSON.load(res["data"]["LocalGitRepo"]))

  res["data"]["result"]
end