Class: Mbeditor::GitCommitDetailService

Inherits:
Object
  • Object
show all
Includes:
GitService
Defined in:
app/services/mbeditor/git_commit_detail_service.rb

Constant Summary

Constants included from GitService

Mbeditor::GitService::SAFE_GIT_REF

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from GitService

ahead_behind, current_branch, find_branch_base, parse_git_log, parse_git_log_with_parents, parse_name_status, parse_numstat, parse_porcelain_status, resolve_path, run_git, upstream_branch

Constructor Details

#initialize(repo_path:, sha:) ⇒ GitCommitDetailService

Returns a new instance of GitCommitDetailService.



9
10
11
12
# File 'app/services/mbeditor/git_commit_detail_service.rb', line 9

def initialize(repo_path:, sha:)
  @repo_path = repo_path.to_s
  @sha       = sha.to_s
end

Instance Attribute Details

#repo_pathObject (readonly)

Returns the value of attribute repo_path.



7
8
9
# File 'app/services/mbeditor/git_commit_detail_service.rb', line 7

def repo_path
  @repo_path
end

#shaObject (readonly)

Returns the value of attribute sha.



7
8
9
# File 'app/services/mbeditor/git_commit_detail_service.rb', line 7

def sha
  @sha
end

Instance Method Details

#callObject



14
15
16
17
# File 'app/services/mbeditor/git_commit_detail_service.rb', line 14

def call
  meta = fetch_meta
  { "sha" => sha, "title" => meta["title"], "author" => meta["author"], "date" => meta["date"], "files" => fetch_files }
end