Sha256: 155934c375e4aab3c8e09e0df353c82f9d5b0658c707be25ebf63e45f6862fc0

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

module Rubycritic

  class SourceControlSystem
    @@systems = []

    def self.register_system
      @@systems << self
    end

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

    def self.systems
      @@systems
    end

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

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

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

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

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

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

end

require "rubycritic/source_control_systems/git"

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubycritic-0.0.14 lib/rubycritic/source_control_systems/source_control_system.rb
rubycritic-0.0.13 lib/rubycritic/source_control_systems/source_control_system.rb
rubycritic-0.0.12 lib/rubycritic/source_control_systems/source_control_system.rb
rubycritic-0.0.11 lib/rubycritic/source_control_systems/source_control_system.rb