class Omnibus::Fetcher
Base class for classes that fetch project sources from the internet.
@abstract Subclass and override the {#clean}, {#description},
{#fetch}, {#fetch_required?}, and {#version_guid} methods
@todo Is this class supposed to be abstract or not? Pretty sure
it's supposed to be abstract
Constants
- NULL_ARG
Attributes
@todo What is this? It doesn’t appear to be used anywhere
Public Class Methods
Returns an implementation of {Fetcher} that can retrieve the given software.
@param software [Omnibus::Software] the software the Fetcher
should fetch @return [Omnibus::Fetcher]
# File lib/omnibus/fetcher.rb, line 100 def self.for(software) if software.source if software.source[:url] && Omnibus.config.use_s3_caching S3CacheFetcher.new(software) else without_caching_for(software) end else Fetcher.new(software) end end
# File lib/omnibus/fetcher.rb, line 136 def self.name(name=NULL_ARG) @name = name unless name.equal?(NULL_ARG) @name end
# File lib/omnibus/fetcher.rb, line 146 def initialize(software) end
@param software [Omnibus::Software] the software to fetch @raise [UnsupportedSourceLocation] if the software’s source is not
one of `:url`, `:git`, or `:path`
@see Omnibus::Software#source
@todo Define an enumeration of the acceptable software types @todo This probably ought to be folded into {#for} method above.
It looks like this is called explicitly in {Omnibus::S3Cache#fetch}, but that could be handled by having a second optional parameter that always disables caching.
@todo Since the software determines what fetcher must be used to
fetch it, perhaps this should be a method on {Omnibus::Software} instead.
# File lib/omnibus/fetcher.rb, line 124 def self.without_caching_for(software) if software.source[:url] NetFetcher.new(software) elsif software.source[:git] GitFetcher.new(software) elsif software.source[:path] PathFetcher.new(software) else raise UnsupportedSourceLocation, "Don't know how to fetch software project #{software}" end end
Public Instance Methods
@todo Empty method is very suspicious; raise NotImplementedError instead.
# File lib/omnibus/fetcher.rb, line 171 def clean end
@todo All extenders of this class override this method. Since
this class appears to be intended as an abstract one, this should raise a NotImplementedError
# File lib/omnibus/fetcher.rb, line 158 def description # Not as pretty as we'd like, but it's a sane default: inspect end
@todo Empty method is very suspicious; raise NotImplementedError instead.
# File lib/omnibus/fetcher.rb, line 175 def fetch end
@todo All extenders of this class override this method. Since
this class appears to be intended as an abstract one, this should raise a NotImplementedError
# File lib/omnibus/fetcher.rb, line 166 def fetch_required? false end
# File lib/omnibus/fetcher.rb, line 149 def log(message) puts "[fetcher:#{self.class.name}::#{name}] #{message}" end
@todo Empty method is very suspicious; raise NotImplementedError instead.
# File lib/omnibus/fetcher.rb, line 179 def version_guid end