Module: GitHack
- Defined in:
- lib/git-hack.rb,
lib/git-hack/commit.rb,
lib/git-hack/version.rb,
lib/git-hack/git_repo.rb,
lib/git-hack/commit_line_builder.rb
Defined Under Namespace
Classes: Commit, CommitLineBuilder, GitRepo
Constant Summary
collapse
- VERSION =
"0.0.2"
Class Method Summary
collapse
Class Method Details
.commit ⇒ Object
9
10
11
|
# File 'lib/git-hack.rb', line 9
def self.commit
current.commit
end
|
.current ⇒ Object
6
7
8
|
# File 'lib/git-hack.rb', line 6
def self.current
@current || get_dir('.')
end
|
.get_dir(path) ⇒ Object
get_dir(path) 检查给定目录是否在git受控目录中本身是git目录返回 GitProject 本身不是,但上层是返回GitProject,并设置dir 本身不是,上层也不是则返回RawDir
17
18
19
20
|
# File 'lib/git-hack.rb', line 17
def self.get_dir(path)
return GitRepo.new(path) if is_git(path)
return get_dir(File.join(path,"/../"))
end
|
.is_git(path) ⇒ Object
21
22
23
|
# File 'lib/git-hack.rb', line 21
def self.is_git(path)
File.directory?(File.join(path,"/.git"))
end
|