Class: RightScraper::Repositories::Download
- Inherits:
-
Base
- Object
- RightScraper::RegisteredBase
- Base
- RightScraper::Repositories::Download
- Defined in:
- lib/right_scraper/repositories/download.rb
Overview
A repository that is just an archive file hanging off a web server somewhere. This version uses a command line curl to download the archive, and command line tar to extract it.
Instance Attribute Summary collapse
-
#first_credential ⇒ Object
(String) Optional, username.
-
#second_credential ⇒ Object
(String) Optional, password.
-
#tag ⇒ Object
(also: #revision)
(String) Optional, SHA of contents.
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.
-
#repo_type ⇒ Object
(String) Type of the repository, here ‘download’.
-
#retriever(options) ⇒ Object
Instantiate retriever for this kind of repository.
-
#to_s ⇒ Object
Unique representation for this repo, should resolve to the same string for repos that should be cloned in same directory.
-
#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
Methods inherited from RightScraper::RegisteredBase
query_registered_type, register_class, register_self, registered_types, registration_module
Instance Attribute Details
#first_credential ⇒ Object
(String) Optional, username
40 41 42 |
# File 'lib/right_scraper/repositories/download.rb', line 40 def first_credential @first_credential end |
#second_credential ⇒ Object
(String) Optional, password
43 44 45 |
# File 'lib/right_scraper/repositories/download.rb', line 43 def second_credential @second_credential end |
#tag ⇒ Object Also known as: revision
(String) Optional, SHA of contents
46 47 48 |
# File 'lib/right_scraper/repositories/download.rb', line 46 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
70 71 72 |
# File 'lib/right_scraper/repositories/download.rb', line 70 def checkout_hash digest("#{PROTOCOL_VERSION}\000#{repo_type}\000#{url}\000#{tag}") end |
#repo_type ⇒ Object
(String) Type of the repository, here ‘download’.
35 36 37 |
# File 'lib/right_scraper/repositories/download.rb', line 35 def repo_type :download 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::Download)
-
Retriever for this repository
84 85 86 |
# File 'lib/right_scraper/repositories/download.rb', line 84 def retriever() RightScraper::Retrievers::Download.new(self, ) end |
#to_s ⇒ Object
Unique representation for this repo, should resolve to the same string for repos that should be cloned in same directory
Returns
- res(String)
-
Unique representation for this repo
54 55 56 |
# File 'lib/right_scraper/repositories/download.rb', line 54 def to_s res = "download #{url}" end |
#to_url ⇒ Object
Convert this repository to a URL in the style of resource URLs.
Returns
- URI
-
URL representing this repository
62 63 64 |
# File 'lib/right_scraper/repositories/download.rb', line 62 def to_url add_users_to(url, first_credential, second_credential) end |