Sha256: ba71a06994a1328c80fe312b63326ff835a663c54c6b48d3634041d617c8d74c

Contents?: true

Size: 566 Bytes

Versions: 3

Compression:

Stored size: 566 Bytes

Contents

require 'vclog/adapters/svn'
require 'vclog/adapters/git'
require 'vclog/adapters/hg'
#require 'vclog/vcs/darcs'

module VCLog

  module Adapters

    #
    def self.factory(config) #, options={})
      type = read_type(config.root)
      raise ArgumentError, "Not a recognized version control system." unless type
      const_get(type.capitalize).new(config) #, options)
    end

    #
    def self.read_type(root)
      dir = nil
      Dir.chdir(root) do
        dir = Dir.glob("{.svn,.git,.hg,_darcs}").first
      end
      dir[1..-1] if dir
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vclog-1.7.0 lib/vclog/adapters.rb
vclog-1.6.1 lib/vclog/adapters.rb
vclog-1.6.0 lib/vclog/adapters.rb