Class: Chrysalis::VCS::Subversion::Repository

Inherits:
Repository show all
Defined in:
lib/chrysalis/vcs/svn/repository.rb

Overview

Implements support for checking out dependencies from a Subversion repository.

Repositories of this type are identified by svn://, svn+ssh://, http://, or https:// URLs.

Example:

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Repository

inherited, retrieve

Constructor Details

#initialize(url, params = {}) ⇒ Repository

Returns a new instance of Repository.



40
41
42
43
# File 'lib/chrysalis/vcs/svn/repository.rb', line 40

def initialize(url, params = {})
  @url = url
  @params = params
end

Class Method Details

.retrieves?(url, params = {}) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/chrysalis/vcs/svn/repository.rb', line 25

def self.retrieves?(url, params = {})
  if params[:repository]
    return (params[:repository] == 'svn' || params[:repository] == 'subversion')
  end
  
  uri = URI::parse(url)
  return true if (uri.scheme == 'svn' || uri.scheme == 'svn+ssh')
  return false if (uri.scheme != 'http' && uri.scheme != 'https')
  return true if uri.host.begin? 'svn'
  return true if uri.path.split('/').include? 'svn'

  false
end

Instance Method Details

#retrieve(to = '.') ⇒ Object

Raises:

  • (IOError)


45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/chrysalis/vcs/svn/repository.rb', line 45

def retrieve(to = '.')
  path = Pathname.new(to).join(checkout_to)
  raise IOError, "Refusing to overwrite existing path. (path: #{path})" if path.exist?

  unless @params[:noop]
    puts ""
    puts "Checking out #{@url} ..."
    sh "svn co #{@url} #{path.cleanpath}"
  end

  WorkingCopy.new(:url => @url,
                  :path => path.cleanpath.to_s)
end