Class: Rubycritic::SourceControlSystem::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rubycritic/source_control_systems/base.rb

Direct Known Subclasses

Double, Git

Constant Summary collapse

@@systems =
[]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.createObject



13
14
15
16
17
18
19
20
21
# File 'lib/rubycritic/source_control_systems/base.rb', line 13

def self.create
  supported_system = systems.detect(&:supported?)
  if supported_system
    supported_system.new
  else
    puts "Rubycritic requires a #{system_names} repository."
    Double.new
  end
end

.register_systemObject



9
10
11
# File 'lib/rubycritic/source_control_systems/base.rb', line 9

def self.register_system
  @@systems << self
end

.supported?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


31
32
33
# File 'lib/rubycritic/source_control_systems/base.rb', line 31

def self.supported?
  raise NotImplementedError.new("The #{self.class} class must implement the #{__method__} method.")
end

.system_namesObject



27
28
29
# File 'lib/rubycritic/source_control_systems/base.rb', line 27

def self.system_names
  systems.join(", ")
end

.systemsObject



23
24
25
# File 'lib/rubycritic/source_control_systems/base.rb', line 23

def self.systems
  @@systems
end

Instance Method Details

#date_of_last_commit(path) ⇒ Object

Raises:

  • (NotImplementedError)


51
52
53
# File 'lib/rubycritic/source_control_systems/base.rb', line 51

def date_of_last_commit(path)
  raise NotImplementedError.new("The #{self.class} class must implement the #{__method__} method.")
end

#has_revision?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


35
36
37
# File 'lib/rubycritic/source_control_systems/base.rb', line 35

def has_revision?
  raise NotImplementedError.new("The #{self.class} class must implement the #{__method__} method.")
end

#head_referenceObject

Raises:

  • (NotImplementedError)


39
40
41
# File 'lib/rubycritic/source_control_systems/base.rb', line 39

def head_reference
  raise NotImplementedError.new("The #{self.class} class must implement the #{__method__} method.")
end

#revisions_count(path) ⇒ Object

Raises:

  • (NotImplementedError)


47
48
49
# File 'lib/rubycritic/source_control_systems/base.rb', line 47

def revisions_count(path)
  raise NotImplementedError.new("The #{self.class} class must implement the #{__method__} method.")
end

#travel_to_headObject

Raises:

  • (NotImplementedError)


43
44
45
# File 'lib/rubycritic/source_control_systems/base.rb', line 43

def travel_to_head
  raise NotImplementedError.new("The #{self.class} class must implement the #{__method__} method.")
end