Class: Raykit::Git

Inherits:
Object
  • Object
show all
Defined in:
lib/raykit/git.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#start_timeObject

Returns the value of attribute start_time.



3
4
5
# File 'lib/raykit/git.rb', line 3

def start_time
  @start_time
end

Class Method Details

.branchObject



5
6
7
8
# File 'lib/raykit/git.rb', line 5

def self.branch
    branches = `git branch`
    branches.match(/ ([\w.]+)/).captures[0]
end

.last_tagObject



10
11
12
# File 'lib/raykit/git.rb', line 10

def self.last_tag
    `git describe --abbrev=0 --tags`.strip
end

.outstanding_commitObject



28
29
30
31
32
33
34
# File 'lib/raykit/git.rb', line 28

def self.outstanding_commit
    if(Git::user_can_commit)
        return !`git status`.include?('nothing to commit,')
    else
        return false
    end
end

.user_can_commitObject



22
23
24
25
26
# File 'lib/raykit/git.rb', line 22

def self.user_can_commit
    return false if(user_name.length == 0)
    return false if(user_email.length == 0)
    return true
end

.user_emailObject



18
19
20
# File 'lib/raykit/git.rb', line 18

def self.user_email
    return `git config --get user.email`.strip
end

.user_nameObject



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

def self.user_name
    return `git config --get user.name`.strip
end