Module: Laborantin::Commands::Git
- Defined in:
- lib/laborantin/extra/commands/git.rb,
lib/laborantin/extra/commands/git/run.rb,
lib/laborantin/extra/commands/git/check.rb
Overview
A Git set of Commands, to enable it, pass to true the :extra :git flag.
Defined Under Namespace
Constant Summary collapse
- HERE =
'.'
Class Method Summary collapse
-
.branch ⇒ Object
Get the current working directory branch.
-
.commit_id ⇒ Object
Get the commit-id (long sha1) where current branch is pointing to.
-
.diff ⇒ Object
Returns the Diff between current directory and the HEAD of current branch.
-
.git ⇒ Object
Just get a git object for current working dir (implementation is crappy, but will be refined later).
-
.master_branch? ⇒ Boolean
Returns true if current working dir is master.
Class Method Details
.branch ⇒ Object
Get the current working directory branch.
19 20 21 |
# File 'lib/laborantin/extra/commands/git.rb', line 19 def self.branch self.git.current_branch end |
.commit_id ⇒ Object
Get the commit-id (long sha1) where current branch is pointing to.
24 25 26 |
# File 'lib/laborantin/extra/commands/git.rb', line 24 def self.commit_id self.git.revparse(branch) end |
.diff ⇒ Object
Returns the Diff between current directory and the HEAD of current branch.
35 36 37 |
# File 'lib/laborantin/extra/commands/git.rb', line 35 def self.diff git.diff(commit_id, HERE) end |
.git ⇒ Object
Just get a git object for current working dir (implementation is crappy, but will be refined later)
14 15 16 |
# File 'lib/laborantin/extra/commands/git.rb', line 14 def self.git @g ||= Object::Git.open(HERE) end |
.master_branch? ⇒ Boolean
Returns true if current working dir is master.
29 30 31 |
# File 'lib/laborantin/extra/commands/git.rb', line 29 def self.master_branch? 'master' == branch end |