Sha256: 0e0903ef58fd2aeba984746c60b7233865215f0cb17d01f12c09e6f9ac362113

Contents?: true

Size: 389 Bytes

Versions: 2

Compression:

Stored size: 389 Bytes

Contents

module Space
  class Git
    include Commands

    COMMANDS = {
      :status => 'git status -s',
      :branch => 'git branch --no-color',
      :commit => 'git log -1 head'
    }

    def clean?
      result(:status).empty?
    end

    def branch
      result(:branch) =~ /^\* (.+)/ && $1.strip
    end

    def commit
      result(:commit) =~ /^commit (\S{7})/ && $1
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
space-0.0.3 lib/space/models/git.rb
space-0.0.2 lib/space/models/git.rb