Class: Lolcommits::VCSInfo

Inherits:
Object
  • Object
show all
Includes:
Methadone::CLILogging
Defined in:
lib/lolcommits/vcs_info.rb

Overview

base class ala plugin.rb

Direct Known Subclasses

GitInfo, MercurialInfo

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeVCSInfo

Returns a new instance of VCSInfo.



27
28
29
# File 'lib/lolcommits/vcs_info.rb', line 27

def initialize
  base_message(__method__)
end

Instance Attribute Details

#author_emailObject

Returns the value of attribute author_email.



6
7
8
# File 'lib/lolcommits/vcs_info.rb', line 6

def author_email
  @author_email
end

#author_nameObject

Returns the value of attribute author_name.



6
7
8
# File 'lib/lolcommits/vcs_info.rb', line 6

def author_name
  @author_name
end

#branchObject

Returns the value of attribute branch.



6
7
8
# File 'lib/lolcommits/vcs_info.rb', line 6

def branch
  @branch
end

#messageObject

Returns the value of attribute message.



6
7
8
# File 'lib/lolcommits/vcs_info.rb', line 6

def message
  @message
end

#repoObject

Returns the value of attribute repo.



6
7
8
# File 'lib/lolcommits/vcs_info.rb', line 6

def repo
  @repo
end

#repo_internal_pathObject

Returns the value of attribute repo_internal_path.



6
7
8
# File 'lib/lolcommits/vcs_info.rb', line 6

def repo_internal_path
  @repo_internal_path
end

#shaObject

Returns the value of attribute sha.



6
7
8
# File 'lib/lolcommits/vcs_info.rb', line 6

def sha
  @sha
end

#urlObject

Returns the value of attribute url.



6
7
8
# File 'lib/lolcommits/vcs_info.rb', line 6

def url
  @url
end

Class Method Details

.base_message(method) ⇒ Object

Raises:

  • (NotImplementedError)


13
14
15
# File 'lib/lolcommits/vcs_info.rb', line 13

def self.base_message(method)
  raise NotImplementedError, "#{self.class.name} is a base class; implement '#{method}' in a subclass", caller
end

.local_name(path = '.') ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/lolcommits/vcs_info.rb', line 17

def self.local_name(path = '.')
  if GitInfo.repo_root?(path)
    GitInfo.local_name(path)
  elsif MercurialInfo.repo_root?(path)
    MercurialInfo.local_name(path)
  else
    raise "'#{File.expand_path(path)}' is not the root of a supported VCS"
  end
end

.repo_root?(path = '.') ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/lolcommits/vcs_info.rb', line 9

def self.repo_root?(path = '.')
  GitInfo.repo_root?(path) || MercurialInfo.repo_root?(path)
end