Class: Repomen::Retriever
- Inherits:
-
Object
- Object
- Repomen::Retriever
- Includes:
- WithDefaultConfig
- Defined in:
- lib/repomen/retriever.rb
Overview
The Retriever retrieved repos and discards at will.
url = "[email protected]:atlassian_tutorial/helloworld.git"
Retriever.new(url)
When called with a block, the repo is automatically deleted afterwards
Retriever.new(url) do |local_path|
# repo is cloned in +local_path+
end
# repo is gone
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#discard_repo ⇒ Object
Removes the repo from the filesystem.
-
#initialize(url, config = default_config, &block) ⇒ Retriever
constructor
A new instance of Retriever.
Methods included from WithDefaultConfig
Constructor Details
#initialize(url, config = default_config, &block) ⇒ Retriever
Returns a new instance of Retriever.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/repomen/retriever.rb', line 19 def initialize(url, config = default_config, &block) service = Repo::Service.for(url) @handler = service.handler_class.new(url, repo_dir(service), config) @handler.retrieve @path = @handler.path if block block.call(@path) discard_repo end end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
17 18 19 |
# File 'lib/repomen/retriever.rb', line 17 def path @path end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
17 18 19 |
# File 'lib/repomen/retriever.rb', line 17 def url @url end |
Instance Method Details
#discard_repo ⇒ Object
Removes the repo from the filesystem
31 32 33 |
# File 'lib/repomen/retriever.rb', line 31 def discard_repo @handler.discard end |