Class: RightScraper::Repositories::Svn
- Inherits:
-
Base
- Object
- RightScraper::RegisteredBase
- Base
- RightScraper::Repositories::Svn
- Defined in:
- lib/right_scraper/repositories/svn.rb
Overview
A repository that is stored in a Subversion server.
Instance Attribute Summary collapse
-
#first_credential ⇒ Object
(also: #username)
(String) Optional, SVN username.
-
#second_credential ⇒ Object
(also: #password)
(String) Optional, SVN password.
-
#tag ⇒ Object
(also: #revision)
(String) Optional, tag or branch of repository that should be downloaded.
Attributes inherited from Base
#display_name, #resources_path, #url
Instance Method Summary collapse
-
#checkout_hash ⇒ Object
Return a unique identifier for this revision in this repository.
-
#initialize(*args) ⇒ Svn
constructor
Create a new SvnRepository.
-
#repo_type ⇒ Object
(String) Type of the repository, here ‘svn’.
-
#retriever(options) ⇒ Object
Instantiate retriever for this kind of repository.
-
#to_url ⇒ Object
Convert this repository to a URL in the style of resource URLs.
Methods inherited from Base
#==, #equal_repo?, from_hash, register_url_schemas, registered_url_schemas, registration_module, #repository_hash, #to_s
Methods inherited from RightScraper::RegisteredBase
query_registered_type, register_class, register_self, registered_types, registration_module
Constructor Details
#initialize(*args) ⇒ Svn
Create a new SvnRepository. If the tag is not specified, defaults to HEAD.
46 47 48 49 |
# File 'lib/right_scraper/repositories/svn.rb', line 46 def initialize(*args) super @tag = "HEAD" if @tag.nil? end |
Instance Attribute Details
#first_credential ⇒ Object Also known as: username
(String) Optional, SVN username
37 38 39 |
# File 'lib/right_scraper/repositories/svn.rb', line 37 def first_credential @first_credential end |
#second_credential ⇒ Object Also known as: password
(String) Optional, SVN password
41 42 43 |
# File 'lib/right_scraper/repositories/svn.rb', line 41 def second_credential @second_credential end |
#tag ⇒ Object Also known as: revision
(String) Optional, tag or branch of repository that should be downloaded
33 34 35 |
# File 'lib/right_scraper/repositories/svn.rb', line 33 def tag @tag end |
Instance Method Details
#checkout_hash ⇒ Object
Return a unique identifier for this revision in this repository.
Returns
- String
-
opaque unique ID for this revision in this repository
60 61 62 |
# File 'lib/right_scraper/repositories/svn.rb', line 60 def checkout_hash digest("#{PROTOCOL_VERSION}\000#{repo_type}\000#{url}\000#{tag}") end |
#repo_type ⇒ Object
(String) Type of the repository, here ‘svn’.
52 53 54 |
# File 'lib/right_scraper/repositories/svn.rb', line 52 def repo_type :svn end |
#retriever(options) ⇒ Object
Instantiate retriever for this kind of repository
Options
:max_bytes
-
Maximum number of bytes to read
:max_seconds
-
Maximum number of seconds to spend reading
:basedir
-
Destination directory, use temp dir if not specified
:logger
-
Logger to use
Return
- retriever(Retrivers::Svn)
-
Retriever for this repository
87 88 89 |
# File 'lib/right_scraper/repositories/svn.rb', line 87 def retriever() RightScraper::Retrievers::Svn.new(self, ) end |
#to_url ⇒ Object
Convert this repository to a URL in the style of resource URLs.
Returns
- URI
-
URL representing this repository
68 69 70 71 72 73 74 75 |
# File 'lib/right_scraper/repositories/svn.rb', line 68 def to_url if first_credential uri = add_users_to(url, first_credential, second_credential) else uri = URI.parse(url) end uri end |