Sha256: 7e18695e82b94edf990ff87a3cfa227bbabf3d2711a47bea0b6761c25713a790

Contents?: true

Size: 868 Bytes

Versions: 4

Compression:

Stored size: 868 Bytes

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 has_revision?
      raise NotImplementedError.new("You must implement the has_revision? method.")
    end

    def head_reference
      raise NotImplementedError.new("You must implement the head_reference method.")
    end

    def travel_to_head
      raise NotImplementedError.new("You must implement the travel_to_head 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.7 lib/rubycritic/source_control_systems/source_control_system.rb
rubycritic-0.0.6 lib/rubycritic/source_control_systems/source_control_system.rb
rubycritic-0.0.5 lib/rubycritic/source_control_systems/source_control_system.rb
rubycritic-0.0.4 lib/rubycritic/source_control_systems/source_control_system.rb