Class: Branchy::Drivers::Git

Inherits:
Object
  • Object
show all
Extended by:
CLI
Defined in:
lib/branchy/drivers/git.rb

Overview

A Branchy driver for git

Class Method Summary collapse

Class Method Details

.branchObject

Returns the git branch or tag name



9
10
11
# File 'lib/branchy/drivers/git.rb', line 9

def self.branch
  branch_name || tag_name
end

.disable!Object

Disables a database for this git branch



29
30
31
# File 'lib/branchy/drivers/git.rb', line 29

def self.disable!
  exec_or_raise("git config --bool branch.#{branch}.database false")
end

.enable!Object

Enables a database for this git branch



24
25
26
# File 'lib/branchy/drivers/git.rb', line 24

def self.enable!
  exec_or_raise("git config --bool branch.#{branch}.database true")
end

.enabled?Boolean

Returns true if this git branch has been configured with a branched database

Returns:

  • (Boolean)


19
20
21
# File 'lib/branchy/drivers/git.rb', line 19

def self.enabled?
  exec_or_raise("git config --bool branch.#{branch}.database", [0,1]) == 'true'
end

.trunk?Boolean

Returns true if it’s the master/trunk/mainline branch.

Returns:

  • (Boolean)


14
15
16
# File 'lib/branchy/drivers/git.rb', line 14

def self.trunk?
  branch == 'master'
end