Sha256: 2ddafc01214879eb4afddd1e09bd317306cbca47a996a3eda67ea903bd07ac7a

Contents?: true

Size: 840 Bytes

Versions: 1

Compression:

Stored size: 840 Bytes

Contents

require 'reap/tool'

module Reap
module Systems

  def self.registry
    @registry ||= {}
  end

  def self.current
    System.factory
  end

  # = System
  #
  # Source Control system base class.

  class System < Tool

    include Utilities

    def self.registry
      Systems.registry
    end

    def self.register(*names)
      registry[name] = self
    end

    def self.inherited(base)
      registry[base.basename.downcase] = base
    end

    def self.factory(name=nil)
      name ||= detect
      registry[name]     
    end

    def self.detect
      scm = %w(.svn .git .hg _darcs CVS).find{ |f| File.exist?(f) }
      case scm
      when '.svn'     then 'svn'
      when '.git'     then 'git'
      when 'CVS'      then 'cvs'
      when '_darcs'   then 'darcs'
      when '.hg'      then 'hg'
      end
    end

  end

end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reap-9.4.0 lib/reap/systems/system.rb